Skip to content

feat: lower modf and remquo through libdevice out parameters - #1651

Open
uurl wants to merge 6 commits into
NVIDIA:mainfrom
uurl:feat/libdevice-math-out-params
Open

uurl wants to merge 6 commits into
NVIDIA:mainfrom
uurl:feat/libdevice-math-out-params

Conversation

@uurl

@uurl uurl commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add f32 and f64 mappings for libm::modf{f} and libm::remquo{f} to the generated libdevice math shard.
  • Reuse the frexp out-parameter call helper and pack the results according to the Rust tuple layout. Normalize the remquo quotient to zero when the remainder is NaN.
  • Extend CUDA 13.0 ABI evidence, generator and lowering tests, and add the math_out_params GPU example.

The shard now covers 108 of the 124 public f32/f64 exports in libm 0.2.16.

Validation

  • cargo oxide fmt --check
  • cargo run -p cuda-intrinsics-gen --locked -- check
  • cargo test -p cuda-intrinsics-gen -p dialect-mir -p mir-importer -p mir-lower --all-targets --locked
  • cargo clippy -p cuda-intrinsics-gen -p dialect-mir -p mir-importer -p mir-lower --all-targets --locked -- -D warnings
  • cargo oxide run math_out_params: 180 GPU checks passed across f32 and f64
  • cargo oxide run math_special: 776 GPU checks passed
  • just check

Depends on #1650. Refs #1224.

This completes the planned out-parameter mappings. The remaining 16 libm exports require separate semantic handling; this PR does not close #1224.

Testing

  • just -f cuda-oxide/Justfile check passes (the local mirror of CI: fmt, clippy, tests, guards, docs)
  • cargo oxide run <example> passes, or cuda-oxide/scripts/smoketest.sh -o '^<example>$'
  • New example added (if applicable)

Checklist

  • All commits signed off (git commit -s)
  • SPDX headers on new source files

uurl added 6 commits October 25, 2026 19:16
Signed-off-by: Raul Estrada <raulestradaa@gmail.com>
Signed-off-by: Raul Estrada <raulestradaa@gmail.com>
Signed-off-by: Raul Estrada <raulestradaa@gmail.com>
Signed-off-by: Raul Estrada <raulestradaa@gmail.com>
Signed-off-by: Raul Estrada <raulestradaa@gmail.com>
Signed-off-by: Raul Estrada <raulestradaa@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Oct 26, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@uurl
uurl marked this pull request as ready for review October 26, 2026 06:55
@uurl
uurl requested a review from nihalpasham as a code owner October 26, 2026 06:55

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate the libm → libdevice math table instead of hand-editing three crates

1 participant