Skip to content

Add cuda-device support for packed bf16x2 FMA #190

Closed

Description

@niklebedenko

Problem

PTX supports fma.rn.bf16x2 on sm_80+, but cuda-oxide does not currently expose that packed bf16 operation through the public CUDA device API. There is also no end-to-end compiler representation for the operation across the device declaration, NVVM dialect, MIR importer, MIR lowering, and examples.

Why this matters

Packed bf16 arithmetic is a hardware feature users should be able to express without inline-PTX workarounds. On Ampere, fma.rn.bf16x2 is especially important because packed add.bf16x2 and mul.bf16x2 require sm_90+, while FMA is available on sm_80+.

Expected behavior

Device code should be able to call a repo-native cuda_device::bf16x2::fma_bf16x2(a, b, c) -> u32 intrinsic where each u32 stores two bf16 lanes. The compiler should lower that intrinsic to PTX fma.rn.bf16x2, and a focused example should prove the full path works.

This should stay focused on FMA. Adding packed bf16 add/mul would imply a common architecture contract that PTX does not provide on Ampere.

Acceptance criteria

  • cuda-device exposes a documented packed bf16x2 FMA intrinsic with the lane layout and architecture support stated clearly.
  • dialect-nvvm has a registered nvvm.fma_bf16x2 operation.
  • The MIR importer recognizes the public device intrinsic path.
  • MIR lowering emits inline PTX for fma.rn.bf16x2.
  • A focused rustc-codegen-cuda example includes Cargo.lock and checks a concrete packed bf16x2 result.
  • Tests or examples cover the dialect operation and the end-to-end intrinsic path.

Activity

  1. added
    intrinsics
    cuda-feature
    enhancement
    on Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cuda-featureenhancementintrinsics

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions