Skip to content

docs(mir-lower): the intrinsic converter table names two modules deleted in #406 - #977

Merged
nihalpasham merged 2 commits into
NVIDIA:mainfrom
vyncint:docs/mir-lower-intrinsic-converters
Aug 18, 2026
Merged

nihalpasham merged 2 commits into
NVIDIA:mainfrom
vyncint:docs/mir-lower-intrinsic-converters

Conversation

@vyncint

@vyncint vyncint commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

README.md's GPU Intrinsic Converters (convert/intrinsics/) table has 13 rows for a directory holding 24 modules. Two of the 13 do not exist:

Row Reality
stmatrix convert/intrinsics/stmatrix.rs deleted in 6a9a6373 (#406)
tcgen05 convert/intrinsics/tcgen05.rs deleted in 6a9a6373 (#406)

Both went when "Generate CUDA intrinsics from pinned LLVM metadata" moved those families onto the catalog path. The table still describes them as hand-written converters with an "Inline PTX" strategy; stmatrix and tcgen05 appear 460 times in convert/generated_intrinsics.rs today. So a reader looking for where either is lowered is sent to a file that has not existed for many releases — the same shape as #797, one crate over.

A third row, generated_intrinsics, is real but not in that directory — it is convert/generated_intrinsics.rs, one level up. That is the row most worth getting right, since it is where nearly every intrinsic now goes.

Fourteen modules that do exist had no row at all:

asm  cp_async  dotprod  execution_control  extended_minmax  integer_minmax
ldmatrix  memory  packed  prmt  scalar_arithmetic  scalar_conversion
scalar_math  wmma

integer_minmax arrived last batch with #967.

The fix

Rewritten as one row per file, with each description taken verbatim from that module's own //! doc comment — so the table cannot drift from the code without the doc comment drifting first.

The "Strategy" and "GPU" columns are dropped: they were per-module guesses at what are per-intrinsic properties, and the catalog already records the PTX version and minimum SM for each, rendered into intrinsics/generated-reference.md. The page now points there instead of keeping a second copy by hand — the same treatment #964 gave the book's dialect-nvvm table.

The Core Modules table on the same page was short by four: top-level type_conversion_interface, scalarize_block_args and wgmma_deferred_accumulator, plus convert/enum_payload_storage.

Testing

Local, no GPU — documentation only.

  • By script: the converter table's rows are now exactly the set of .rs files in convert/intrinsics/ (24 and 24, no ghost and no missing)
  • Every top-level src/*.rs module and every convert/*.rs module now has a row
  • Guards pass on the merged tree
  • cargo oxide run <example> — not applicable

vyncint and others added 2 commits August 18, 2026 06:59
…ted in NVIDIA#406

`README.md`'s "GPU Intrinsic Converters (`convert/intrinsics/`)" table has 13
rows for a directory holding 24 modules. Two of the 13 do not exist:

  convert/intrinsics/stmatrix.rs   deleted in 6a9a637 (NVIDIA#406)
  convert/intrinsics/tcgen05.rs    deleted in 6a9a637 (NVIDIA#406)

Both were removed when "Generate CUDA intrinsics from pinned LLVM metadata"
moved those families onto the catalog path. The table still describes them as
hand-written converters with an "Inline PTX" strategy; `stmatrix` and
`tcgen05` are mentioned 460 times in `convert/generated_intrinsics.rs` today.
So a reader looking for where either is lowered is sent to a file that has not
existed for many releases. Same shape as NVIDIA#797, one crate over.

A third row, `generated_intrinsics`, is real but not in that directory -- it is
`convert/generated_intrinsics.rs`, one level up. That is the row most worth
getting right, since it is where nearly every intrinsic now goes.

Fourteen modules that do exist had no row at all: `asm`, `cp_async`,
`dotprod`, `execution_control`, `extended_minmax`, `integer_minmax`,
`ldmatrix`, `memory`, `packed`, `prmt`, `scalar_arithmetic`,
`scalar_conversion`, `scalar_math`, `wmma`. `integer_minmax` arrived last
batch with NVIDIA#967.

Rewritten as one row per file, with each description taken verbatim from that
module's own `//!` doc comment, so the table cannot drift from the code
without the doc comment drifting first. The "Strategy" and "GPU" columns are
dropped: they were per-module guesses at what are per-intrinsic properties,
and the catalog already records the PTX version and minimum SM for each,
rendered into `intrinsics/generated-reference.md` alongside the sources. The
page now points there instead of keeping a second copy by hand -- the same
treatment NVIDIA#964 gave the book's dialect-nvvm table.

The Core Modules table on the same page was short by four: the top-level
`type_conversion_interface`, `scalarize_block_args` and
`wgmma_deferred_accumulator`, plus `convert/enum_payload_storage`.

Verified by script: the converter table's rows are now exactly the set of
`.rs` files in `convert/intrinsics/` (24 and 24, no ghost and no missing), and
every top-level `src/*.rs` module and every `convert/*.rs` module has a row.

Signed-off-by: Vyncint Ng <[email protected]>
The Core Modules table listed convert/interface_impls but not its
type-conversion counterpart; description taken from the module's
own doc comment.
@nihalpasham nihalpasham added documentation Improvements or additions to documentation IR-lowering Lowering between dialects (dialect-mir to LLVM dialect) intrinsics Device intrinsics and libdevice math mappings labels Aug 18, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator
  • Verified the two deleted modules are gone and every remaining row matches a file in convert/intrinsics/ with its doc comment.
  • One commit layered on: the Core Modules table was missing convert/type_interface_impls, the type-conversion counterpart of convert/interface_impls.

@nihalpasham
nihalpasham merged commit e8e8546 into NVIDIA:main Aug 18, 2026
0 of 43 checks passed
nihalpasham pushed a commit that referenced this pull request Aug 19, 2026
…he docs gate checks (#995)

#977 fixed this table in `README.md`. The same table lives in
`convert/intrinsics/mod.rs` as a module doc comment, rustdoc renders it, and it
had the same two dead rows and the same fourteen omissions.

The interesting part is how it survived. Every live row was an intra-doc link
and the two dead ones were plain code spans:

    //! | [`wgmma`]    | Warpgroup MMA        | Inline PTX | SM 90+  |
    //! | `tcgen05`    | 5th-gen Tensor Core  | Inline PTX | SM 100+ |
    //! | `stmatrix`   | Matrix store         | Inline PTX | SM 90+  |

6a9a637 (#406) made exactly that edit when it deleted those two modules:

    -//! | [`tcgen05`]  | 5th-gen Tensor Core       | Inline PTX      | SM 100+ |
    +//! | `tcgen05`    | 5th-gen Tensor Core       | Inline PTX      | SM 100+ |
    -//! | [`stmatrix`] | Matrix store              | Inline PTX      | SM 90+  |
    +//! | `stmatrix`   | Matrix store              | Inline PTX      | SM 90+  |

The docs gate runs `RUSTDOCFLAGS="-D warnings"`, so leaving the links in would
have failed the build. Downgrading them to plain spans was the smallest edit
that kept CI green -- and it converted a row rustdoc was checking into a row
nobody was. The gate caught the link; silencing the gate kept the claim.

So this does not just correct the rows, it puts them back under the gate. All
24 modules are `pub mod`, so every row is now a link, and the table cannot rot
the way it just did without the build going red. Verified both directions:

  * clean tree: `RUSTDOCFLAGS="-D warnings" cargo doc --no-deps -p mir-lower`
    passes with all 24 links resolving.
  * add one linked row for the deleted `stmatrix`, changing nothing else:

        error: unresolved link to `stmatrix`
          --> crates/mir-lower/src/convert/intrinsics/mod.rs:86:9
        error: could not document `mir-lower`

    which is precisely the failure #406 had to work around.

Descriptions come verbatim from each module's own `//!` line, the same source
#977 used for the README, so the two tables now say the same thing rather than
drifting apart again. The `Lowering` and `Min SM` columns go for the reason
#977 dropped them: they were per-module guesses at per-intrinsic properties the
catalog already records.

One thing that is deliberately *not* a link: `convert/generated_intrinsics.rs`,
which handles everything the catalog describes. It is a private `mod`, so
`[`super::generated_intrinsics`]` fails the same gate with
`private-intra-doc-links`. It is named as a path, and the doc says why.

Verified: table rows are exactly the 24 files in `convert/intrinsics/` with no
ghost and no missing; `cargo test -p mir-lower` and `clippy --all-targets` are
clean; the docs gate passes.

Signed-off-by: Vyncint Ng <[email protected]>
nihalpasham pushed a commit that referenced this pull request Aug 19, 2026
…ranslator rows were missing (#996)

Two follow-ups from the #978 merge note.

**The TMA expansion.** You flagged that #978's `tma` row was copied verbatim
from `tma.rs`, whose own doc comment says "Tensor Memory Access". The unit is
the Tensor Memory *Accelerator*, and the tree already says so in 22 places --
including `cuda-device/src/tma.rs`, `dialect-nvvm/src/ops/generated/tma.rs`,
and the book chapter of that name. mir-importer was the holdout, in four
places, so fixing the source alone would have left the README I just landed
disagreeing with it:

  src/translator/terminator/intrinsics/tma.rs:6    module doc
  src/translator/terminator/intrinsics/tma.rs:34   fn doc prose
  src/translator/terminator/intrinsics/mod.rs:18   table row
  README.md:105                                    table row

All four now read "Accelerator", and `Tensor Memory Access` no longer appears
anywhere under `crates/mir-importer/`.

This is the cost of the verbatim-from-doc-comment rule #977 and #978 adopted:
it cannot drift from the source, which also means it faithfully reproduces the
source's mistakes. Worth the trade, but the fix has to land in the source.

**The three translator rows.** `src/translator/mod.rs` carries the same module
table as the README and was short the same three modules #978 added there:
`layout`, `location` and `payload_store`.

One thing I checked and will not claim: unlike #977's table, making these rows
intra-doc links does **not** put them under the docs gate. `translator` is
`pub(crate) mod` since 4c1d583 (#833, "stop exporting the translator"), so
`cargo doc --no-deps` never documents it and an unresolved link there is not an
error. Verified by adding a `[`ghost_module`]` row and watching the gate pass.
It does fail under `--document-private-items` -- but that flag also surfaces
three pre-existing unresolved links elsewhere in the crate
(`MirFieldAddrOp`, `MirArrayElementAddrOp`, `MirArrayType`), so turning it on
is its own piece of work, not a free win here. The rows are links because the
seven around them are; the enforcement claim belongs only to #977's table.

Verified: the translator table is now exactly the 9 files in `translator/` plus
the `terminator` subdirectory; the README's `tma` row and `tma.rs`'s doc
comment are byte-identical again; `cargo test -p mir-importer` and the docs
gate are clean.

Signed-off-by: Vyncint Ng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation intrinsics Device intrinsics and libdevice math mappings IR-lowering Lowering between dialects (dialect-mir to LLVM dialect)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants