You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rust abs, copysign, max, and min operations are lowered to libdevice
calls even though LLVM and the NVPTX backend can lower them directly to PTX.
Why this matters
A kernel using only these scalar operations is routed through the heavier
libNVVM and nvJitLink pipeline and acquires a CUDA Toolkit runtime dependency
that its generated code does not otherwise need.
Expected behavior
These operations should remain on the ordinary LLVM-to-PTX path. abs and copysign can use their LLVM intrinsics; max and min need compare/select
lowering that matches Rust's signaling-NaN semantics. Transcendental and other
libdevice-owned functions should continue to use their existing __nv_*
lowering.
Acceptance criteria
abs and copysign lower to width-correct LLVM intrinsics for both widths.
Rust max and min ignore quiet and signaling NaNs in either operand
position, without using LLVM 21's incompatible legacy maxnum/minnum.
abs produces exact finite/zero bits and clears a NaN sign without
constraining the NaN payload.
copysign changes only the sign bit and preserves the magnitude operand's
exact NaN payload.
Unrelated math operations continue to use libdevice.
Activity
fix(mir-lower): lower rounding ops to LLVM intrinsics instead of libd…
fix(mir-lower): lower rounding intrinsics to LLVM instead of libdevice (