Skip to content

feat: lower libm j1 and j1f through libdevice - #1660

Open
uurl wants to merge 9 commits into
NVIDIA:mainfrom
uurl:feat/libdevice-bessel-j1
Open

uurl wants to merge 9 commits into
NVIDIA:mainfrom
uurl:feat/libdevice-bessel-j1

Conversation

@uurl

@uurl uurl commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Map libm::j1 and libm::j1f to __nv_j1 and __nv_j1f.
  • Normalize the result to +0 for either infinite input. CUDA returns -0 for j1(-inf), while libm 0.2.16 returns +0.
  • Add generator validation, MIR lowering tests, and a GPU example covering both precisions, signed zero, finite inputs, infinities, NaN, and control calls.

The generated table now covers 120 of 124 f32/f64 libm exports. jn, jnf, yn, and ynf remain for a follow-up PR.

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_bessel_j1: 84 checks passed across f32 and f64
  • just check

Stacked on #1653. Refs #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 9 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>
Signed-off-by: Raul Estrada <raulestradaa@gmail.com>
@uurl
uurl requested a review from nihalpasham as a code owner October 27, 2026 04:54
@copy-pr-bot

copy-pr-bot Bot commented Oct 27, 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