Skip to content

refactor: generate compiler libdevice math dispatch - #1649

Open
uurl wants to merge 4 commits into
NVIDIA:mainfrom
uurl:feat/libdevice-math-generated-dispatch
Open

uurl wants to merge 4 commits into
NVIDIA:mainfrom
uurl:feat/libdevice-math-generated-dispatch

Conversation

@uurl

@uurl uurl commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Replace duplicated compiler math mapping tables with shared dispatch generated from the libdevice_math shard.

Preserve all 82 existing f32/f64 libm exports and the core-only powi/fmuladd routes, including the scalar functions and frexp adapter introduced by the prerequisite PRs. This migration adds no new math exports.

Depends on #1638, #1645, and #1646. This branch includes their prerequisite changes.

Refs #1224.

Changes

  • Generate the shared math enum, placeholder constants, compiler paths, aliases, operand counts, libdevice/LLVM symbols, cmath allowlist, and link requirements.
  • Make the importer, MIR lowerer, and rustc collector consume the shared dispatch.
  • Remove their duplicated handwritten mapping lists.
  • Extend the shard to schema 2 and capture all 74 required libdevice ABI signatures.
  • Include compiler dispatch in generation, drift checks, and stale-output reconciliation while preserving the hardware catalog and ABI ledger.
  • Add a regression fixture covering 214 pre-migration compiler paths, plus negative and control tests.
  • Preserve the handwritten semantic expansions for frexp, sincos, min/max, and fast arithmetic.

Testing

  • just check: formatting, Clippy, tests, guards, generated outputs, ABI history, documentation, and doctests passed.
  • Generator suite: 336 tests passed.
  • verify-libdevice against installed CUDA: 74 signatures verified.
  • Isolated CLI controls: unchanged generated output accepted; modified compiler dispatch rejected as stale.
  • cargo oxide run math_special: 776 checks passed.
  • cargo oxide run libm_math: all lanes matched host math.
  • cargo oxide run math_hyperbolic: 288 comparisons passed.

Checklist

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

uurl added 4 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>
@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:53
@uurl
uurl requested a review from nihalpasham as a code owner October 26, 2026 06:53

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