Skip to content

docs(dialect-mir): the crate README's type and operation tables are behind the code - #965

Merged
nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:docs/dialect-mir-readme-inventory
Aug 17, 2026
Merged

nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:docs/dialect-mir-readme-inventory

Conversation

@vyncint

@vyncint vyncint commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Both inventories in crates/dialect-mir/README.md are hand-maintained and nothing checks them. Counts recomputed from the tree at a766fc26.

Types: "seven" → nine

Two types have #[pliron_type(...)] declarations in src/types.rs and no row:

Operations: 55 across 11 modules → 62 across 12

Module README Tree Missing
control_flow 5 6 unroll_hint
memory 9 11 memcpy, memmove
comparison 6 7 cmp
aggregate 8 10 construct_slice, construct_disjoint_slice
debug — 1 dbg_value — no row at all

The header now says "one row per file in src/ops/", since that is the invariant that makes the table checkable at a glance.

Note on the neighbouring PR

The book keeps a second copy of this same operation inventory in cuda-oxide-book/compiler/mlir-dialects.md. It is stale too, and by a different amount — it says 54 where this file says 55, because it never picked up set_discriminant which this one already had. Two hand-kept copies drifting apart at different rates is the argument for reading src/ops/ rather than trusting either. That file is fixed separately; the two changes share no files, and each stands alone.

Testing

Local, no GPU.

  • Every row recomputed from src/types.rs and src/ops/; both tables now match the tree exactly (9/9 types, 62 ops across 12 modules, per-module counts all equal)
  • check-crate-inventory.sh and check-toolchain-parity.sh pass
  • cargo oxide run <example> — not applicable, documentation only

…ehind the code

Both inventories in `crates/dialect-mir/README.md` are hand-maintained and
nothing checks them. Counts below are from the tree at a766fc2.

**Types: "seven" -> nine.** Two types have `#[pliron_type(...)]`
declarations in `src/types.rs` and no row: `MirUnionType` and `MirFP16Type`.
`MirUnionType` is not a corner: NVIDIA#857 and NVIDIA#927 are both about union constants,
so a reader who came to this README to understand that work found no mention
of the type carrying it.

**Operations: 55 across 11 modules -> 62 across 12.** Five modules are short
and one is missing outright:

  control_flow   5 -> 6    unroll_hint
  memory         9 -> 11   memcpy, memmove
  comparison     6 -> 7    cmp
  aggregate      8 -> 10   construct_slice, construct_disjoint_slice
  debug          - -> 1    dbg_value, no row at all

The `Ops` column and the header now agree with `src/ops/`, and the header
says so, since one row per file in that directory is the invariant that
makes the table checkable at a glance.

The book keeps a second copy of this same operation inventory in
`cuda-oxide-book/compiler/mlir-dialects.md`. It is stale too, and by a
different amount -- it says 54 where this file says 55, because it never
picked up `set_discriminant` which this one already had. Two hand-kept
copies drifting apart at different rates is the argument for reading
`src/ops/` rather than either. That file is fixed separately; there is no
overlap between the two changes.

Verified: every row recomputed from `src/types.rs` and `src/ops/`, both
tables now match exactly; check-crate-inventory and check-toolchain-parity
pass.

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) labels Aug 17, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator

Re-derived both tables from git objects at a766fc2:

  • every cell matches, all seven new op names exist verbatim,
  • and the one-row-per-module rule in the header makes the next recount a ten-second job.

Merging.

@nihalpasham
nihalpasham merged commit e11eb76 into NVIDIA:main Aug 17, 2026
44 checks passed
nihalpasham pushed a commit that referenced this pull request Aug 18, 2026
…alves #965 missed (#972)

#965 corrected this README's type and operation tables. It left the other two
inventories on the same page, and both are stale in the same way -- one of them
now contradicting the tables #965 just fixed.

**Attributes: "four" -> seven.** `src/attributes.rs` has seven
`#[pliron_attr(...)]` declarations; the table lists four. The three missing
ones are all recent, and two pair directly with ops the README already lists:

  mir.fp16_attr               MirFP16Attr                `f16` constant values,
                                                         paired with MirFP16Type
  mir.unroll                  UnrollAttr                 the factor carried by
                                                         `mir.unroll_hint`
  mir.compiler_result_bundle  CompilerResultBundleAttr    the multi-result return
                                                         ABI marker from #888

`mir.unroll` is the clearest case: #965 added `mir.unroll_hint` to the
operations table, and the attribute that op exists to carry was three rows
below, undocumented.

**Source Layout tree.** It contradicts the page above it:

  types.rs        "# 7 MIR types"      -- the Types table now says nine
  attributes.rs   "# 4 ... attributes" -- see above
  ops/            no `debug.rs`        -- the Operations table now lists it
  src/            no `const_fold.rs`, `rust_intrinsics.rs`, `side_effects.rs`

So a reader who trusted the tree came away with different numbers than a reader
who trusted the tables, on one page. Three module comments were also narrower
than their files (`control_flow` also carries unroll hints, `memory` also
`memcpy`/`memmove`, `aggregate` also slices) -- all ops #965 added to the table
without the tree following.

Both inventories now state the rule that makes them checkable, as the
operations table does: one row per `#[pliron_attr(...)]`, one tree entry per
file.

Verified by script against the tree: the attributes table matches all seven
`(name, Rust type)` pairs exactly -- `MirCastKindAttr` is a `pub enum`, the
rest are `pub struct` -- and the Source Layout tree matches `src/*.rs` plus
`src/ops/*.rs` exactly, 19 files listed and 19 on disk, none missing and none
invented. check-crate-inventory passes.

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

codegen Device code-generation pipeline (Rust MIR to IR to PTX) documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants