Skip to content

docs(mir-importer): five of twelve intrinsic modules in the README do not exist - #978

Merged
nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:docs/mir-importer-module-tables
Aug 18, 2026
Merged

nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:docs/mir-importer-module-tables

Conversation

@vyncint

@vyncint vyncint commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

README.md's "terminator/intrinsics/ — GPU Intrinsics" table has 12 rows. Only 7 name a module that exists:

Row Deleted in
intrinsics/sync.rs 6a9a6373 (#406)
intrinsics/cluster.rs 6a9a6373 (#406)
intrinsics/tcgen05.rs 6a9a6373 (#406)
intrinsics/clc.rs 6a9a6373 (#406)
intrinsics/warp.rs 4c1d5838 (#833)

#406 moved those families onto the catalog path and #833 dropped the last of them, so all five are handled by generated.rs today. Meanwhile eight modules that do exist had no row: asm, bigint, bitops, exact_div, float_math, iket, layout, saturating.

Between the two, the table describes a directory that has not existed for a long time — and it is the one place a contributor looks to find where an intrinsic is translated.

The book's compiler/mir-importer.md already describes the current model correctly ("intrinsics/catalog.json has its arm generated into … generated.rs"), so this README was the last copy still on the old one. Rewritten to match: one row per file, each description verbatim from that module's own //! doc comment. The per-module "GPU" column is dropped for the reason #964 dropped its equivalent — minimum-SM is a per-intrinsic property the catalog already records.

Two smaller gaps on the same page

  • The translator/ table was missing layout, location and payload_store.
  • The Error Types table lists 7 of PipelineError's 12 variants, missing Optimization, TargetSelection, UnsupportedLinking, LibdeviceUnavailable and InvalidMirPassPipeline. It also never says that PipelineError is defined in cuda-oxide-codegen and re-exported here, nor that the crate's own TranslationErr — Unsupported, TypeError, InvalidOp — is a different, narrower error. Both are now stated.

A note on that last one: I first read the table against error.rs, found none of the seven, and thought the whole table was fictional. It is not — the variants are real, just defined a crate away. Checking before writing is why this PR says "5 missing of 12" rather than something wrong.

Testing

Local, no GPU — documentation only.

  • By script, no ghost and no missing row in any of the three tables: intrinsics = exactly the 15 files in terminator/intrinsics/; translator = exactly the 9 files in translator/ plus the terminator subdirectory it also lists; errors = exactly the 12 PipelineError variants
  • Guards pass on the merged tree
  • cargo oxide run <example> — not applicable

… not exist

`README.md`'s "`terminator/intrinsics/` — GPU Intrinsics" table has 12 rows.
Only 7 name a module that exists; the other 5 were deleted:

  intrinsics/sync.rs      deleted in 6a9a637 (NVIDIA#406)
  intrinsics/cluster.rs   deleted in 6a9a637 (NVIDIA#406)
  intrinsics/tcgen05.rs   deleted in 6a9a637 (NVIDIA#406)
  intrinsics/clc.rs       deleted in 6a9a637 (NVIDIA#406)
  intrinsics/warp.rs      deleted in 4c1d583 (NVIDIA#833)

NVIDIA#406 moved those families onto the catalog path and NVIDIA#833 dropped the last of
them, so all five are handled by `generated.rs` today. Meanwhile eight modules
that do exist had no row: `asm`, `bigint`, `bitops`, `exact_div`,
`float_math`, `iket`, `layout`, `saturating`. Between the two, the table
describes a directory that has not existed for a long time -- and it is the
one place a contributor looks to find where an intrinsic is translated.

The book's `compiler/mir-importer.md` already describes the current model
correctly ("`intrinsics/catalog.json` has its arm generated into
... `generated.rs`", and "the `intrinsics/` modules beside the generated file
hold the cases the ..."), so this README was the last copy still on the old
one. Rewritten to match, one row per file, each description taken verbatim
from that module's own `//!` doc comment. The per-module "GPU" column is
dropped for the reason NVIDIA#964 dropped its equivalent: minimum-SM is a
per-intrinsic property the catalog already records and
`intrinsics/generated-reference.md` already renders.

Two smaller gaps on the same page:

* The `translator/` table was missing `layout`, `location` and
  `payload_store`.
* The Error Types table lists 7 of `PipelineError`'s 12 variants, missing
  `Optimization`, `TargetSelection`, `UnsupportedLinking`,
  `LibdeviceUnavailable` and `InvalidMirPassPipeline`. It also never says
  that `PipelineError` is defined in `cuda-oxide-codegen` and re-exported
  here, nor that the crate's own `TranslationErr` -- `Unsupported`,
  `TypeError`, `InvalidOp` -- is a different, narrower error. Both are now
  stated. (I first read this table against `error.rs` and thought every row
  was fictional; it is not. The variants are real, just defined a crate away.)

Verified by script against the tree, with no ghost and no missing row in any
of the three tables: the intrinsics table is now exactly the 15 files in
`terminator/intrinsics/`; the translator table exactly the 9 files in
`translator/` plus the `terminator` subdirectory it also lists; and the error
table exactly the 12 `PipelineError` variants.

Signed-off-by: Vyncint Ng <[email protected]>
@nihalpasham nihalpasham added documentation Improvements or additions to documentation codegen Device code-generation pipeline (Rust MIR to IR to PTX) intrinsics Device intrinsics and libdevice math mappings labels Aug 18, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator
  • Confirmed the five phantom modules are gone from the tree and re-derived the corrected tables from src/ - every row matches.
  • The tma row's description is copied verbatim from tma.rs, whose own doc comment says "Tensor Memory Access"; one-line source follow-up to make both say Accelerator.

@nihalpasham
nihalpasham merged commit 6460d4e into NVIDIA:main Aug 18, 2026
43 of 44 checks passed
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]>
nihalpasham added a commit that referenced this pull request Aug 21, 2026
* docs(ptx-schedule): the one published crate with no README

`ptx-schedule` arrived with #1065 and is the only publishable crate in the
workspace with neither a `readme` key nor a README.md on disk. Checked across
`cargo metadata`: every other publishable member has both. crates.io renders
that file as the package page, so this one would publish with an empty body.

This is the same gap #981 closed for `ptx-parse`, and the README follows that
one's shape.

Content is taken from the crate rather than from the commit that added it:

- The purpose and the "owns neither CUDA execution nor an input generator"
  boundary come from `lib.rs`'s module header.
- The seven `SiteKind` variants and the eight campaign `RunKind` verdicts are
  each enumerated in full, since a partial list of a closed enum is the thing
  that rots (#978, #1045, #1056).
- `InjectionOptions`' four fields, `DEFAULT_MAX_SLEEP_NS` (64 µs), the
  `nanosleep.u32` insertion, and the `confirm_runs` re-run before a finding is
  reported are all as implemented.
- `cargo oxide fuzz-schedule` is named as the user-facing entry point, with the
  crate's own binary shown for single-file work; the flags in the example come
  from `main.rs`'s usage string.

One detail carried over from #981's review: the License link is absolute rather
than `../../LICENSE`, because crates.io rewrites relative README links against
the repository root and the relative form 404s there.

Verified: `cargo metadata` now reports `readme: README.md` for the crate and
the file resolves; all seven `SiteKind` and eight `RunKind` names appear;
`check-crate-inventory.sh`, `check-spdx-headers.sh` and
`check-book-api-names.sh` pass; no relative `../` links remain.

Signed-off-by: Vyncint Ng <[email protected]>

* docs(ptx-schedule): align the README with the code it describes

Six statements did not match the crate as it stands:

- the execution disclaimer claimed the whole crate owns no CUDA
  execution while campaign.rs two sections down builds, launches,
  watchdogs and assigns verdicts; the section now scopes the claim to
  analyze_ptx/perturb_ptx and points at the campaign layer;
- intensity is a probability dial (0.75 x intensity per site, and it
  scales the drawn sleep lengths), not a fraction of sites touched;
- focus re-weights selection by substring over each site's opcode and
  instruction text (0.95x hits, 0.15x misses); it never restricts the
  sweep to one callable;
- Skipped is assigned only when the example prints a skip marker; a
  zero-injection seed still runs and reports like the baseline;
- findings are reported with their confirmation counts attached, not
  gated on confirmation;
- a seed pins the rewrite, not the schedule the GPU then picks.

Smaller table fixes from the same read of classify_instruction: the
Barrier row now names mbarrier.*, OrderedMemory names the ordering
qualifiers it actually matches (a scope alone never classifies), the
Backedge row describes the conservative same-or-earlier-block test
(no dominance is computed), and the block-index field is called out as
back-edge-only. The injection knobs move into a bulleted list so each
one can state its own semantics.

---------

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

Labels

codegen Device code-generation pipeline (Rust MIR to IR to PTX) documentation Improvements or additions to documentation intrinsics Device intrinsics and libdevice math mappings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants