Repository navigation
feat(intrinsics): add extended integer min/max (DPX relu and 16x2 forms) - #967
Merged
Merged
Conversation
almightychang
force-pushed
the
dpx-relu-16x2-intrinsics
branch
from
August 17, 2026 07:05
6e4681c to
b0cfe40
Compare
almightychang
force-pushed
the
dpx-relu-16x2-intrinsics
branch
from
August 17, 2026 09:35
b0cfe40 to
0630ae8
Compare
Collaborator
|
Reviewed and validated locally on a 5090 (sm_120):
One coordination note: this PR and #946 were both written against the same ledger tail and both claim ABI IDs i0987-i0994. This one lands first and keeps the numbers; #946 renumbers. Follow-ups we'll track separately, not blockers here:
CI runs are approved. Merging once they're green. |
The PTX ISA 8.0 integer min/max extensions — the .relu qualifier on s32 and s16x2, and the packed s16x2/u16x2 pairs — are the remaining Phase 4 DPX gap of issue NVIDIA#338: ptxas fuses dataflow-adjacent chains of them into VIMNMX-family SASS, but they have no NVVM intrinsic records in the pinned LLVM import (LLVM reaches them from generic llvm.smin/llvm.smax selection patterns), so the llvm_imported route cannot admit them. They enter the catalog as ptx_native contracts instead, following the packed_alu precedent. The plain scalar s32 forms are deliberately absent: ordinary Rust min/max already lowers to native min.s32/max.s32. The new integer_minmax family admits eight variants (min/max x relu.s32, s16x2, u16x2, relu.s16x2) as a closed recipe: overlay shard, ABI ledger entries i0987-i0994, generator model/resolve/render support, a dialect op per variant, importer pure-value dispatch, and a two-operand =r,r,r inline-PTX lowering shared by both scalar and packed carriers. Scalar variants surface as cuda_intrinsics::int (i32), packed variants as cuda_intrinsics::i16x2 (u32 carrier), with cuda_device compatibility modules included from generated sources. Evidence: each variant was probed with the pinned Rust LLVM 22.1.2 llc (identity-matched to the rust-llvm-22.1.2-1cb4e383 profile) at sm_90/+ptx80 through the candidate probe flow; the records are admitted at status "lowered" because no pinned CUDA 13.3 ptxas was available for the terminal PTX-assembly stage, and the lib_nvvm backend route is left to a follow-up for the same reason. An end-to-end sm_90 device build was verified to emit all eight instructions in PTX 8.0, and a mir-lower lowering test pins the exact inline-asm shape per variant. Signed-off-by: almightychang (Sam, Joochul Chang) <[email protected]>
Signed-off-by: almightychang (Sam, Joochul Chang) <[email protected]>
Signed-off-by: almightychang (Sam, Joochul Chang) <[email protected]>
almightychang
force-pushed
the
dpx-relu-16x2-intrinsics
branch
from
August 17, 2026 13:02
0630ae8 to
6277133
Compare
nihalpasham
approved these changes
Aug 17, 2026
This was referenced Aug 17, 2026
nihalpasham
added a commit
that referenced
this pull request
Aug 18, 2026
…ted in #406 (#977) * docs(mir-lower): the intrinsic converter table names two modules deleted in #406 `README.md`'s "GPU Intrinsic Converters (`convert/intrinsics/`)" table has 13 rows for a directory holding 24 modules. Two of the 13 do not exist: convert/intrinsics/stmatrix.rs deleted in 6a9a637 (#406) convert/intrinsics/tcgen05.rs deleted in 6a9a637 (#406) Both were removed when "Generate CUDA intrinsics from pinned LLVM metadata" moved those families onto the catalog path. The table still describes them as hand-written converters with an "Inline PTX" strategy; `stmatrix` and `tcgen05` are mentioned 460 times in `convert/generated_intrinsics.rs` today. So a reader looking for where either is lowered is sent to a file that has not existed for many releases. Same shape as #797, one crate over. A third row, `generated_intrinsics`, is real but not in that directory -- it is `convert/generated_intrinsics.rs`, one level up. That is the row most worth getting right, since it is where nearly every intrinsic now goes. Fourteen modules that do exist had no row at all: `asm`, `cp_async`, `dotprod`, `execution_control`, `extended_minmax`, `integer_minmax`, `ldmatrix`, `memory`, `packed`, `prmt`, `scalar_arithmetic`, `scalar_conversion`, `scalar_math`, `wmma`. `integer_minmax` arrived last batch with #967. Rewritten as one row per file, with each description taken verbatim from that module's own `//!` doc comment, so the table cannot drift from the code without the doc comment drifting first. The "Strategy" and "GPU" columns are dropped: they were per-module guesses at what are per-intrinsic properties, and the catalog already records the PTX version and minimum SM for each, rendered into `intrinsics/generated-reference.md` alongside the sources. The page now points there instead of keeping a second copy by hand -- the same treatment #964 gave the book's dialect-nvvm table. The Core Modules table on the same page was short by four: the top-level `type_conversion_interface`, `scalarize_block_args` and `wgmma_deferred_accumulator`, plus `convert/enum_payload_storage`. Verified by script: the converter table's rows are now exactly the set of `.rs` files in `convert/intrinsics/` (24 and 24, no ghost and no missing), and every top-level `src/*.rs` module and every `convert/*.rs` module has a row. Signed-off-by: Vyncint Ng <[email protected]> * docs(mir-lower): add the convert/type_interface_impls row The Core Modules table listed convert/interface_impls but not its type-conversion counterpart; description taken from the module's own doc comment. --------- Signed-off-by: Vyncint Ng <[email protected]> Co-authored-by: nihalpasham <[email protected]>
nihalpasham
pushed a commit
that referenced
this pull request
Aug 18, 2026
…alidates (#969) The obligation #964's merge comment attached to #946 landing. #946 has landed (d485edb), and it was not the only batch member to move these numbers. The page carries a self-invalidating stamp: "If the header stamp no longer starts with `df42ef97`, the counts on this page predate the catalog you are reading." Every `ops/generated/` header now prints `20440c06...`, so it does. Recomputed from the tree at d485edb, with each delta attributed by `git ls-tree` + `git show` per module rather than from a PR diff: generated/integer_minmax.rs 0 -> 8 new module (#967, DPX min/max) generated/packed_alu.rs 22 -> 30 f32x2 arithmetic (#946) ops/wgmma.rs 6 -> 7 counted-K pipeline op (#935) which moves five figures and adds a row: stamp df42ef97 -> 20440c06 total 543 across 41 modules -> 560 across 42 hand-written 18 ops -> 19 (`wgmma` 6 -> 7) generated 34 modules / 525 ops / 986 catalog entries -> 35 modules / 541 ops / 1002 catalog entries Packed (SIMD-in-reg) 43 -> 51 Integer min/max (DPX) new row, 8 -- `integer_minmax` `integer_minmax` gets its own row rather than joining Scalar math beside `extended_minmax`: six of its eight ops are `16x2` packed forms (`max_s16x2`, `min_relu_s16x2`, ...) and two are scalar `s32`, so it is a feature area rather than a scalar-math addition. Checked and unchanged in the same pass: dialect-mir is still 62 ops across 12 modules with 9 types, and the `pliron` pin is still 8447aa42, so the LLVM dialect's 69 stands. **A correction to my own #964 while I am here.** That PR asserted #946 added no ops, on the strength of `gh pr diff 946 | grep -c pliron_op` returning 0. As the merge comment noted, `gh pr diff` returns empty on a diff that large, so the grep was counting nothing rather than finding nothing -- an unfalsifiable check that reads as a clean result. Every count in this commit is derived from git objects in the tree instead. Separately, the chapter's opening said cuda-oxide "works across three pliron dialects ... two defined locally". Two more local pliron dialects exist and the book never mentions either: `dialect-iket` (7 ops, 2 types) and `dialect-ptx` (#917). The claim is now scoped to the lowering path, which is what this chapter actually covers, with a pointer to the two crates' READMEs. The same count appears in `pliron.md` and `architecture-overview.md`; those are a separate change, and this one does not touch either file. Verified: every figure on the page recomputed by script against the tree; `just book` (`sphinx-build -W --keep-going`) succeeds; check-book-api-names passes. Signed-off-by: Vyncint Ng <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #338
Summary
Add the
integer_minmaxintrinsic family with eight PTX ISA 8.0 / SM90+ integer min/max extensions: min/max acrossrelu.s32,s16x2,u16x2, andrelu.s16x2.The pinned LLVM import has no NVVM intrinsic records for these operations; LLVM reaches them through generic
smin/smaxselection. Following the existingpacked_aluprecedent, this family therefore enters the catalog under a reviewedptx_nativecontract.Plain scalar
s32min/max is deliberately excluded because ordinary Rustmin/maxalready lowers to nativemin.s32/max.s32. That path is handled separately in #951.Changes
integer_minmaxcatalog recipe and ABI entriesi0987throughi0994.cuda_intrinsics::intandcuda_intrinsics::i16x2APIs, with matchingcuda_devicecompatibility modules.examples/integer_minmax, which launches all eight intrinsics and checks scalar and individual packed-lane results against host references.Evidence
All eight variants were probed successfully with the pinned Rust LLVM 22.1.2
llcatsm_90 +ptx80, producing the expected PTX instruction heads.Only the
llvm_nvptxevidence route is declared. This does not make the family unavailable in alib_nvvmbuild:requirement_for_backendfalls back to the top-level requirement, and the lowering does not consume the backend argument, so that build emits the same inline PTX. The route works, but remains unaudited until a CUDA 13.3 libNVVM evidence profile is recorded and added as a second route.Evidence status is
loweredandruntime_validationisunexecuted, matching the repository convention: all 547 existing evidence entries areunexecuted, with noexecutedprecedent. Recorded terminalptxasvalidation and runtime testing on physical SM90 hardware were not performed because the local toolkit is CUDA 12.0 and the available GPU is SM120.Generated artifacts
The catalog grows from 986 to 994 ABI entries and adds eight probe files. Most of the 1,100-file diff is deterministic catalog SHA regeneration churn across checked-in generated outputs, following the same pattern as #721.
Testing
llcprobes passed.cargo run -p cuda-intrinsics-gen -- checkcargo test -p cuda-intrinsics-gen— 289 passedcargo test -p mir-lower— 334 passed, including the new lowering coveragecargo oxide run integer_minmaxon an RTX 5080 (sm_120) — all eight intrinsics passed value verificationscripts/check-example-smoketest-contract.shcargo fmt --all -- --check