Repository navigation
docs(dialect-mir): the crate README's type and operation tables are behind the code - #965
Merged
nihalpasham merged 1 commit intoAug 17, 2026
Conversation
…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]>
Collaborator
|
Re-derived both tables from git objects at a766fc2:
Merging. |
nihalpasham
approved these changes
Aug 17, 2026
3 of 4 tasks
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]>
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.
Summary
Both inventories in
crates/dialect-mir/README.mdare hand-maintained and nothing checks them. Counts recomputed from the tree ata766fc26.Types: "seven" → nine
Two types have
#[pliron_type(...)]declarations insrc/types.rsand no row:MirUnionType— Rust unions, every field a view of the same bytes. Not a corner case: fix(mir-importer): materialize initialized union constants #857 and fix(mir-importer): preserve provenance in thin-pointer union constants #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.MirFP16Type— IEEE 754 binary16, Rust'sf16.Operations: 55 across 11 modules → 62 across 12
control_flowunroll_hintmemorymemcpy,memmovecomparisoncmpaggregateconstruct_slice,construct_disjoint_slicedebugdbg_value— no row at allThe 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 upset_discriminantwhich this one already had. Two hand-kept copies drifting apart at different rates is the argument for readingsrc/ops/rather than trusting either. That file is fixed separately; the two changes share no files, and each stands alone.Testing
Local, no GPU.
src/types.rsandsrc/ops/; both tables now match the tree exactly (9/9 types, 62 ops across 12 modules, per-module counts all equal)check-crate-inventory.shandcheck-toolchain-parity.shpasscargo oxide run <example>— not applicable, documentation only