Skip to content

feat: lower C23 min/max libm exports for f32 and f64 - #1653

Open
uurl wants to merge 8 commits into
NVIDIA:mainfrom
uurl:feat/libdevice-c23-minmax
Open

uurl wants to merge 8 commits into
NVIDIA:mainfrom
uurl:feat/libdevice-c23-minmax

Conversation

@uurl

@uurl uurl commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add the eight f32/f64 exports for fmaximum, fminimum, fmaximum_num, and fminimum_num to the generated math mapping.
  • Lower them with ordered comparisons and selects, preserving the distinct NaN rules and signed-zero results. These mappings introduce no new libdevice links.
  • Add importer and lowering tests, plus the math_c23_minmax GPU example.

Generated coverage increases from 110 to 118 of the 124 libm exports. The six Bessel exports remain outside this PR.

Part of #1224. This PR is based on #1652.

Validation

  • 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_c23_minmax: 1,158 checks passed across f32 and f64
  • just check

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

Checklist

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

uurl added 8 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>
Signed-off-by: Raul Estrada <raulestradaa@gmail.com>
Signed-off-by: Raul Estrada <raulestradaa@gmail.com>
@uurl
uurl requested a review from nihalpasham as a code owner October 26, 2026 07:09
@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.

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.

1 participant