Skip to content

Legacy NVVM export rejects relaxed f32/f64 atomic add #380

Closed

Description

@niklebedenko

Problem

CUDA Oxide lowers floating-point fetch_add to LLVM atomicrmw fadd. Modern LLVM/NVVM accepts that form, but the legacy LLVM 7 NVVM dialect used for pre-Blackwell targets predates floating-point atomicrmw, so otherwise valid relaxed device-scoped DeviceAtomicF32 and DeviceAtomicF64 kernels fail during legacy legalization/export.

NVIDIA's NVVM IR specification provides dedicated atomic-add intrinsics for f32 and f64 pointers in generic, global, and shared address spaces.

Before: legacy legalization rejects `atomicrmw fadd` as unsupported
After:  relaxed device-scoped f32/f64 add lowers to the matching NVVM intrinsic

Required semantics

The legacy intrinsic corresponds to CUDA's relaxed, device-scoped atomic add. Rewriting must therefore be limited to:

  • f32 or f64 values;
  • generic, global, or shared pointer address spaces (0, 1, or 3);
  • monotonic LLVM ordering;
  • syncscope("device").

Block/system scope, stronger direct orderings, unsupported widths/address spaces, and other floating RMW kinds must remain explicit errors rather than being weakened. Validation must finish before mutation so a bad operation cannot leave a partially legalized module.

Acceptance criteria

  • All six documented f32/f64 × p0/p1/p3 overloads lower to exact NVVM intrinsic signatures.
  • Unsupported semantics fail before any module mutation.
  • Existing integer-RMW behavior remains unchanged.
  • Legacy LLVM IR contains no atomicrmw fadd after legalization.
  • Optimized and no-opt legacy builds execute correctly on a supported GPU.

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions