Repository navigation
Conversation
drbh
force-pushed
the
gemm-sol-phase4b-fix
branch
2 times, most recently
from
August 20, 2026 00:40
15d6e20 to
34f00c0
Compare
…s own test (NVIDIA#1052) `mlir-dialects.md` anchors its op counts to a catalog stamp and says how to tell when they have rotted: At catalog SHA-256 `20440c06` (the stamp in every `ops/generated/` file header), the dialect holds 560 operations across 42 modules ... If the header stamp no longer starts with `20440c06`, the counts on this page predate the catalog you are reading. Every generated file now stamps `26a9cc13`, so that condition is true. Six numbers and one description are stale, all of them from the last batch of merges: | claim | page | tree | |---|--:|--:| | dialect total | 560 | **570** | | hand-written ops | 19 | **21** | | hand-written `wgmma` row | 7 | **9** | | generated ops | 541 | **549** | | catalog entries | 1002 | **1010** | | generated "Warp-level" row | 31 | **39** | The two deltas are traceable: NVIDIA#1021 and NVIDIA#1025 added two hand-written `wgmma` ops (19 -> 21), and NVIDIA#1032 added the eight `redux.sync` f32 variants (541 -> 549, 1002 -> 1010, and the Warp-level row that owns `redux`). The `wgmma` row's description moved with its count rather than just the number. It read "the m64n64k16 bf16 shapes", but NVIDIA#1025 added `WgmmaMmaM64N64K16F32F16Op` and `WgmmaMmaGroupValuesM64N64K16F32F16Op`, so the module now holds f16 shapes too. Module counts did not change: 7 hand-written plus 35 generated is still 42. Verified against the tree rather than against the merge descriptions: `^pub struct \w+Op;` counts 21 under `src/ops/` and 549 under `src/ops/generated/`, 570 together; `intrinsics/catalog.json` holds 1010 entries; and all 35 generated files carry the one stamp `26a9cc13`. Both tables sum to their new totals (7 rows to 21, 11 rows to 549) and each still lists every module on disk with nothing that is not one. Book builds clean under `sphinx-build -W`. Signed-off-by: Vyncint Ng <[email protected]>
…ist (NVIDIA#1053) * docs(book): the warp chapter says the f32 redux.sync form does not exist `warp-level-programming.md` closes its `redux.sync` section with: - **Integers only.** There is no `f32`/`f64` form before `sm_100`, so float reductions keep the butterfly. NVIDIA#1032 shipped that form. `cuda-device` now exports eight `f32` entry points that the chapter mentions nowhere: redux_sync_min_f32 redux_sync_max_f32 redux_sync_min_abs_f32 redux_sync_max_abs_f32 redux_sync_min_nan_f32 redux_sync_max_nan_f32 redux_sync_min_abs_nan_f32 redux_sync_max_abs_nan_f32 A reader following this page today writes the shuffle butterfly for an `f32` min/max reduction that the hardware can do in one instruction, because the book told them the instruction does not exist. Add a subsection for the family and correct the bullet. `f64` still has no `redux.sync` form, so that half of the claim stands and is kept. Three things the new subsection is careful about: - **It is not one function per operation.** The integer family is, and the page says so. For `f32`, `.abs` and `.NaN` are independent instruction modifiers, so each of the four combinations is its own entry point. - **The `.NaN` distinction is stated in the catalog's own terms.** The plain and `.abs` forms ignore NaN inputs; the `.NaN` forms propagate NaN when any lane contributes one. That is the difference that decides which to call. - **The floor is narrower than "sm_100+".** The catalog records PTX 8.6 with a target union of `sm_100a|sm_100f|sm_103a|sm_103f`, so the intrinsic is not selected on `sm_110a` or `sm_120a` -- consumer Blackwell included. Saying "Blackwell" without that would send RTX-50 users down a path that cannot lower. No performance claim is made. The integer section's 4.74x is a measurement on an A10G; the `f32` family needs a B200/GB200, `redux_f32` is in `SM100_COMPILE_EXAMPLES` so CI checks its emitted PTX rather than running it, and its `main` skips unless the device reports exactly `sm_100`. The subsection says that instead of implying a number. Verified: all eight names exist as `pub fn` in `crates/cuda-device/src/warp.rs`; the arch union, PTX version and NaN/abs semantics come from `intrinsics/catalog.json`, not from the merge description. Every one of the eight is written module-qualified, so `check-book-api-names.sh` now covers all of them -- it checks 39 qualified names where it checked 35, and renaming one to `redux_sync_max_abs_nan_f64` makes it fail. Book builds clean under `sphinx-build -W`. Signed-off-by: Vyncint Ng <[email protected]> * docs(book): plain-language pass on the redux f32 section --------- Signed-off-by: Vyncint Ng <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…ls FP8 Planned (NVIDIA#1054) * docs(book): the feature appendix has no row for tensor cores, and calls FP8 Planned The page opens by promising "every compiler capability, runtime API, and hardware feature along with its current support status." Three gaps against that promise, in increasing order of size. **FP8 is listed as not implemented.** Under "Not Yet Implemented": | FP8 / MX Data Types | **Planned** | Roadmap item for Blackwell. No architectural limitation. | The catalog holds 158 entries for these formats -- 12 conversions and 146 matrix ops -- surfacing as `pub unsafe fn` in `cuda_device::convert`, `cuda_device::wmma` and `cuda_device::tcgen05`, and the `mma_mxf8f6f4` example compiles them. By the page's own legend that is **Partial**, not Planned. The gap is real and worth naming rather than dropping the row: there is *no arithmetic* on these formats. Grouping the 158 by kind gives 12 `cvt` and 146 `mma`, and nothing matching add/mul/sub/fma/min/max/abs. So a value is carried as a packed bit pattern and converted before use, unlike `f16`/`bf16`, which have their own scalar and packed arithmetic modules. That is what the new row says. **The Warp section has no `redux.sync` row**, although `cuda_device::warp` exports sixteen of them. The section lists shuffle, vote and lane/warp ID. The new row carries both halves and their different floors: integers on sm_80+, and `f32` min/max with optional `.abs`/`.NaN` on `sm_100a`/`sm_100f`/`sm_103a`/`sm_103f` (NVIDIA#1032). `f64` has no form, which the row also says. **There is no matrix or tensor-core section at all.** `grep -i` for "tensor core", "wgmma", "tcgen05", "wmma", "mma" or "TMEM" across the whole appendix returns nothing -- no row for warp-level `mma.sync`, sparse MMA, Hopper warpgroup MMA, Blackwell tcgen05/TMEM, or the accumulator fragment algebra, in the feature matrix of a compiler whose headline example is a Blackwell GEMM. Add a section for it, and move the FP8 row there, since the matrix path is where those formats are actually used. Statuses are calibrated against the existing TMA section, which is the other Hopper+ hardware feature and marks compile-only-in-CI capabilities **Full** with the architecture stated in the description. These rows follow that. Every row is sourced from the tree, not from memory: module summaries come from each module's own `//!` header (`wgmma` states Hopper `sm_90a`, `tcgen05` Blackwell sm_100+), sparse MMA is confirmed by the `mma.sp.sync.aligned.*` strings in `generated/sparse_mma.rs`, and the redux names are checked against `pub fn` declarations in `warp.rs`. Book builds clean under `sphinx-build -W` and `check-book-api-names.sh` passes. Signed-off-by: Vyncint Ng <[email protected]> * docs(book): correct the wgmma row and plain-language touch-ups in the feature appendix --------- Signed-off-by: Vyncint Ng <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…ed in a day (NVIDIA#1055) * ci: four tooling comments keep tree sizes by hand, and all four drifted in a day NVIDIA#1032 added one example, `redux_f32`, and eight catalog entries. That single merge falsified numbers in four places: | site | said | now | |---|--:|--:| | `check-example-license-policy.sh` (x3) | 217 locks | 218 | | `check-example-license-policy.sh` (x2) | 215 examples | 216 | | `check-example-license-policy.sh` | 13871 packages, floor 2170 | 13934, 2180 | | `cargo-deny.yml` | 31 runs instead of 217 | ... of 218 | | `Justfile` | 986 catalog entries | 1010 | | `examples-compile.yml` | 210 example crates | 216 | Six of those transcriptions are mine, from NVIDIA#1043 and NVIDIA#1044, written the day before. Refreshing them buys one day. The counts are not load-bearing in any of the four -- each is there to make a structural point -- so state the structure and let the code report the numbers: - The license-policy guard already announced its representative count. It now announces the lock count beside it, so the grouping ratio is observable output rather than a comment to keep in step: Checking deny.toml over 31 representative example workspaces, grouped from 218 example lock files. - Its scope comment and its enumeration cross-check now say "one lock per example directory, plus one per nested sub-workspace" instead of naming today's totals. - The parsed-package floor is computed as ten per lock, so the comment says that rather than quoting the current product. - `cargo-deny.yml` says one run per distinct dependency set instead of one per lock file, and points at the script's own output. - The `Justfile` comment's point was that the generated path dominates, which 35 generated op modules against 7 hand-written makes without an entry count. Module counts are structural and have not moved through any of these merges. - `examples-compile.yml`'s number only justified a timeout, so "every example crate" does the same job. One number is kept and re-labelled rather than removed: the `[a-m]*` glob illustration in the cross-check comment now reads "measured once ... 137 of the 217 locks then present", matching the timestamped-measurement idiom the same file already uses two paragraphs above. The argument needs a concrete ratio; making it explicitly historical stops it being a live claim. Verified: the guard passes unchanged -- 31 representatives grouped from 218 lock files, `deny.toml holds over every example workspace outside POLICY_EXEMPT_EXAMPLES`, exit 0. `bash -n` clean, `just --list` parses, all eleven workflows parse, and dialect-nvvm really does hold 35 generated and 7 hand-written op modules. Signed-off-by: Vyncint Ng <[email protected]> * ci: correct the floor-margin claim and tighten the rewritten tooling comments --------- Signed-off-by: Vyncint Ng <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…xported (NVIDIA#1056) * docs(cuda-device): the re-export table lists 10 of the 13 macros re-exported `src/lib.rs` re-exports thirteen macros from `cuda-macros`: pub use cuda_macros::{ cluster_launch, constant, convergent, cooperative_launch, cuda_module, device, gpu_printf, kernel, launch_bounds, launch_contract, ptx_asm, pure, readonly, }; The README's "Proc-Macro Re-exports" table lists ten of them. Missing are `#[cuda_module]`, `#[launch_contract]` and `#[constant]` -- which is to say, the entry point for typed module loading, the attribute that unlocks a safe launch, and the one that puts a static in constant memory. Not obscure corners: this same README already relies on `#[launch_contract(domain = 1, ...)]` in its `DisjointSlice` section and documents the `constant` module in its module table, so the crate's own README uses two of the three it does not list. Add the three rows, and tie the table's lead-in to the `pub use` list it mirrors so the next macro added there has an obvious place to land. Descriptions are taken verbatim from the book's API quick reference, which already carries all three, so the two documents now say the same thing rather than two things. Verified: the thirteen names in the `pub use` and the thirteen backticked rows in the table are the same set, with nothing in the table that is not re-exported. Signed-off-by: Vyncint Ng <[email protected]> * docs(cuda-device): plain wording for the launch_contract and constant rows --------- Signed-off-by: Vyncint Ng <[email protected]> Co-authored-by: nihalpasham <[email protected]>
NVIDIA#1057) * docs(cuda-macros): the README omits `#[constant]`, and its only derive `cuda-macros` exports sixteen macros. Its 500-line README documents fourteen. The two it never mentions are `#[constant]` and `#[derive(DeviceCopy)]`, and the second is the crate's only derive macro. The omissions are connected. The "Source Layout" tree lists three files under `src/`: ├── lib.rs # All proc-macro definitions (kernel, device, launch, etc.) ├── printf.rs # gpu_printf! implementation └── ptx_asm.rs # ptx_asm! implementation There are four. `device_copy.rs` -- the derive's whole implementation -- is not in the tree either, so nothing in the README points at the macro or at the file that defines it. Add a section for each, and the fourth file to the tree. `#[constant]` gets the three restrictions that decide whether it works, taken from its own rustdoc: the initializer must be `ConstantMemory::UNINIT` because non-zero initializers are not honored yet, it must appear inside a `#[cuda_module]` (elsewhere it silently produces an unreachable symbol with no setter, which is the failure mode worth warning about), and the identifier must not start with the reserved prefix. Both generated setters are named, with the stream-ordered one marked as the one to prefer. `#[derive(DeviceCopy)]` gets what makes it more than `Copy`: the trait is `unsafe` and promises every bit pattern is valid, which `DeviceBuffer` relies on when it turns raw device bytes back into values. The example is the real `#[derive(Copy, Clone, DeviceCopy)]` form used in `cuda-core`'s trybuild fixtures. It also records that structs and unions are accepted and enums are rejected with a diagnostic, since that is the first thing someone tries. Verified against the tree: the sixteen exported macros (eleven `#[proc_macro_attribute]`, four `#[proc_macro]`, one `#[proc_macro_derive]`) are now all named in the README, and the four files under `src/` are all in the tree. The `#[constant]` snippet is the shape `examples/constant_memory_coeffs/src/main.rs` already uses; `DeviceCopy`'s `Copy` bound, its `bool`/`char`/`NonZeroU32` rationale and its enum rejection all come from `cuda-core/src/device_buffer.rs` and `cuda-macros/src/device_copy.rs`. Signed-off-by: Vyncint Ng <[email protected]> * docs(cuda-macros): break up the constant restrictions and drop the type-theory jargon --------- Signed-off-by: Vyncint Ng <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…rence rows (NVIDIA#1067) * fix(intrinsics-gen): an unescaped pipe drops a column from three reference rows `intrinsics/generated-reference.md`'s main table has six columns. Three of its 1010 rows render with seven cells, and a renderer drops the extra one -- so those three lose their Backend evidence column entirely. The cause is a `|` in cell data. GFM splits a table row on pipes *before* it parses inline spans, so a pipe splits the cell even inside a code span; the spec's own rule is that a literal pipe must be written `\|` wherever it appears. Three catalog entries write a PTX destination pair that way: elect.sync <register|predicate>, <register-or-immediate>; match.all.sync.b32 <register|predicate>, <register-or-immediate>, ... match.all.sync.b64 <register|predicate>, <register-or-immediate>, ... `render_reference` interpolated `expected_ptx` straight into the row, so `elect_sync`, `match_all_sync` and `match_all_i64_sync` are the three intrinsics whose evidence column is unreachable in the rendered table. Escape the pipe. The helper is applied to every catalog-derived value in that row rather than to `expected_ptx` alone: the other fields carry no pipe today (proved below), so it is a no-op for them, and the next PTX pattern or LLVM symbol that grows one lands in an already-escaped cell. `availability` is left alone because the renderer builds it, markdown link included, rather than taking it from the catalog. A unit test renders the full reference and asserts every row has exactly seven cell delimiters after escaped pipes are removed, plus that at least three rows needed escaping at all -- so the check cannot pass by the patterns quietly disappearing. Reverting the escape fails it with the offending row printed. Verified: - 1010 rows before and after; the three affected rows now read `<register\|predicate>` and no other row changed (6 lines of diff). - markdownlint with the repo's own `.markdownlint.json` drops from 21 violations on this file to 12: the 3 `MD056/table-column-count` and the 6 `MD038/no-space-in-code` they caused are gone. - `cargo run -p cuda-intrinsics-gen -- check` reports outputs current, `probe --all --skip-terminal` probes all 1010 routes, and `check-abi-history` preserves all 1010 base entries. - `intrinsics/catalog.json` is untouched, so the catalog SHA-256 the generated headers stamp is unchanged. - 293 tests pass; fmt and `clippy --all-targets -- -D warnings` clean. The remaining 12 `MD037` violations on this file are a separate defect with a different source: an evidence `detail` string writes `Literal _p64 and _p32` without backticks, so markdown consumes the underscores it is documenting. That prose lives in `intrinsics/evidence/` and editing it would move the catalog hash, so it is left for its own change. Signed-off-by: Vyncint Ng <[email protected]> * docs(intrinsics-gen): tighten the escape_table_cell doc comment --------- Signed-off-by: Vyncint Ng <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…ted (NVIDIA#1068) * fix(docs): an example README names `warp::shfl`, which has never existed `hashmap_v3/README.md` contrasts v3's typed cooperative-groups API against what v2 did: - **Raw `warp::ballot` / `warp::shfl` find kernel.** v3 uses only the typed cooperative-groups API; ... `cuda-device` exports 32 `shuffle*` functions from `warp` and no `shfl` at all. `shfl` is the cooperative-groups *method* name, which is what v3 itself calls (`.shfl(`, twice) -- so the sentence describes the raw path using the typed path's vocabulary. v2's source settles the right name: it calls `warp::shuffle` five times, alongside `warp::ballot` six times and `warp::lane_id` twice. Nothing would have caught it. `check-book-api-names.sh` exists precisely because a name the tree does not have "renders, it builds, and a reader finds out by pasting it" -- but it looked only at `cuda-oxide-book`. Crate and example READMEs carry 122 qualified device names, are the first thing a reader of an example opens, and rot the same way. Extend the guard's file scope to them, minus the vendored `rustlantis` subtree, whose files keep their upstream form and document another project's API. Extending it exposed a second limitation immediately. The family shorthand expander was end-anchored (`^(.*)_\{...\}$`), so `warp::reduce_{sum,max,min}_f32` -- real notation in `warp_reduce/README.md` -- parsed as the family `reduce_{sum,max,min}` with the `_f32` dropped, and the guard reported three functions missing that were never named. The pattern now allows the group anywhere in the name, so `foo_{a,b}_bar` expands to `foo_a_bar` and `foo_b_bar` while `threadIdx_{x,y,z}` keeps working. Verified: - The guard passes on this tree: 42 device-API calls in 465 Rust blocks across the book and 159 READMEs, and 38 qualified prose names, all resolving against cuda-device's 1190 exported functions -- up from 34 calls in 277 blocks and 31 names. - Putting `warp::shfl` back fails it, naming the file. - Planting `warp::ballot_nonexistent` in a README fails it, naming the file. - Before the expander change the guard reported `warp::reduce_sum`, `warp::reduce_max` and `warp::reduce_min` missing; after it, none. - Both new self-tests fire on an empty result: fewer than 20 book pages or fewer than 50 READMEs stops the run rather than reporting a clean tree. Signed-off-by: Vyncint Ng <[email protected]> * fix(docs): finish the book-to-docs rename in the api-names guard --------- Signed-off-by: Vyncint Ng <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…t accepts (NVIDIA#1069) * docs(book): the fuzzing chapter says the adapter rejects five types it accepts `fuzzing-and-differential-testing.md` documents the trace API's type support as nine scalars and then rules out five more: Today the trace supports: bool, i8, i16, i32, i64, u8, u16, u32, u64 It does not yet support `u128`, `i128`, `usize`, `isize`, or `char`. `SCALAR_TRACE_TYPES` in `crates/fuzzer/tools/mir_generator.py` holds sixteen, including all five of those plus `f32` and `f64`, and `supported_trace_type` gates the adapter on exactly that set. Executing the real predicate: u128 True i128 True usize True isize True char True f32 True f64 True [u128; 4] True (u32, char) True *const i8 False &i32 False (i8,i8,i8,i8,i8,i8) False So the paragraph is wrong about every type it names, and understates the rest: support is not set membership but a recursive question, because an array or tuple folds by its leaves up to arity 5 ([NVIDIA#792](NVIDIA#792)) -- and `f32`/`f64` have been in since [NVIDIA#484](NVIDIA#484). `crates/fuzzer/README.md` already states all of this correctly, listing the same sixteen scalars and the folding rule. The book page is the one outlier, so this brings it in line with the README and the code rather than inventing a third description. Two consequences follow: - The sample `UNSUPPORTED [adapter]` line used `u128` as its rejected type, which the adapter now accepts, so the example cannot be produced. It becomes `*const i8`, which the predicate does reject (measured above) and which the fuzzer README already uses as its own example of an adapter refusal. - The widening plan listed "Add trace support for more scalar types (`u128`, `i128`, `usize`, `isize`)" and "Add arrays, tuples, and eventually structs/enums" as future work. The first is done and the second is half done, so the plan now records what landed and keeps structs and enums as what remains. Left alone deliberately: the `RigidTy(Char)` backend classification in the same sample output. `char` behaviour is in flux -- translation maps it to `u32`, and whether `#[device]` extern signatures accept it is an open question ([NVIDIA#875](NVIDIA#875)) -- and I did not reproduce that line end to end, so it is not mine to rewrite here. Verified: the predicate results above come from importing `mir_generator.py` and calling `supported_trace_type`, not from reading it. Book builds clean under `sphinx-build -W`; `check-book-api-names.sh` passes. Signed-off-by: Vyncint Ng <[email protected]> * docs(book): fix the pointer refusal example and plain-language pass on the folding text --------- Signed-off-by: Vyncint Ng <[email protected]> Co-authored-by: nihalpasham <[email protected]>
) The docs gate runs `cargo doc` without `--document-private-items`, so it never renders a private item and never checks the intra-doc links in one. NVIDIA#1014 and NVIDIA#1042 cleaned `cuda-macros`, `mir-importer/statement.rs` and the codegen backend's collector; this is one of the four that were left: error: unresolved link to `classify_op` --> crates/llvm-export/src/export/ops.rs:55 `classify_op` is a `macro_rules!` defined further down the same file, at :138. A `macro_rules!` macro is in scope only textually after its definition unless it is exported, so no path resolves from a doc comment above it -- rustdoc says as much: "`macro_rules` named `classify_op` exists in this crate, but it is not in scope at this link's location". It becomes a plain code span, and since the sentence is one step of a four-step contract about this file, it gains "below" so the reference still points somewhere. Three of the four remain. One is `make_disjoint_slice_struct` in `mir-lower/src/convert/ops/aggregate.rs`, which needs only a `crate::convert::types::` prefix; the other two are `MirFieldAddrOp` and `MirArrayElementAddrOp` in `mir-importer/src/translator/rvalue.rs`. Both files are under open pull requests (NVIDIA#1062 and NVIDIA#1064 for the first, NVIDIA#1059 and NVIDIA#1062 for the second), so they are left rather than raced. `--document-private-items` can join the docs gate once they land. Verified: `RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-items -p llvm-export` reports one unresolved link on `main` and none with this change. The gate's own invocation passes before and after. fmt clean. Comment-only change. Signed-off-by: Vyncint Ng <[email protected]>
…A#1051) A variadic device extern was only refused in device codegen, and only when a kernel actually called it. Two holes: declared AND called late error, no span, no file, no line declared, never called compiles clean -- the collector only registers externs reached from kernel MIR `...` is purely syntactic, so `generate_device_extern_block` can refuse it where the user wrote it, next to the existing spanned ABI check: error: #[device] externs cannot be variadic --> src/main.rs:8:32 | 8 | fn variadic_helper(x: f32, ...) -> f32; | ^^^ The codegen rejection stays as-is. The collector recognises device externs by their reserved name prefix, so a hand-written extern block never passes through this macro and the backend check is the only gate on that path. Fixes NVIDIA#876
* feat: add schedule perturbation campaign * fix(ptx-schedule): wire the repo gates, reject the inert cubin flag, drain pipes, and survive per-seed errors * chore(ptx-schedule): record the new crate in dependency-licenses.csv --------- Co-authored-by: nihalpasham <[email protected]>
…NVIDIA#1064) * fix(mir-lower): support recursive packed AS3 internal ABI Signed-off-by: Raul Estrada <[email protected]> * fix(mir-lower): skip zero-sized fields in packed-AS3 shape predicate The MIR-shape predicate replaced a post-conversion field scan that skipped zero-sized fields before classifying. Restore that parity on the MIR side so a zero-sized non-struct field (e.g. [u8; 0]) does not knock a previously-admitted packed struct out of the ABI lane. * style(examples): rustfmt packed_aggregate_abi --------- Signed-off-by: Raul Estrada <[email protected]> Co-authored-by: nihalpasham <[email protected]>
Signed-off-by: Raul Estrada <[email protected]>
Signed-off-by: Raul Estrada <[email protected]>
…NVIDIA#1059) Signed-off-by: Raul Estrada <[email protected]>
…SA (NVIDIA#1061) Signed-off-by: Raul Estrada <[email protected]>
…#1005) * feat(codegen): forward bounded dynamic result-bundle indexing Signed-off-by: Raul Estrada <[email protected]> * fix(codegen): make bounded result-bundle forwarding reachable Signed-off-by: Raul Estrada <[email protected]> --------- Signed-off-by: Raul Estrada <[email protected]>
…A#1075) Signed-off-by: Raul Estrada <[email protected]>
* fix(mir-lower): support recursive packed AS3 internal ABI Signed-off-by: Raul Estrada <[email protected]> * fix(mir-lower): skip zero-sized fields in packed-AS3 shape predicate The MIR-shape predicate replaced a post-conversion field scan that skipped zero-sized fields before classifying. Restore that parity on the MIR side so a zero-sized non-struct field (e.g. [u8; 0]) does not knock a previously-admitted packed struct out of the ABI lane. * style(examples): rustfmt packed_aggregate_abi * fix(mir-lower): support bounded packed AS3 arrays Signed-off-by: Raul Estrada <[email protected]> --------- Signed-off-by: Raul Estrada <[email protected]> Co-authored-by: nihalpasham <[email protected]>
Signed-off-by: Raul Estrada <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…IDIA#1077) Signed-off-by: Raul Estrada <[email protected]> Co-authored-by: nihalpasham <[email protected]>
Signed-off-by: Raul Estrada <[email protected]> Co-authored-by: nihalpasham <[email protected]>
drbh
force-pushed
the
gemm-sol-phase4b-fix
branch
from
August 20, 2026 22:06
34f00c0 to
7d98253
Compare
* feat(cuda-device): add scalar bf16_to_f32 The scalar inverse of f32_to_bf16 was missing, so call sites open-coded the high-half widen. This is the same bit-shift already used by the packed bf16 unpackers; host unit tests cover 1.0, -0.0, and round-trip through f32_to_bf16. Signed-off-by: Zihua Wu <[email protected]> * test(cuda-device): round-trip every bf16 pattern through the f32 widen bf16_to_f32 places the 16 bits in the f32 high half and f32_to_bf16 truncates them back out, so every u16 pattern (NaNs included) must survive the trip bit-identically. Assert that exhaustively, following the every_non_nan_f16_pattern_round_trips convention. Signed-off-by: nihalpasham <[email protected]> * refactor(examples): use cuda_device::convert::bf16_to_f32 in result checks gemm_sol, gemm_sol_final, and tcgen05_matmul each carried a private copy of the high-half widen for their host-side result checks. The scalar helper now lives in cuda_device::convert, so drop the local copies and import the library one. Signed-off-by: nihalpasham <[email protected]> --------- Signed-off-by: Zihua Wu <[email protected]> Signed-off-by: nihalpasham <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…A#1181) `cargo oxide doctor` reports the CUDA toolkit missing, and exits non-zero, on an install where the toolkit is not on `PATH` -- immediately after reporting four components of that same toolkit as found. ## Before -> after Same machine, same environment, `CUDA_HOME=$HOME/cuda-13.3`, toolkit not on `PATH`: before after CUDA headers (cuda.h)... ✓ .../include/cuda.h (unchanged) CUDA toolkit (nvcc)... ✗ nvcc not found ✓ Cuda compilation tools, release 13.3, V13.3.33 (.../cuda-13.3/bin/nvcc) libNVVM (libnvvm.so)... ✓ libNVVM 2.0 (unchanged) nvJitLink... ✓ nvJitLink 13.3 (unchanged) libdevice... ✓ .../libdevice.10.bc (unchanged) `nvcc` was present at `$CUDA_HOME/bin/nvcc` throughout, in the toolkit those four lines resolved. ## Root cause, across all three tools `doctor` probes three CUDA toolkit executables by two different mechanisms: | tool | doctor | the command that uses it | |---|---|---| | `compute-sanitizer` | `find_cuda_toolkit_executable` | `sanitize`, same helper | | `nvcc` | `Command::new("nvcc")`, PATH only | nothing else invokes it | | `cuda-gdb` | `Command::new("cuda-gdb")`, PATH only | `debug`, via the helper | `find_cuda_toolkit_executable` tries PATH, then the root from `CUDA_TOOLKIT_PATH` / `CUDA_HOME` / `cuda-oxide.toml`, then the standard install roots. The two bare probes see only PATH. So: * `nvcc` is in the required tier, so a working environment sets `ok = false` and `doctor` exits 1; * `cuda-gdb` contradicts `cargo oxide debug`, which resolves it through the helper -- doctor calls absent a tool the command it is predicting would find. The toolkit-root contract is doctor's own stated model; its `cuda.h` failure prints "Set CUDA_TOOLKIT_PATH or CUDA_HOME to a CUDA Toolkit install root". `COMPUTE_SANITIZER_FALLBACK_PATHS` states the rule the other two break, in its own doc comment: "Shared by `sanitize` ... and `doctor` so both use the same discovery order by construction." That helper arrived with the compute-sanitizer probe in NVIDIA#537 and the older probes were never moved onto it. Exactly three toolkit executables are referenced anywhere in `cargo-oxide`, so this is the whole affected path, not the one symptom I noticed first. ## The change All three probes now go through `DOCTOR_TOOLKIT_TOOLS`, one table pairing each tool with its fallbacks, resolved by `doctor_toolkit_tool`. The `cuda-gdb` fallback list becomes `CUDA_GDB_FALLBACK_PATHS`, shared by `doctor` and `codegen_debug`, so the two answer identically by construction rather than by coincidence -- `codegen_debug`'s inline copy is gone. The required/optional tiers are deliberately untouched. Whether `nvcc` should be required at all is a policy question; this is a discovery bug, and mixing the two would make the change harder to judge. ## Behaviour change, deliberate A discovered `nvcc` whose `--version` fails now reports `✓ <path>` instead of failing doctor. Previously a broken `nvcc` on PATH fell to the catch-all arm and printed `✗ nvcc not found`, which was also wrong -- it was found. The new arm mirrors the `compute-sanitizer` probe, which has always reported the path when the version banner cannot be read. Recording it because it is a real change in verdict for one input, not only a discovery fix. ## Tests * **Table pairing** -- every entry pairs a tool with its own fallback list. Pure, so it covers all three tools on every host; pairing `nvcc` with `CUDA_GDB_FALLBACK_PATHS` is a one-token slip no filesystem test could see. * **Lookup** -- each tool gets its own list and an unknown name gets none rather than another tool's. * **Call sites** -- every `doctor_toolkit_tool` call names a tool the table knows, since an unknown name silently loses its standard install roots. * **Source invariant** -- no CUDA toolkit executable may be probed with a bare `Command::new`. Read out of the source rather than from the table, so a tool left out of the table is still caught. * **Single list** -- `doctor` and `debug` reference one `cuda-gdb` fallback list; a second inline copy fails. Every test here is hermetic: pure or source-based, no filesystem and no environment. That is deliberate. `find_cuda_toolkit_executable` probes PATH first through `which`, and that probe has no injection point, so a test using real tool names asserts a temp root while resolving whatever the host has installed. An earlier version of this commit did exactly that and passed only because this machine has no `nvcc` on PATH -- the very configuration the fix is about. Toolkit-root resolution itself stays covered by the existing `sanitizer_tool_lookup_uses_project_cuda_toolkit_root`, which fabricates a name for the same reason. Each test confirmed to bite by breaking what it guards: mispairing the table, probing a tool absent from it, making the lookup return one list for every tool, and re-adding an inline `cuda-gdb` list each fail their own test. Reverting a probe to `Command::new` does not compile; restored to its original form so it does, it fails the source invariant and the CLI returns to `✗ nvcc not found`. Suite runs clean in all three host shapes: toolkit on PATH, toolkit on PATH with `CUDA_HOME` elsewhere, and no toolkit on PATH at all. Verified: 185 tests pass, fmt clean, `clippy --all-targets -- -D warnings` clean, `RUSTDOCFLAGS="-D warnings" cargo doc` clean, and all guard scripts pass. Manual `doctor` runs agree in both configurations -- toolkit on PATH and not -- resolving the same `nvcc`. Exit status on this machine is still 1, for a genuinely absent `clang`: the fix does not paper over a real failure. Closes NVIDIA#1180. Signed-off-by: Vyncint Ng <[email protected]>
…NVIDIA#1172) * docs(examples): correct stale tma_multicast consumer Blackwell claims Signed-off-by: Raul Estrada <[email protected]> * docs(examples): word tma_multicast support notes as user documentation Rewrite the change-narration passages from the previous commit as direct support statements, embed a real RTX 5090 (sm_120) transcript captured with 'cargo oxide run tma_multicast', align the Hopper wording with the module doc (the shipped sm_100a PTX will not JIT on sm_90), and point the open sm_90-build question at NVIDIA#966. Also sync both expected-output transcripts with the current embedded-module load message. Signed-off-by: nihalpasham <[email protected]> --------- Signed-off-by: Raul Estrada <[email protected]> Signed-off-by: nihalpasham <[email protected]> Co-authored-by: nihalpasham <[email protected]>
* fix(rustlantis): invalidate nested references on uninit Signed-off-by: Raul Estrada <[email protected]> * test(rustlantis): cover array, enum, and move paths for nested pointer invalidation The PR's tuple test passes even if the Deref-edge removal is folded into the RunPointer-bounded update walk, because tuples get no RunPointer of their own. An array of pointers is the distinguishing case: the array node owns the RunPointer and the memory-bounded walk stops there, so only the structural subfield walk reaches the pointer elements. Add three tests next to the existing one: - an [*const i32; 2] place whose elements must lose their outgoing Deref edges on uninit while an external incoming reference to the array survives; - an enum whose active variant holds a pointer field, which must lose its Deref edge when the enum place is marked uninit; - a mark_place_moved integration case proving a move of a tuple with a nested pointer invalidates the nested Deref edge end to end. Signed-off-by: nihalpasham <[email protected]> --------- Signed-off-by: Raul Estrada <[email protected]> Signed-off-by: nihalpasham <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…DIA#1157) * refactor(fuzzer): clarify ProjectionIter traversal invariant Signed-off-by: Raul Estrada <[email protected]> * test(fuzzer): exercise the ProjectionIter Deref debug_assert Inject a Deref edge into a place node's subfield_edges (violating the invariant documented on ProjectionIter) and drive the iterator across it, checking that the debug_assert at the consumption point fires with its message. Verified the test stops panicking when the assert is neutered, so it exercises the guard itself. Signed-off-by: nihalpasham <[email protected]> --------- Signed-off-by: Raul Estrada <[email protected]> Signed-off-by: nihalpasham <[email protected]> Co-authored-by: nihalpasham <[email protected]>
* feat(intrinsics): probe every declared target Signed-off-by: Sam, Joochul Chang <[email protected]> * ci: probe every intrinsic target Signed-off-by: Sam, Joochul Chang <[email protected]> * fix(intrinsics-gen): sm_90a records a PTX 7.8 floor that LLVM rejects `target_minimum_ptx_isa` drops the architecture suffix for capability 90, so `sm_90a` inherits `sm_90`'s PTX 7.8 floor. The pinned backend disagrees: `llc -mcpu=sm_90a -mattr=+ptx78` aborts with "Minimum required PTX version is 8.0", and the default configuration emits `.version 8.0`. No incorrect lowering follows from the wrong value today. It is used only as the threshold below which an explicit `+ptxNN` is redundant, so understating it can only widen the range that emits a feature. `PtxIsaRequirement` has no spelling between 7.8 and 8.0, leaving that widened range empty. The recorded floor is still wrong, and the next target whose suffix shifts the floor further would not be masked. Measuring all 28 targets the table records against the pinned backend found this as the only disagreement. That measurement is now a test: each target is lowered with no `-mattr` and its emitted `.version` is compared against the recorded floor, so the copy cannot drift from the backend it describes. The suffix-sensitive cases already carried assertions for sm_100a, sm_100f, sm_120a, sm_120f, and sm_121a. sm_90a was the one omission, which is why the disagreement survived. Signed-off-by: Sam, Joochul Chang <[email protected]> * test(codegen): derive the recorded PTX floors from the backend The floor table in this crate and the one in `cuda-intrinsics-gen` describe the same backend behaviour, and nothing prevented them from drifting apart. The probe copy is now derived from the pinned backend; this gives the production copy the same guard, so a wrong entry fails here rather than reaching a user. The two copies stay separate. Sharing them means a new dependency-free crate, which pulls in workspace, licence, and CI-matrix changes this branch should not carry. Derivation removes the failure mode that duplication actually causes. The check runs only against an LLVM 22 backend. LLVM 21 refuses several of these targets outright, so its defaults cannot stand in for the table. Signed-off-by: Sam, Joochul Chang <[email protected]> * feat(target-spec): centralize CUDA target PTX policy Keep target grammar and LLVM 22-derived PTX floors in one dependency-free crate so production codegen and probe orchestration cannot drift. libnvvm-sys preserves its public re-export, while backend-version support remains consumer-owned. Signed-off-by: Sam, Joochul Chang <[email protected]> * fix(codegen): fail closed on unknown PTX floors Resolve explicit PTX requirements through the shared target policy so unlisted and formerly wildcard-only targets cannot silently inherit llc defaults. Preserve LLVM-major gating and requirement merging while sharing the discrete PTX spelling round-up. Signed-off-by: Sam, Joochul Chang <[email protected]> * fix(intrinsics-gen): share target PTX derivation Parse derived targets and resolve their LLVM 22 floors through cuda-target-spec so the probe has no fallback policy of its own. Round instruction floors to production llc spellings while preserving LLVM-selection-only derived checks and terminal validation for selected evidence. Signed-off-by: Sam, Joochul Chang <[email protected]> * chore(target-spec): refresh workspace metadata Record the shared leaf in rustc-codegen-cuda's separate lockfile and the repository license inventory so locked verification and policy gates remain reproducible. Signed-off-by: Sam, Joochul Chang <[email protected]> * fix(codegen): validate targets through shared PTX policy Make every PTX requirement, including Default, prove that its target has a recorded floor before codegen proceeds. Reuse the shared key set for known-target admission while preserving the explicit candidate preference order, and test both set parity and complete feature rendering. Signed-off-by: Sam, Joochul Chang <[email protected]> * docs(target-spec): restore shared policy contracts Restore the CUDA architecture rationale that was lost when parsing moved into the leaf crate, and document exact LLVM 22 floor and spelling semantics at the authority boundary. Require both backend rejection tests to prove the expected minimum-version diagnostic. Signed-off-by: Sam, Joochul Chang <[email protected]> * refactor(intrinsics-gen): derive reviewed target floors Keep the explicit f8f6f4 and Blackwell ldmatrix admission sets while deriving their effective PTX values from the shared LLVM 22 floor authority. Parse evidence targets through CudaArch first, then retain the existing canonical spelling and width restrictions. Signed-off-by: Sam, Joochul Chang <[email protected]> * refactor(codegen): derive LLVM 22 target gate Express the LLVM 21 backend limitation through the shared PTX 9.0 floor fact instead of a private capability list. Preserve this validator as a backend-support check only: malformed, unknown, and non-sm targets continue to be handled elsewhere. Signed-off-by: Sam, Joochul Chang <[email protected]> * feat(target-spec): expose construction and feature arrows Let consumers move directly from validated capability parts to CudaArch and from shared PTX spellings to llc features. These inverse mappings belong beside the leaf invariants and vocabulary, eliminating representation round trips while preserving the accepted grammar and emitted strings. Signed-off-by: Sam, Joochul Chang <[email protected]> * refactor(target-policy): route consumers through leaf arrows Use the target-spec construction and PTX feature mapping APIs at policy boundaries. This removes format-and-reparse and duplicated feature rendering while preserving admitted targets, floors, and emitted strings. Signed-off-by: Sam, Joochul Chang <[email protected]> * chore(examples): record cuda-target-spec in post-merge example lockfiles The merge from main brought in two new examples (ptr_without_provenance, shared_debug) whose lockfiles predate libnvvm-sys's cuda-target-spec dependency. Re-resolve them the same way the branch refreshed the other 217 example lockfiles. Signed-off-by: nihalpasham <[email protected]> --------- Signed-off-by: Sam, Joochul Chang <[email protected]> Signed-off-by: nihalpasham <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…renderer (NVIDIA#1153) * test(intrinsics-gen): safety docs must match the record they document Two invariants over the rendered raw-ABI # Safety blocks: - a safety block that names `addr` must belong to a record that takes a pointer argument - no two families may render the identical safety block Both fail on main: the # Safety dispatch in render_raw_abi silently falls back to the packed-atomic contract for families without a dedicated arm, so the six clc_* intrinsics document a four-byte global atomic they do not perform, and four of them take no pointer at all. unsafe safety docs reference `addr` without a pointer argument: clc_query_get_first_ctaid_x, clc_query_get_first_ctaid_y, clc_query_get_first_ctaid_z, clc_query_is_canceled unsafe safety blocks shared across families: [{"clc", "packed_atomic"}] Signed-off-by: Joochul Chang <[email protected]> * fix(intrinsics-gen): fail closed when an unsafe family has no safety renderer The unsafe-record guard in validate_renderable only checked that a family name appeared in a hand-maintained allowlist, while the # Safety dispatch in render_raw_abi silently fell back to the packed-atomic contract for any family without a dedicated arm. Adding an allowlist line was enough to pass the guard, which is how the clc family shipped six intrinsics carrying a four-byte global-atomic contract they do not perform. Give packed_atomic an explicit arm and make the terminal else a generation error naming the record and family, so a family missing from the dispatch can no longer inherit another family's contract. Delete the allowlist: the per-family shape checks it duplicated remain, and the dispatch itself is now the single source of truth. Add a dedicated clc arm. Its contracts are shared with render_compat_clc through clc_safety_lines, so the raw and compatibility renderers cannot drift, and they now state the obligations the repository already documents: the 16-byte shared::cta response and its expect-tx arming, the prohibition on retrying after an observed failed cancellation, and that the query results are meaningful only after a successful cancellation. Signed-off-by: Joochul Chang <[email protected]> --------- Signed-off-by: Joochul Chang <[email protected]>
…A#1093) Signed-off-by: Raul Estrada <[email protected]>
…1143) Signed-off-by: Raul Estrada <[email protected]>
…IA#1190) * refactor(dialect-mir): split tests/ops_test.rs into ops_test/ modules * refactor(dialect-nvvm): split tests/ops_test.rs into ops_test/ modules * refactor(llvm-export): split tests/export_test.rs into export_test/ modules * refactor(mir-lower): split tests/lowering_test.rs into lowering_test/ modules * refactor(mir-lower): split convert/types.rs into convert/types/ modules * refactor(mir-lower): split ops/aggregate.rs into ops/aggregate/ modules * refactor(mir-lower): split ops/memory.rs into ops/memory/ modules * refactor(intrinsics-gen): split model.rs into model/ modules * refactor(intrinsics-gen): split render.rs into render/ modules * refactor(intrinsics-gen): split resolve.rs into resolve/ modules * refactor(cargo-oxide): split commands.rs into commands/ modules * refactor(cuda-macros): split lib.rs into per-macro modules * refactor(codegen): split target.rs into target/ modules * refactor(mir-importer): split translator/rvalue.rs into rvalue/ modules * refactor(mir-importer): extract Aggregate arm body into rvalue/aggregate.rs * feat(intrinsics-gen): emit generated importer/lowering/targets outputs as per-family modules * chore: ignore .codex-work/ * docs,ci: point path references at the split module directories
…s to ~2s) (NVIDIA#1198) * fix(examples): scope disjoint_slice_len's -Zinline-mir=no to its own crate smoketest routed the flag through global RUSTFLAGS, which re-keys every unit in the shared CARGO_TARGET_DIR: the one example rebuilt a full second dependency tree (~163 crates, ~192s of CPU, 165s wall on the CI runner) and also relinked the backend dylib in place, taxing the next example in line with the flip-back. The issue NVIDIA#343 guard only needs the flag on the example's own crate: MIR inlining rewrites the caller, and the kernel caller lives in the leaf. Carry it there via cargo's profile-rustflags feature; the generated .ll keeps the un-inlined DisjointSlice::len pattern verbatim (verified by diff against a wrapper build that flagged only the leaf), and the example's smoketest slot drops from 165s to ~1s. The NOINLINE_MIR / EXTRA_RUSTFLAGS machinery in smoketest.sh is deleted, replaced by a policy note; per-example rustc flags belong in the example's manifest. * fix(cargo-oxide): keep ambient rustc flags out of the backend build The backend dylib's sha256 becomes the global backend-identity cfg for every application unit, so ambient flags that change the backend's bits fork a parallel cache universe for the entire application dependency tree, and because the freshness build has a single cache slot, alternating flag sets relink the dylib on every transition (smoketest's per-example RUSTFLAGS lane hit both failure modes). Pin CARGO_ENCODED_RUSTFLAGS to the empty string for the backend build: the empty-but-set value is cargo's highest-precedence flag source and resolves to zero flags, which also silences CARGO_TARGET_<TRIPLE>_ RUSTFLAGS and config-file [build]/[target.*] rustflags, sources that env_remove cannot reach. Print a one-line note when ambient flags are present so the asymmetry with application builds (which keep honoring them) is visible, and point at the CUDA_OXIDE_BACKEND escape hatch for custom backend builds. * fix(examples): sync example lockfiles, gate drift in CI, dedupe kernel-lib Each example workspace committed its own Cargo.lock at a different point in time, drifting into 34 distinct dependency resolutions across 219 examples (syn x6 versions, zerocopy x7, memchr x4, ...). Cargo keys its cache on the resolved dependency subtree, so under CI's shared CARGO_TARGET_DIR the first example in run order with each resolution recompiled a private variant of the whole shared chain, bindgen re-run over cuda.h included. That is 19 of the 25 examples that ran 15-68s against a 2s median. Re-resolve all 221 locks in one sweep (34 resolutions collapse to 8; the 8 survivors are genuinely different trees like tokio/rayon/cutile that still share the common chain) and add scripts/sync-example-locks.sh: --check CI gate, runs before any toolkit install: one version per crate per semver range across all locks (source-aware, so a git-rev drift is also a conflict), and unique local-crate (name, version) across workspaces --bump cargo update sweep over every lock (skips git-pinned locks) --align precise-pin drifted locks to the majority; never touches git pins The uniqueness rule exists because the sync exposed a latent linkage bug: cross_crate_embedded and cross_crate_kernel each nested a different crate named kernel-lib v0.1.0, and cargo does not key workspace-member cache slots on the manifest path. Once the lock sync made their closures identical, both aliased one slot and cross_crate_kernel linked the other example's library (E0425 on the macro-generated items). The embedded example's crate is now embedded-kernel-lib, and the gate rejects the pattern. * perf(smoketest): resolve the backend once per run smoketest already builds the backend once up front, but every example invocation still re-ran cargo-oxide's backend freshness check (a cargo build in the backend workspace, ~1s each on CI runners, ~4 minutes across 219 examples). Export CUDA_OXIDE_BACKEND after the one-time setup so discovery short-circuits before any cargo call; this also means one run tests exactly one backend even if its sources change mid-run. An externally-set CUDA_OXIDE_BACKEND is honored as-is, and a missing path falls back to per-invocation discovery. * fix(scripts): add the SPDX header to sync-example-locks.sh The cargo-deny SPDX gate rejects source files without it. Also make usage() print the doc block by scanning to the first non-comment line instead of a hardcoded sed range, which the header insertion had just invalidated for the second time.
) Bump the pliron git pin 8447aa42 -> 823d9d8 in both manifests (workspace and rustc-codegen-cuda, which must stay on the same rev) and refresh both lockfiles. Upstream pliron-llvm now models the synchronization scope of atomic ops as a dedicated SyncScopeAttr (System / SingleThread / NamedScope) exposed through a SyncScopeInterface, replacing the per-op optional StringAttr (llvm_{rmw,cas,ld,st,fence}_syncscope) and the Option<String> constructor parameters. That covers everything cuda-oxide's local LlvmSyncScope enum existed for, so the local shim is deleted and all users migrate to the upstream attribute: - llvm-export: drop the LlvmSyncScope enum; the textual exporter reads scopes via SyncScopeInterface::syncscope and formats them with SyncScopeAttr::to_name (system scope stays unnamed). - mir-lower: map NVVM scopes straight to SyncScopeAttr when building atomicrmw/cmpxchg; fence emission keys off the NVVM scope directly. - nvvm-transforms: legacy legalization matches on SyncScopeAttr instead of Option<&str>; tests construct scopes through the attribute. The upstream rename of llvm.insert_element/extract_element (op names only, Rust types unchanged) and the other four commits in the range (given_names rename, decontextualization utils, ScalarOrVector interfaces, From<fmt::Error>) required no cuda-oxide changes. Validated: cargo test --workspace (5287 passed, 0 failed), clippy clean on touched crates, smoketest --compile-only 219/219, vecadd and scoped_atomic_load_store executed on GPU; syncscope("device"/"block") emission in generated .ll is unchanged.
…1201) * chore: bump pinned nightly to 2026-08-28; port mir-importer + rustc-codegen-cuda Move the pinned toolchain from nightly-2026-04-03 to nightly-2026-08-28 (rustc 1.100.0-nightly e457a7b0d, bundled LLVM 23.1.0). The pin is updated in all seven documented copies (both rust-toolchain.toml files, the `cargo oxide new` scaffold const, the devcontainer, README/book install one-liners); scripts/check-toolchain-parity.sh passes. Mechanical port (rustc_private / rustc_public churn): - `rustc_middle::mir::mono` -> `rustc_middle::mono` (CodegenUnit, MonoItem) - `InstanceKind::DropGlue(..)` -> `InstanceKind::Shim(ShimKind::DropGlue(..))`; `Instance::resolve_drop_in_place` -> `Instance::resolve_drop_glue` - `EarlyBinder::bind` now takes `tcx` - `TyKind::FnDef` args sit behind a `Binder`; both collector sites use `no_bound_vars().expect(..)`, matching rustc_monomorphize's own discipline (late-bound vars are instantiated before FnDef types reach built MIR) - `join_codegen` gained `incr_comp_session`/`crate_info` params and returns `WorkProductMap`; `codegen_crate` lost `crate_info`; `CompiledModule` gained `global_asm_object` - `fn_sig.abi`/`c_variadic` are methods; `type_of(..).instantiate_identity()` returns `Unnormalized<Ty>`, resolved via `normalize_erasing_regions` following `TyCtxt::static_ptr_ty`'s discipline - rustc_public: `Statement.span` -> `.source_info.span`; `ty_with_args` moved to the `CrateDefType` trait; `StatementKind::Retag` removed (retags are now the `WithRetag` flag on `Rvalue::Use`, still a device no-op); `CastKind::BoxDerefTransmute` maps to the Transmute cast kind, exactly as rustc_codegen_ssa treats it Behavioral ports (compiler gaps the new nightly exposed; each verified by the full on-GPU smoketest): - drop shims are now built from `core::ptr::drop_glue` (`&mut T` parameter, with `drop_in_place` an ordinary forwarding fn): accept the `&mut` parameter in emit_drop_glue and elide provably-no-op `drop_glue::<T>` calls with the same shared predicate as `drop_in_place` - collect `ShimKind::FnPtrAsPtr` shim bodies (they back `FnPtr::addr`, have no HIR body, but instance_mir synthesises one) - translate `RigidTy::Foreign` (extern types, e.g. `core::ops::Code`) as an opaque empty struct pointee, like FnPtrTarget - intercept `std::sys::cmath::{asinh,acosh,atanh}{,f}` (pure-Rust formulas before this nightly) and lower to `__nv_asinh(f)`/... libdevice calls - core atomic load/store gained a `const VOLATILE: bool` generic: parse it (bool-typed const) separately from orderings and fail closed on `VOLATILE = true` - re-pack `llvm.*.with.overflow` results into the type converter's padded `(T, bool)` tuple form; the new RangeInclusive iterator MIR forwards the checked-op tuple through a block argument where the two forms met - atomics example: pass the new `VOLATILE` argument at its raw-intrinsic call sites Also fixes the new-toolchain lint fallout so `clippy -D warnings` stays green (chunks_exact->as_chunks, ?-operator, useless format!, and an `allow(suspicious_runtime_symbol_definitions)` for bindgen's c_ulong malloc/realloc declarations in cuda-bindings). * feat(codegen): lower Rvalue::Reborrow; add reborrow regression example nightly-2026-08-28 introduces `Rvalue::Reborrow(Ty, Mutability, Place)` (rust-lang/rust#159103, `feature(reborrow)`): reborrowing a user ADT that implements the `Reborrow`/`CoerceShared` marker traits. Semantically it is a bitwise copy of the place: same type for `Mut`, the same-layout `CoerceShared` target ADT for `Not`. rustc_codegen_ssa lowers it as `codegen_operand(Operand::Copy(place))`; the importer mirrors that with a place read, plus the existing same-layout Transmute cast path when the translated dialect types diverge. The release MIR pipeline folds these into plain copies before the importer sees them, so the new `reborrow` example runs with `--device-debug` (-Zmir-opt-level=0) in the smoketest, where the rvalue reaches the translator intact (verified by stubbing the arm: the stub fails the example under --device-debug and not under release). * test: re-bless trybuild goldens for nightly-2026-08-28 diagnostics Rendering-only drift: rustc 1.100 trims more type paths in E0277/E0308 notes ("cuda_device::__LaunchContractDisjointSlice" now prints through its module path, `LaunchContext<...>` args elide as `_` instead of `...`, and suggestion placeholders print trimmed types). Re-blessed with TRYBUILD=overwrite and eyeballed: no test changes semantics, every case still fails to compile for the same reason as before. * fix(cargo-oxide): fingerprint the toolchain that built the backend write_toolchain_fingerprint ran `rustc -vV` in the USER's cwd, but the backend builds with `current_dir = <backend source clone>`, whose nested rust-toolchain.toml can pin a different nightly. A bare cargo-oxide invocation could therefore record a fingerprint that never matches the `.so`: the StaleVsToolchain guard compares the user-cwd toolchain against the recorded user-cwd toolchain, matches forever, and every application build loops on "couldn't load codegen backend" with no self-heal. Resolve the recorded fingerprint from the build directory (same cwd and inherited env as the build command, so rustup's proxy resolves the same rust-toolchain.toml). The mismatch CHECK still resolves from the user's cwd, which is the toolchain that will load the `.so`. Tests: command-construction test asserting the fingerprint command's cwd is the build dir, and a behavioral test proving a build-dir pin (an uninstallable channel) defeats fingerprinting even though the process cwd resolves fine. * chore(intrinsics): refresh recorded LLVM identity to 23.1.0 / 16696adc The new nightly bundles LLVM 23.1.0 built from rust-lang/llvm-project 16696adcd119e6ba9cc175207d984d7021211acb. Refresh every recorded identity: - intrinsics/upstream.lock: new LLVM revision, an llvm-tblgen built from that revision (sha256 199fe46b...), new dump hashes. Ubuntu llvm-tblgen-22 byte-for-byte reproduced the Intrinsics.td dump; the NVPTX.td dump uses LLVM-23-only TableGen operators (!sort) that pre-23 binaries reject, recorded as such in the comparison-tools provenance. - intrinsics/imported.json: re-extracted (2569 -> 2633 NVVM declarations; the LLVM 22-era unscoped atomics are gone, fp16 sat-arith / e2m1 / e2m3 conversions arrived). - 58 rust-llvm evidence files renamed to rust-llvm-23.1.0-16696adc* with llvm_revision / backend_version ("LLVM version 23.1.0-rust-1.100.0-nightly") / backend_sha256 (2e5bc688..., the rustup llvm-tools llc) headers updated; overlay profile references moved with them. - LLVM 23 upstream drift absorbed in the resolver's recorded facts: IntrNoCreateUndefOrPoison joined most pure math intrinsic property sets (not ex2/lg2), many declarations moved from NVVMPureIntrinsic to the new target-generic PureIntrinsic class, tcgen05 ld/st data types became overloaded per-register-count type variables (anonymous_9933..9961, previously concrete vNi32; evidence signature records updated in both backends' files), the tcgen05 MMA TableGen selection strings moved `.ashift` before the collector qualifier (declaration-side spelling split from the ptxas-validated emission spelling), tensormap.replace dim/stride declarations gained Range<arg1,0,5>, and the fabs/ex2 overload type variable renumbered anonymous_14 -> anonymous_8. - `generate` refreshed catalog.json (1016 intrinsics, unchanged set), generated-reference.md, probes/*.ll, and the 9 managed generated roots (identity banners only); the book stamp moved 90f843cc -> c8007834. - cuda-target-spec: the LLVM-derived test gate moves 22 -> 23 (it self-skips on any other major); all 28 recorded PTX floors and 11 ISA spellings verified against llc-23, no table changes. - llc/opt/llvm-link PATH fallbacks probe the -23 names first; docs and the atomics README follow (llc-23 honors atomicrmw orderings + scopes, PR llvm/llvm-project#176015, verified: `atomicrmw ... syncscope("block") acq_rel` -> `atom.acq_rel.cta.global.add.u32`; fence-splitting stays while LLVM 21/22 remain supported). Gates: `cuda-intrinsics-gen check` clean, `probe --all --skip-terminal --per-target` passes 2365 target configurations across all 1016 generated routes against the pinned llc-23, `check-abi-history` appends nothing (the ABI ledger records no llc identity). * fix: address nightly-bump review findings (reborrow CoerceShared coverage, fingerprint heal guard, evidence re-attestation) Four verified review fixes on top of the nightly-2026-08-28 bump: - reborrow example: cover the Rvalue::Reborrow transmute half. The arm's Mutability::Not (CoerceShared) path had zero coverage; the example now coerces its MutView into a shared View at two read() call sites and writes the sum back (0 -> 2.0 -> 4.0). Proven by stubbing the transmute branch: the stub fails the example in BOTH release and --device-debug device builds. The write-back happens outside v's scope because CoerceShared's coherence rules force the same lifetime argument on source and target, so a write through v after read(v) is E0506. - comment truthfulness (smoketest + example header): GVN folds only the Mutability::Mut reborrow variant at mir-opt-level>0; the CoerceShared variant survives release MIR and reaches the importer there too. The smoketest now runs reborrow in both its release and --device-debug invocations. - cargo-oxide: one-attempt toolchain heal guard. When the user's project pin and the backend source's nested pin genuinely differ, the StaleVsToolchain arm re-cloned and cold-rebuilt on every invocation forever. A heal attempt now records the (active, recorded) fingerprint pair in toolchain-heal-attempt.txt; a repeated identical pair prints both toolchain identities plus alignment guidance and exits instead of rebuilding. A passing fingerprint check deletes the marker. First-time mismatches still self-heal via re-clone. - intrinsics evidence: four families (tcgen05-mma, cluster-sreg, tcgen05-control, tcgen05-ldst-offset) carried llc stage records still naming LLVM 22.1.2 / ff1dcdc1 while their headers claim llc-23. Re-attested all 73 catalog intrinsics of those families against the pinned llc-23 (probe green) and updated the stage tool_version / tool_sha256 to 23.1.0-rust-1.100.0 / 2e5bc688; regenerated the catalog-stamp banners. Also fixed the asinh/acosh/atanh comments: only asinh/acosh became std::sys::cmath shims on rustc e457a7b0d; atanh stays pure-Rust ln_1p, its entries are defensive. * feat(host-apis): diagnose host/device TypeId naming divergence on generic kernel misses Generic kernels are looked up by "<base>_TID_<hex32>", where the backend computes the hash with tcx.type_id_hash and the host extracts the same value from core::any::TypeId (cuda-host/src/type_id.rs). The values cannot drift while TypeId's runtime layout is the raw hash, but that layout is a std internal: if a future nightly changes it, the transmute still compiles and every generic launch fails with an opaque DriverError(500, "named symbol not found"). Make that failure self-explaining, at zero happy-path cost: - cuda-host entry_registry (new): load_all_ptx_bundles_merged retains the merged module's .entry names (parsed with ptx-parse). Retention is Weak-keyed by module allocation identity, prunes dropped modules on each registration, and costs a few dozen bytes per kernel. Best-effort by design: a parse failure retains nothing and never fails a load the driver accepted. - On a failed _TID_ load_function, the macro-generated launch paths now consult the diagnosis. If the module holds the same base kernel under a different 32-hex hash, it panics with both entry names, the cause (host core::intrinsics::type_id vs device tcx.type_id_hash disagreed, so the TypeId-to-u128 extraction in cuda_host::type_id is no longer value-correct on this toolchain), and the remedy (build host and device with the same pinned nightly; re-verify the type_id.rs contract and the backend's compute_kernel_export_name together). An ordinary miss keeps today's error and panic text unchanged. - Wired sites: the #[cuda_module] generic function binding routes through diagnose_generic_kernel_load_error (returns the DriverError untouched for plain misses), and the cuda_launch! / cuda_launch_async! generic and closure branches route through panic_generic_kernel_load_failed. Non-generic lookups are untouched and stay duck-typed over the module expression. - The load-time canary kernel (layer 2 of the decision memo) is deliberately not implemented; the entry_registry module rustdoc records why so future readers see it was considered. Tests: cuda-host unit tests drive the real ptx-parse -> match -> message path (divergence fires with both names; different-base miss, non-_TID_ name, .func-only same-base entries, and malformed hash suffixes all keep the ordinary path; registry identity and pruning). cuda-macros expansion tests assert the generic and closure paths call the helpers and the non-generic paths do not. * chore(intrinsics): re-attest scalar-math appended fixture under the pinned llc-23 The scalar_math_inline_sm80_ptx70_appended fixture in rust-llvm-23.1.0-16696adc-scalar-math.json still carried the llc-22 identity (LLVM 22.1.2-rust-1.96.0 / ff1dcdc1) in its backend_codegen detail, plus an llc-22-vs-21 behavioral claim that had not been checked since. Re-attested instead of reworded: - Re-ran the evidence probes for all 40 scalar_math catalog intrinsics against the pinned sysroot llc-23 (LLVM 23.1.0-rust-1.100.0-nightly, SHA-256 2e5bc688...), terminal ptxas (CUDA 13.3 V13.3.33) revalidation included: 40/40 green. - The three appended per-op PTX SHA-256s (ex2_approx_f32, ex2_approx_ftz_f32, tanh_approx_f32) are byte-identical under llc-23 because inline-PTX probe bodies pass through llc verbatim; the detail now states that and keeps the original llc-22 identity as the historical reference. - The typed llvm.nvvm.tanh.approx.f32 route was re-checked with current binaries: pinned llc-23 and Ubuntu LLVM 22.1.7 select it via NVVMIntrinsic-class matching, while Ubuntu LLVM 21.1.8 still lowers it to an extern funcall, so the inline route remains required while llc-21 remains a supported fallback (doctor probes llc-23/22/21). - Added the structured llc tool identity fields to the stage, matching the convention of the four families re-attested in 0aec1b7. - `generate` refreshed catalog.json, generated-reference.md, probes/*.ll, and the generated-root banners (catalog SHA-256 478f564b -> 49bcd626); `check` reports outputs current. * fix: clippy-clean examples under nightly-2026-08-28; re-stamp book catalog page The bumped nightly's clippy trips two examples out of 222 lint targets: - field_array_assign: needless_range_loop on the runtime-index loop. The indexed loop is the (Field, Index) MIR projection under test (issue NVIDIA#235), so keep it and allow the lint on the loop with a reason comment. - function_item_call: stable_features on #![feature(never_type)], which stabilized in 1.100.0-nightly. Drop the dead gate; the never-type usage under test is unchanged. Also carries the cuda-oxide-book catalog-stamp refresh (c8007834 -> 49bcd626) matching the regenerated dialect-nvvm ops/generated headers.
…es (invalid PTX under LLVM 23) (NVIDIA#1203) * fix(codegen): stop SimplifyCFG from building .global lookup tables of .shared addresses LLVM 23 bumped NVPTX's default subtarget from sm_30 to sm_75 (llvm/llvm-project@9fc5fd0ad689, PR #176021). Our `opt` invocation passes no -mcpu, so the default subtarget now has brx.idx (SmVersion >= 30 && PTXVersion >= 60), which legalizes ISD::BR_JT, which flips TTI::shouldBuildLookupTables() to true, and SimplifyCFG's switch-to-lookup-table starts firing on the multi-stage pipeline pattern (a `match stage & 3` over per-stage shared buffers, as in gemm_sol / gemm_sol_final). The result is unassemblable PTX: .global .align 8 .u64 switch_$_table_$_k[4] = {__shared_mem_0, ...}; ptxas rejects .shared symbols in .global/.const initializers in both the bare and the generic() forms ("Variable used as initial value not in .global or .const state space"), and driver JIT fails module load with CUDA_ERROR_INVALID_PTX (218) on sm_100. llc emits the initializers silently (exit 0), so nothing failed until runtime on gated hardware. Isolation matrix on byte-identical pre-opt .ll (gemm_sol_final): opt-22 default builds 0 tables, opt-23 builds 8 (4 of them [4 x ptr addrspace(3)]); llc 22 and 23 both print the bad initializers; ptxas 13.3 rejects every opt-23 combo and accepts every opt-22 combo. The bug is latent on older majors too: LLVM 22 opt with an explicit modern -mcpu (sm_70+) builds the same tables. Two layers: - pass `-switch-to-lookup=false` on every opt invocation (both the plain -O2 and the internalize,default<O2> argument sets). Upstream's validLookupTableConstant accepts any GlobalValue with no address-space check, so this SimplifyCFG override is the supported control; it exists identically on LLVM 21-23 and stays even after upstream learns to reject shared-space table constants, because our LLVM floor spans the broken majors. Upstream precedent: NVPTX already disables relative lookup tables wholesale (llvm/llvm-project#159748). Switches keep their branch form; llc lowers dense ones to brx.idx code-label branch tables, avoiding a dependent .global data load on the hot path. - post-llc scan: fail the build if any produced .global/.const initializer references a .shared symbol, turning any future variant of this class into a loud compile error instead of a runtime 218, regardless of which pass produced it. Regression test: a 4-way stage switch over shared/generic buffer-pointer phis must not become a data table, and no initializer may reference a .shared symbol (fails without the flag on the pinned toolchain; the post-llc scan then rejects the module with the offending line). * fix(examples): never classify CUDA_ERROR_INVALID_PTX as "wrong GPU" in tcgen05 hosts gemm_sol, tcgen05, and tcgen05_matmul treated any module-load failure with CUDA_ERROR_INVALID_PTX (218) as "right PTX, wrong GPU" and degraded to the PTX-only verification path with exit 0. The driver uses 218 both for arch-incompatible PTX and for genuinely malformed PTX, so on an sm_100 machine invalid PTX (the switch-lookup-table miscompile) produced a false smoketest PASS ("PTX was generated successfully") while gemm_sol_final, which gates on GPU capability before loading, failed loudly. Adopt gemm_sol_final's model in all three: gate execution on can_execute_tcgen05_ptx(major, minor) BEFORE loading the module; on a capable GPU any load failure is now a hard error, and 218 names the compiler bug explicitly. tcgen05's verify_ptx_only also now assembles the PTX for the arch its .target line records (the old hardcoded -arch=sm_120a could never succeed against the sm_100a module) and fails on real assembly errors while skipping on old/missing ptxas. Also split compile_tcgen05_mma_base into _cg1/_cg2 kernels, mirroring the existing cp/control zoo split: ptxas enforces one tcgen05 granularity per function ("uses single CTA (.cta_group::1) and CTA pair granularity (.cta_group::2) and that is not allowed"), so the mixed kernel made the whole module unassemblable and unloadable. This was caught by the new smoketest ptxas gate; the smoketest's instruction-form counts now aggregate over both bodies with per-kernel purity checks. * test(examples): add shared_stage_select regression example A runtime `match stage & 3` over four per-stage shared-memory buffers inside a runtime-trip-count loop: the multi-stage pipeline shape that LLVM 23's SimplifyCFG turned into .global lookup tables of .shared addresses. The example is standard-category, so the guard runs on every GPU and in compile-only CI, not just on tcgen05 hardware: if the tables ever come back, the build fails (post-llc shared-initializer scan) and module load fails (CUDA_ERROR_INVALID_PTX). Without the fix this example forms 4 lookup tables and ptxas rejects its PTX; with the fix it executes and verifies 32 lanes across 9 staged iterations. * ci(smoketest): assemble GPU-gated PTX with ptxas in compile-only verdicts The tcgen05/wgmma/blackwell-mma verdicts accepted "a .ptx exists" on hosts that cannot execute them, so PTX that only fails at driver JIT (e.g. .global initializers referencing .shared symbols, CUDA_ERROR_INVALID_PTX 218) passed CI silently and only exploded on the gated hardware. Resolve a ptxas once (CUDA_OXIDE_PTXAS, PATH, CUDA_HOME, /usr/local/cuda*), then assemble each gated artifact for the arch its .target line records as part of the verdict. A real assembly error fails the lane with ptxas's message; a missing ptxas, or one too old for the arch or PTX ISA, is a noted skip. The gate applies to the normal-mode "PTX compiled" verdicts, to --compile-only verdict_compile, and to the dual-route tcgen05 branch that also emits a .ptx before its libNVVM run. This gate immediately caught a real bug: the tcgen05 example's compile_tcgen05_mma_base kernel mixed cta_group::1 and cta_group::2 in one function, which ptxas rejects (fixed by splitting the kernel). * docs(codegen): rewrite the lookup-table flag and scan rustdoc visual-first Same facts, readable shape: the failure-chain and safety-net diagrams up front, the LLVM-23 default-subtarget story and the keep-forever rationale as short bullets. * fix(examples): clippy-clean shared_stage_select's host verification loop needless_range_loop on the host-side result check; iterator rewrite, device kernel untouched (the match-over-stage-buffers pattern under test lives in the kernel, not here). * fix(ci): raise the llc floor gate to LLVM 22; reject leaked intrinsic externs loudly The new ptxas verdict gate exposed that CI's llc-21 floor pin has been producing unassemblable tcgen05 PTX all along: llc-21 predates llvm.nvvm.stmatrix.* (gemm_sol, gemm_sol_final) and lowers the unknown intrinsic by leaking its dotted LLVM name into the PTX as an .extern .func declaration, exit 0, no diagnostic. ptxas then dies with an unhelpful parse error; nothing in compile-only CI ever assembled the file, so it shipped green. Two changes: the examples-compile floor pin moves to llc-22 (the true floor for the stmatrix family, verified: 221/221 compile-only with the ptxas gate active), and the pipeline gains a second post-llc scan that rejects dotted .extern .func declarations with an error naming the intrinsic and the remedy, so an under-floor llc fails at build time with the cause instead of a cryptic assembler error.
…ranch folding); assemble every compile-only PTX in CI (NVIDIA#1205) * Disable llc's late branch folding so ptxas's SASS unroller keeps firing LLVM 23's NVPTX backend gained reverseBranchCondition (llvm/llvm-project PR #191889), letting BranchFolding and MachineBlockPlacement collapse the "cond-bra + bra.uni" loop idiom into single negated conditionals with fallthrough. ptxas's SASS unroller keys on the original orientation at the loop guard and latch, so the folded form silently turns off SASS unrolling: gemm_views' sgemm_naive_raw dropped 38 -> 26 registers and FFMA 18 -> 4, costing 26% live throughput (7218 -> 5708 GFLOPS). Append -disable-branch-fold and -disable-block-placement to every llc invocation. Both are generic disable-only cl::opts accepted by llc 21+, so there is no correctness surface. Measured: naive_raw back to 38 registers and 7226 GFLOPS live, zero register movement on 16 other kernels across 6 examples, PTX +1-6% lines (redundant jumps ptxas discards), bit-identical numerics throughout. The llc argument head moves into base_llc_args so the unit tests assert the argument list verbatim, next to the existing optimization_args tests. * smoketest: assemble every compile-only PTX with ptxas, not just gated ones The compile-only ptxas gate previously ran only for the tcgen05, wgmma, and blackwell-mma categories. Every other example's verdict accepted "a .ptx exists", which misses PTX that llc emits but ptxas rejects (e.g. .shared symbols in .global initializers, which only fail at driver JIT load). Nothing executes in compile-only mode, so assembly is the strongest check available: run ptxas_verify on every emitted .ptx. Normal-mode verdicts keep their current scope, since real execution supersedes assembly there. The missing/too-old-ptxas noted-skip semantics are unchanged. Assembling all ~200 PTX files costs about 4.5 seconds total. * gemm_views: refresh RTX 5090 bench numbers after the branch-layout fix Measured live via the example itself (1024^3, average of 5 runs) with llc's branch folding disabled pipeline-wide: naive views 0.300 ms / 7159 -> 0.298 ms / 7201 GFLOPS naive raw 0.300 ms / 7161 -> 0.298 ms / 7201 GFLOPS tiled views 0.232 ms / 9272 -> 0.229 ms / 9370 GFLOPS tiled raw 0.231 ms / 9286 -> 0.230 ms / 9337 GFLOPS Also note the dependence on the pipeline-wide flags, pointing at the DISABLE_BRANCH_FOLD rustdoc in crates/cuda-oxide-codegen/src/ptx.rs. * docs(codegen): cite the full-suite register sweep, not the early spot-check * fix(codegen): declare PTX ISA 7.8 for full-debug modules The all-examples ptxas gate caught a pre-existing latent bug on its first CI run: llc-22's DWARF emission writes label-difference expressions into debug sections (.debug_pubnames end-start), a PTX ISA 7.5 feature, while declaring the target's default .version (7.0 at sm_80). ptxas rejects the module; nothing ever assembled full-debug PTX before this gate (GPU boxes target sm_120a where the default .version is already high enough, and llc-23 shapes its debug sections differently). Raise the module's PTX ISA requirement to 7.8 (the nearest supported spelling at or above 7.5) when full device debug is enabled, through the existing required_ptx_feature mechanism, which already refuses to downgrade targets whose floor is higher. Line-tables debug emits no such expressions and is untouched.
NVIDIA#1197) * docs: repoint the three source references the module split invalidated NVIDIA#1190 split several large files into module directories. Three places in the tree still point a reader at a path that no longer exists, and following any of them lands nowhere: * `cuda-oxide-codegen/tests/spine_kernel_ptx.rs` sends the reader to `mir-lower/src/convert/types.rs` for `is_kernel_func`, now `convert/types/func_abi.rs`; * `examples/ref_index_projections/README.md` and `examples/subslice_projection/README.md` both name `mir-importer/src/translator/rvalue.rs`, now the `translator/rvalue/` directory. Two of them needed more than a new path, because the sentence around the path had gone stale too: * the same doc comment cites `lowering.rs:132` for `propagate_kernel_attrs`, which is at line 336. A line number in prose rots on the next edit, so this names the function in its file instead of pinning a number. * `ref_index_projections` says the `Rvalue::Ref` arm "has five cases" in the present tense. It has two, and had five before the fix that README documents; the description is of the pre-fix code, so it now reads as past tense and points at where that arm and its address walk live today. `examples/atomics/README.md` also names `intrinsics/atomic.rs` and `ops/atomic.rs`, but those are crate-relative shorthand in a pipeline diagram and both resolve, so they are left alone. Signed-off-by: Vyncint Ng <[email protected]> * docs: repoint the remaining 14 references the module split orphaned The NVIDIA#1190 module split deleted 16 monolithic files. PR NVIDIA#1197 repointed the three sites issue NVIDIA#1196 enumerated; this commit sweeps the rest, including bare-basename spellings the original sweep missed: - abi_hmm README table rows (convert/types.rs, ops/aggregate.rs) - book lowering-pipeline.md table rows (ops/memory.rs, ops/aggregate.rs) - mir-lower README (convert/generated_intrinsics.rs, now a directory) - translator/layout.rs + lowering_test/calls_and_values.rs comments (translator/rvalue.rs) - convert/ops/arithmetic.rs + ops/memory/tests/mod.rs comments (tests/lowering_test.rs, now a directory) - cargo-oxide README source tree (commands.rs, now a directory) - render/families/packed.rs comment (resolve.rs, now a directory) - translator/types.rs comment (place walker lives in rvalue/place_addr.rs) - intrinsics/indexing.rs doc (sreg dispatch lives in generated/sreg.rs) - cast_tests README pipeline diagram (rvalue.rs -> rvalue/expr.rs) Every new pointer was verified against the tree before writing it. Sweep now returns zero dangling references across full-path, crate-relative, and bare-basename spellings of all 16 deleted files. Signed-off-by: nihalpasham <[email protected]> --------- Signed-off-by: Vyncint Ng <[email protected]> Signed-off-by: nihalpasham <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…tes (NVIDIA#1195) * feat(ptx-schedule): classify the asynchronous proxy pipeline as schedule sites `classify_instruction` covered the synchronous ordering primitives -- atomics, `red.*`, the `bar.*`/`barrier.*`/`mbarrier.*` family, `membar.*`/`fence.*`, the warp collectives and ordered `ld`/`st` -- and nothing from the asynchronous proxy. An opcode that classifies as nothing is not a site of any kind, so it received no injection and never appeared in a report: the pipeline a Hopper or Blackwell kernel is built around was the part a campaign could not reach. None of the existing arms reach these, and each for its own reason: * `cp.async.bulk.tensor...` carries `mbarrier::complete_tx::bytes` in its qualifier list, but spells it with `::`, so it never matches the barrier arm's `mbarrier.`; * `wgmma.fence.sync.aligned` is a fence that does not start with `fence.`; * `tcgen05.ld...` splits to a base of `tcgen05` rather than `ld`, so the ordered-memory arm returns before seeing it; * `clusterlaunchcontrol.try_cancel.async` completes through an mbarrier just as the bulk-tensor copy does, and matches nothing at all. Adds `SiteKind::AsyncProxy` and one prefix arm for the four families. Taking each family whole matches how `bar.`/`mbarrier.` and the warp collectives are already handled, and keeps the consumer halves (`tcgen05.ld`, `clusterlaunchcontrol.query_cancel`) as sites alongside the issues and waits they read. Across the 167 `.ptx` the example corpus builds, this takes the analyzer from 2093 sites to 2465: 372 ordering instructions that were previously invisible. The crate README carries the `SiteKind` table, so it gains the row in the same position; the two lists agree in order and content. Signed-off-by: Vyncint Ng <[email protected]> * fix(ptx-schedule): cover cp.reduce.async in the AsyncProxy prefix arm The new arm matched "cp.async" but not the TMA reduce family: mir-lower's inline-asm template emits cp.reduce.async.bulk.tensor.{n}d.global.shared::cta.{op}.{mode}.bulk_group, where "reduce" sits before "async", so "cp.async" walks past it. Before/after for a kernel using TMA tensor reduce: cp.reduce.async.bulk.tensor.2d...bulk_group -> (no site) -> AsyncProxy cp.async.bulk.commit_group -> AsyncProxy -> AsyncProxy cp.async.bulk.wait_group 0 -> AsyncProxy -> AsyncProxy That left the issue classified as nothing while its commit/wait pair became sites: the half-covered condition issue NVIDIA#1113 describes. Adds the prefix, one fixture line spelled verbatim from the mir-lower template, and extends the existing assertions. No example emits cp.reduce today, so corpus site counts are unchanged (verified: no count constants reference the corpus). Signed-off-by: nihalpasham <[email protected]> --------- Signed-off-by: Vyncint Ng <[email protected]> Signed-off-by: nihalpasham <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…VIDIA#1193) Both scaffold templates declared their imports in an order rustfmt does not produce, so a freshly created project failed `cargo fmt --check` on code the user never wrote: $ cargo oxide new demo && cd demo && cargo oxide fmt --check Diff in src/main.rs:1: -use cuda_device::{kernel, launch_bounds, launch_contract, thread, DisjointSlice}; -use cuda_host::cuda_module; use cuda_core::{CudaContext, DeviceBuffer, LaunchConfig1D}; ❌ Some files need formatting. Run: cargo oxide fmt Two orderings were wrong in both templates: the crates were not sorted (`cuda_device`/`cuda_host` preceded `cuda_core`, and in the async template also `cuda_async`), and inside the braces `DisjointSlice` sorted after the lowercase items under the scaffold's `edition = "2024"`. CONTRIBUTING points contributors at `cargo oxide fmt`, so this is the first thing a new project is told to run. Nothing formats these today: the templates are string constants, so the repository's own fmt job formats the file holding them and never their contents, and no gate runs `cargo oxide new`. Both templates now carry rustfmt's own output, pinned by `scaffold_templates_are_rustfmt_clean`, which runs the real `rustfmt` over each rendered template and takes the edition from the scaffolded `Cargo.toml` so the two cannot drift. A re-derived ordering check would have agreed with the stale template just as readily, and would not have noticed drift elsewhere in the file. `scaffold_sync_template_uses_launch_contract_and_docs` asserted the old unformatted line, so the defect was an asserted invariant; it now asserts the canonical one and leaves ordering to the new test. The book's `getting-started/hello-gpu.md` presents one of these listings as the generated async template, and NVIDIA#548 exists to keep it in step with `scaffold_main_rs(true)` with no automated guard between them, so it moves with the scaffold here. Signed-off-by: Vyncint Ng <[email protected]>
NVIDIA#1188) `cargo oxide fmt` resolved its context with `resolve_context`, which calls `backend::find_or_build_backend`: on a checkout with no cached `librustc_codegen_cuda.so` the command compiled the entire codegen backend -- and in standalone mode cloned it first -- before formatting a single file. Formatting compiles no device code. `format_all` reads only `workspace_root`, `codegen_crate` and `examples_dir`; neither it nor `run_cargo_fmt`, `run_cargo_fmt_manifest`, `run_fmt_command` nor `collect_example_manifests` takes a `Context` at all, so `backend_so` is unreachable from this path. `resolve_passive_context` fills those three fields identically in every discovery branch, so the eager resolver bought nothing. `doctor`, `clean`, `list` and `update` already resolve passively for the same reason; `fmt` was the one read-only command left resolving eagerly. Its doc comment now names it alongside them. Signed-off-by: Vyncint Ng <[email protected]>
…ies NVIDIA#1202) (NVIDIA#1206) * docs: correct tcgen05 hardware claims to sm_100a (datacenter Blackwell) tcgen05/TMEM is a datacenter-Blackwell feature; consumer Blackwell (sm_120, RTX 50 series) has no TMEM and no tcgen05 instruction set. Fix every doc site that claimed sm_120 support: - tcgen05 + tcgen05_matmul READMEs: required GPU is sm_100a, add explicit NOT-supported note for consumer Blackwell (sm_120) - cuda-device tcgen05 rustdoc: drop the "sm_120: RTX 5090" bullet, frame the sm_100 TMEM-capable family instead - book safety-model Tier 3 table: tcgen05/TMEM rows -> sm_100a (Blackwell DC), CLC row -> sm_100+ (Blackwell) - tcgen05 example crate doc: "Blackwell-only (sm_100/sm_120)" -> "Blackwell datacenter-only (sm_100a)" Doc-only slice of PR NVIDIA#1202; the PR's runtime changes were superseded by the stronger capability gate that landed in NVIDIA#1203. Signed-off-by: Guilherme Pedroza <[email protected]> * docs: sync tcgen05 README transcripts with actual output; add sm_101a to family list - both READMEs showed a "Loading PTX from: ..." line the examples never print; transcripts now match the post-NVIDIA#1203 load sequence - tcgen05_matmul's non-datacenter transcript now quotes the literal warning the code prints ("WARNING: tcgen05 requires sm_100 (datacenter Blackwell)!") plus the full PTX-verification tail - cuda-device tcgen05 rustdoc family list gains sm_101a: the runtime allowlist in the examples accepts cc 10.0 / 10.1 / 10.3 / 11.0, so the docs must name all four arches Signed-off-by: nihalpasham <[email protected]> --------- Signed-off-by: Guilherme Pedroza <[email protected]> Signed-off-by: nihalpasham <[email protected]> Co-authored-by: Guilherme Pedroza <[email protected]>
* feat(intrinsics): route mbarrier_arrive_no_complete through the generated catalog (NVIDIA#774) Port of PR NVIDIA#1101 onto current main. The old hand-written stub in cuda-device had no count argument and no importer arm, so any kernel calling it died late in device codegen: before: mbarrier_arrive_no_complete(bar) -> "Symbol cuda_device__barrier__mbarrier_arrive_no_complete not found" after: mbarrier_arrive_no_complete(bar, count) -> u64 opaque state, mbarrier.arrive.noComplete.shared.b64 $0, [$1], $2; What lands here (the hand-written half; regeneration follows separately): - overlay entry in mbarrier_basic.toml + ABI ledger entry (renumbered i1016 -> i1017; main took i1016 for ex2_approx_f16) - generator recipe MbarrierBasicOperation::ArriveNoComplete and the ptx_modifier -> ptx_modifiers generalization (noComplete needs four modifiers, the old field hard-coded [op, "shared", "b64"]) - render arms: ABI docs, compat shim, dialect op MbarrierArriveNoCompleteSharedOp (2 opds / 1 result, u32 count + u64 state verifier), importer dispatch, lowering dispatch, probe, reference - hand-written lowering convert_arrive_no_complete in mir-lower: LlvmNvptx -> llvm.nvvm.mbarrier.arrive.noComplete.shared, LibNvvm -> inline PTX "=l,l,r,~{memory}" - stub deletion in cuda-device/src/barrier.rs - barrier example regression kernel: init(N+1), noComplete arrive(N) leaves the phase open (test_wait false), one final arrive completes it (true); host checks [0, 1] - negative dialect tests + wrong-adapter and renderable-shape generator tests Signed-off-by: Raul Estrada <[email protected]> * chore(intrinsics): regenerate catalog for mbarrier_arrive_no_complete (i1017) + LLVM-23 evidence Mechanical follow-up to the previous commit; no hand-written logic. - cargo run -p cuda-intrinsics-gen -- generate (1304 outputs: catalog.json, device/dialect/importer/lowering/collector code, probes, reference doc) - ABI id is i1017 on current main (PR NVIDIA#1101 recorded i1016, which main spent on ex2_approx_f16) - evidence, re-recorded on this machine instead of porting the PR's LLVM-22 records: - rust-llvm-23.1.0-16696adc: typed llvm.nvvm.mbarrier.arrive.noComplete.shared probe; llc emitted exact mbarrier.arrive.noComplete.shared.b64 and CUDA 13.3 ptxas (V13.3.33) accepted it for sm_80 - cuda-13.3-libnvvm-13.3.33: barrier example built via libNVVM to 7,056-byte LTOIR, nvJitLink linked a 12,704-byte sm_80 cubin; cuobjdump shows barrier_no_complete_test sections and the counted arrival lowered as ATOMS.ADD on the barrier state - gates run locally: generate, check, check-abi-history --base-ref origin/main (1016 base entries preserved, 1017 total), probe --all --skip-terminal --per-target (2366 target configurations) Signed-off-by: nihalpasham <[email protected]> * docs(book): re-stamp the dialect page for the i1017 catalog The mlir-dialects page pins the catalog SHA and hand-kept op counts; status-guard machine-checks the stamp. mbarrier_arrive_no_complete moves it: stamp 49bcd626 -> 02a6a6b3 ops 575 -> 576 (generated 549 -> 550), entries 1016 -> 1017 row cp_async/mbarrier_*/sync 34 -> 35 Both tables re-summed against the greps the guard prescribes. Signed-off-by: nihalpasham <[email protected]> --------- Signed-off-by: Raul Estrada <[email protected]> Signed-off-by: nihalpasham <[email protected]> Co-authored-by: nihalpasham <[email protected]>
* feat(intrinsics): admit ordered sparse Ampere floating MMA (f16/bf16/tf32, sm_80+) Add the eight PTX 8.5 mma.sp::ordered_metadata floating forms through the catalog/generator pipeline, symmetric to the ordered integer sparse family: - m16n8k8 f32.tf32 - m16n8k16 f32.tf32 - m16n8k16 f32.bf16 - m16n8k32 f32.bf16 - m16n8k16 f16.f16/f32.f16 - m16n8k32 f16.f16/f32.f16 Contracts follow the PTX ISA exactly: operand order d,a,b,c,metadata,selector; selector as an "n" immediate with domain 0-3 for the 2-register carriers (k8, k16-f16/bf16) and 0-1 for the 4-register carriers (k32, k16-tf32); metadata codes 0x4/0x8/0x9/0xc/0xd/0xe (tf32: 0x4/0xe only, with its own reference rule text). The f16/bf16 forms carry <2 x half> multiplicands in LLVM; tf32 carries packed i32. Ported from PR NVIDIA#1139 onto the split resolve/model/render module layout and the ledger-bound blank-ABI-id convention (the shard carries no first_abi_id or product_count; identity binds from intrinsics/abi-v1.toml by catalog id). Evidence identity fields are rebound to the pinned LLVM 23.1.0 backend, matching how all recorded evidence was migrated in the LLVM 23 bump. Signed-off-by: Sam, Joochul Chang <[email protected]> Signed-off-by: nihalpasham <[email protected]> * test(sparse-mma): make the float oracle asymmetric, selector-routed, and multi-code The ported oracle was parity-degenerate: val(x,y) = 1 + ((x+y) & 1) made the A and B fragments bitwise identical in every lane across all eight variants, metadata was the single code 0x4 repeated, and the selector was always 0. An a<->b template swap, a hardwired selector, or a metadata misroute all still passed. Rework: - A, B, C are positionally distinct and asymmetric (A = 1+(3r+5j)%7, B = 1+(2k+3c)%8, C = (5r+7c)%32), small enough that f16/bf16/tf32 accumulation stays exact and the host reference is pure integer math - every valid ordered metadata code executes (0x4/0x8/0x9/0xc/0xd/0xe cycling by row+chunk; tf32 alternates 0x4/0xe with an aperiodic index so no wrong (lane, nibble) -> (row, chunk) reading aliases to the truth) - each selector domain runs a nonzero selector (2/1/3 in the 0-3 domain, 1 in the 0-1 domain) and non-selected lanes carry a valid decoy pattern, so selector misrouting changes the result - pair-selector shapes (k32 f16/bf16, k16 tf32) split the K dimension across the thread pair while keeping the [row g | row g+8] register halves; verified against sm_120 hardware, where a row-per-thread split fails the oracle - the sub-sm_80 skip message now uses the harness "skipping: ..." form Mutation check on an RTX 5090 (cc 12.0): swapping the a/b arguments of one variant fails 127 of its 128 checked accumulators; reverted, all 8 variants pass and compute-sanitizer memcheck reports 0 errors. The evidence runtime stages now record this re-measured run. Signed-off-by: nihalpasham <[email protected]> * chore(intrinsics): bind i1017-i1024 in the ABI ledger and regenerate Append the eight ordered Ampere float sparse-MMA entries to intrinsics/abi-v1.toml (catalog ids, operation keys, and raw Rust signatures derived from the closed recipe; blank shard ids bind to them by catalog id) and regenerate every catalog-stamped output: - intrinsics/catalog.json, generated-reference.md, and the 8 new selector-swept probe fixtures (plus the stamp header in every probe) - generated sources across cuda-device, dialect-nvvm, mir-importer, mir-lower, and the collector targets - the book's catalog stamp and 1016 -> 1024 record count Gates run on this tree: cargo run -p cuda-intrinsics-gen -- generate / check / check-abi-history --base-ref origin/main (1016 base entries preserved, 1024 total); probe --all --skip-terminal --per-target (2373 target configurations across all 1024 routes, pinned LLVM 23.1.0); cargo test -p cuda-intrinsics-gen -p dialect-nvvm -p mir-importer -p mir-lower; fmt + clippy -D warnings for the workspace and the new example; scripts/sync-example-locks.sh --check. Signed-off-by: nihalpasham <[email protected]> * chore(intrinsics): re-attest sparse float MMA evidence on the local CUDA 13.3 toolchain Signed-off-by: nihalpasham <[email protected]> * docs(book): re-stamp the dialect page for the re-attested catalog The evidence re-attestation renamed the libNVVM evidence profile, which is recorded in intrinsics/catalog.json, so the catalog hash moved again after the page was stamped for the i1017-i1024 regeneration: stamp a6962ae6 -> 91c449f0 counts unchanged (the eight float forms resolve onto the shared sparse-MMA structural op; entries were already 1024) Signed-off-by: nihalpasham <[email protected]> --------- Signed-off-by: Sam, Joochul Chang <[email protected]> Signed-off-by: nihalpasham <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…A#1171) * docs(book): document the catalog-generated intrinsics workflow Signed-off-by: Raul Estrada <[email protected]> * docs(book): fix the schema gloss, document catalog.json's header, align check-intrinsics with CI Accuracy pass over the new catalog-generated-intrinsics chapter: - schema gloss was backwards. Before: overlay.toml's `schema` "identifies the serialized catalog format expected by the generator". After: it is OVERLAY_SCHEMA, the overlay INPUT format (resolve/overlay.rs); catalog.json's "schema": 46 is CATALOG_SCHEMA, the serialized catalog format stamped at generation. Added a small pipeline sketch showing 44 -> generator -> 46. - new subsection for catalog.json's header fields (schema, catalog_version, intrinsic_abi, generator_version); the generator_version stamp was undocumented anywhere. - Justfile check-intrinsics now runs probe with --per-target, matching the generated-intrinsics CI job, so the chapter's "mirrors the CI job" sentence is literally true. - noted the two environment facts the gates depend on: check-abi-history needs full git history (CI uses fetch-depth: 0), and the generator shells out to rustfmt (why the toolchain pin carries the rustfmt component). - generator source pointers are directories now (src/model/, src/resolve/, src/render/), not single .rs files. Signed-off-by: Nihal Pasham <[email protected]> --------- Signed-off-by: Raul Estrada <[email protected]> Signed-off-by: Nihal Pasham <[email protected]> Co-authored-by: Nihal Pasham <[email protected]>
) * refactor(codegen): thread parsed CUDA architectures Parse external CUDA target spellings at target resolution and retain the CudaArch witness through selection, generated-intrinsic checks, LLVM validation, final-IR validation, and PTX feature selection. Preserve target provenance, fail-closed recorded PTX floor checks, diagnostics, llc arguments, and generated probe evidence while removing internal render-and-reparse round trips. Signed-off-by: Sam, Joochul Chang <[email protected]> * Share PTX feature floor composition Centralize PTX feature selection above a recorded target floor in the shared target-spec leaf and use it from codegen and probe derivation. Pin the derived PtxIsaRequirement ordering to the shared spelling vocabulary so max-based requirement composition stays valid. Signed-off-by: Sam, Joochul Chang <[email protected]> * Unify PTX spellings behind a newtype Make vocabulary membership and numeric ordering properties of the shared PtxSpelling type. Represent codegen requirements as an optional spelling and thread the proven spelling through probe feature derivation. Signed-off-by: Sam, Joochul Chang <[email protected]> * Derive target candidates from recorded floors Make the shared floor-table order the target-selection preference and iterate it directly in codegen. The prior candidate key-set assertion is now true by construction. Signed-off-by: Sam, Joochul Chang <[email protected]> * Import CudaArch from its defining crate Use the direct cuda-target-spec path in codegen target selection while retaining the libnvvm-sys re-export for other consumers. Signed-off-by: Sam, Joochul Chang <[email protected]> * Attach PTX floor composition to spellings Move compare-and-render behavior onto proof-carrying PtxSpelling and route both codegen and probe consumers through it. The off-vocabulary branch disappears because invalid spellings cannot construct the receiver. Signed-off-by: Sam, Joochul Chang <[email protected]> * docs(cuda-target-spec): state the parse-once ownership contract in the crate doc - adds a tiny before/after visual: N parse sites -> one CudaArch owner - notes that holding a PtxSpelling is itself the vocabulary-membership proof Signed-off-by: nihalpasham <[email protected]> * test(cuda-target-spec): guard the selection-preference order of RECORDED_PTX_FLOORS The list's entry order became load-bearing when candidates started deriving from it (selection takes the first satisfying entry), but the old unordered set-equality test was deleted with the list it compared against. One windows(2) walk freezes the contract: [ base asc ][ 'a' asc ][ 'f' asc ] preferred ------------> last resort An out-of-section insert now fails the build instead of silently reshuffling which target wins. Signed-off-by: nihalpasham <[email protected]> * test(codegen): pin reject-path behavior for malformed low-width targets Measured against current main: sm_05 and sm_ produce identical TargetSelection errors as explicit overrides on both sides of the typed-target refactor, and both are ignored as device hints. Pin that equivalence so the reviewer-raised reject paths stay observable. Signed-off-by: Sam, Joochul Chang <[email protected]> --------- Signed-off-by: Sam, Joochul Chang <[email protected]> Signed-off-by: nihalpasham <[email protected]> Co-authored-by: nihalpasham <[email protected]>
…y-2026-08-28 The committed lock predates the nightly-2026-08-28 pin from NVIDIA#1201, so a fresh clone fails 'nix develop' with "Nightly 2026-08-28 is not available". Bump rust-overlay (1d634a90 -> 996e9b0b) to a revision that carries the pinned toolchain. Signed-off-by: nihalpasham <[email protected]>
…ile-distinct Walsh validator for the CLC phases Phase 4D decoded the CLC response in all 32 producer lanes with no proxy fences and no rendezvous, unlike 4B/4C: the leader's next clc_try_cancel_multicast can overwrite both CTAs' CLC_RESPONSE while slow follower lanes still hold the old one, so is_canceled diverges and the warp hangs at the K-loop sync (reachable when k_iters == 4). Adopt the 4C pattern: CLC_READY cluster rendezvous armed before the local TILE_INFO_FREE wait, lane-0-only decode with async-proxy fences, and shuffle broadcast so the cancel branch is warp-uniform by construction. The TILE_INFO_FREE barrier itself stays CTA-scope; a comment now pins the CTA-locality invariant and the escalation path. The CLC correctness phases also swap their periodic inputs (every 128x128 output tile byte-identical - blind to exactly the tile permutations the mailbox race causes) for the 12-bit Walsh fingerprint validator with a full exact-BF16 output scan. A quadrant scale on A breaks the affine-code twin symmetry (code(x+2048) = code(x) ^ 0x800) that would otherwise leave each tile a byte-identical twin 16 tiles away; all values stay exact in f16/f32/bf16 in any accumulation order. Signed-off-by: nihalpasham <[email protected]>
The B200 evidence for PR NVIDIA#1066 previously lived only in the PR description. scripts/regress-gemm-sol-schedule.sh (just regress-gemm-sol) makes it repeatable: the default pass-after mode runs the mbarrier-focused fuzz-schedule campaign on the current tree with --fail-on-finding and asserts from summary.json that the baseline was Usable (a Declined baseline also exits 0), every variant ran, and AsyncProxy sites were classified (post-NVIDIA#1195 coverage incl. tcgen05 commit/wait). The opt-in --fail-before <ref> mode rebuilds the pre-fix tree in a throwaway worktree and asserts the race is CONFIRMED there. Seeds are per-build (site renumbering), so the pinned defaults document the lineage they were confirmed on and stay overridable. Gated on sm_100 hardware; skips cleanly elsewhere. Signed-off-by: nihalpasham <[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.
this pr fixes a tile-metadata race in the gemm_sol phase 4B kernel (
gemm_sol_clc), found by the schedule perturbation campaign in this pr #2the producer warp publishes
{tile_m, tile_n, has_work}through the sharedTILE_INFOmailbox, signalsTILE_READY, and then reuses the mailbox for the next stolen tile. the MMA warp and four epilogue warps wait onTILE_READYand read the mailbox, but nothing acknowledged that all five readers had copied the current values before the producer overwrote them, so a different warp schedule could pair epilogue output with the wrong tile coordinates.the fix adds a
TILE_INFO_FREEmbarrier with an arrival count of 5:TILE_READYwait, syncs its lanes, and lane 0 arrives onTILE_INFO_FREETILE_INFO_FREEparity before republishingTILE_INFO(including the finalhas_work = 0publish)before and after
on 1x B200 (
sm_100a), withGEMM_SOL_PHASE=4b-correctnessisolating the 4096x4096x4096 phase 4B validator, the campaign surfaced the race on the unfixed kernel at seeds 56 and 135 of a 0..140--focus mbarriersweep, each reproduced 3/3:on the unfixed kernel this outputs
and the example's own validator reports, identically on all three executions:
264 of 1024 output tiles were never written: epilogue warps woke from
TILE_READY, were delayed past the producer republishingTILE_INFO, and drained their TMEM stage onto another tile's coordinates. the pristine baseline passes; only the injected timing differs.with the fix, the same command passes and the full sweep is clean:
performance
the added wait is once per tile, off the K-loop, so
GEMM_SOL_PHASE=4bthroughput is unchanged within noise: 502.8 -> 501.5 TFLOPS at 4096, 497.3 -> 497.3 at 8192, 484.2 -> 481.8 at 16384.