Skip to content

deps: bump pliron to master 0d3f25df (eager block-arg conversion, explicit std feature) - #593

Merged
nihalpasham merged 8 commits into
mainfrom
pliron-master-port
Jul 30, 2026
Merged

nihalpasham merged 8 commits into
mainfrom
pliron-master-port

Conversation

@nihalpasham

Copy link
Copy Markdown
Collaborator

Bumps the pliron pin from 222dd962 to 0d3f25df (latest master). That picks up everything since the old pin, including two changes that needed fixes on our side: pliron#182 (DialectConversion now converts all block arguments eagerly, before any rewrite runs) and pliron#191 (pliron-llvm is no_std by default; std is an explicit feature).

The #182 fix: recover repr(align) from the conversion history, not from live types.

Our alignment stamping used to read block-argument types during the FuncOp rewrite to recover repr(align(N)) on aggregates. Under #182 those types are already converted to LLVM types by the time any rewrite runs, so the scan stopped seeing the MIR aggregates:

#[repr(align(16))] struct Vec4([f32; 4]);

before the fix: the kernel's entry spill store of a Vec4 argument
                degrades from `store ... align 16` to `align 4`
after the fix:  `align 16` is preserved
  • store/ref converters now recover the ABI alignment at their own rewrite, from the OperandsInfo conversion history (current type first, then the newest recorded MIR-aggregate type)
  • load/alloca read their own result types
  • no pre-pass anywhere; this is the history-lookup approach suggested upstream
  • new example repr_align_block_args is the regression guard

The #191 fix:

  • pliron-llvm = { ..., default-features = false, features = ["std"] }, mirrored in the root and rustc-codegen-cuda manifests (which must stay on the same rev)

Rider:

  • device_ffi_test's build script aborted under set -e when an nvvm-dis older than the CUDA toolkit could not parse newer LTOIR; the text dump is inspection-only, so it is now best-effort, exactly like the small_type_ffi_test / mathdx_ffi_test siblings

Validation:

  • 75/75 workspace test suites
  • full GPU smoketest 178/178 (RTX 5090, CC 12.0)
  • per-example IR compared against the old pin: content-identical; the only differences are path/order-dependent surface forms (mangled-name hashes, function emission order, __shared_mem_N numbering)

…PR 182/191 testing)

EXPERIMENTAL BRANCH - do not merge as-is. The workspace and
rustc-codegen-cuda manifests carry a TEMPORARY [patch] section pointing
pliron/pliron-derive/pliron-llvm at the local clone ~/dev/pliron so
upstream PRs can be tested by switching branches there.

Port to pliron master (4159dc0, 52 commits past our 222dd962 pin):
- Type::register_instance -> Type::instantiate (renamed upstream)
- drop unused get_existing() wrappers (Type::get_instance removed upstream)
- DialectName::new -> DialectName::try_new
- pliron::pass_manager::AnalysisManager -> pliron::pass::AnalysisManager

Timing-robust alignment stamping (found while testing pliron PR #182,
"[DialectConversion] Convert all block args, not just used ones"):
stamp_memory_op_alignment ran inside the MirFuncOp rewrite and read live
operand types to recover repr(align(N)) ABI alignment. That relied on
the old driver's lazy block-arg conversion; PR #182 converts all block
args before the first rewrite, so stores/refs of block args (params,
mem2reg join/loop args) silently lost their alignment stamp (probe
showed the Al16 entry spill store degrade from align 16 to align 4).
Hoist the stamping to a whole-module pre-pass before
apply_dialect_conversion, next to the dynamic-smem pre-pass, making it
independent of conversion order under both old and new drivers.

New example pr182_probe: over-aligned aggregates in block-arg positions
(entry spill of a by-value repr(align(16)) param, mem2reg join struct,
loop-carried tuple, dead params). Its .ll is byte-identical between
pliron master and PR #182 with this fix.

Validation (pliron clone on master and on pr-182, RTX 5090 / CC 12.0):
cargo test --workspace 2992 passed, 0 failed; smoketest 171/171.
pliron PR #191 makes pliron-llvm (without llvm-sys) no_std and gates
its std support behind a new `std` feature. Our default-features =
false dependency (which exists to keep llvm-sys out) must now request
std explicitly. Note: cuda-oxide happens to build on PR #191 even
without this, because our direct pliron dependency unifies pliron/std
into the graph, but relying on that is fragile; declare the intent.

This commit only resolves when the patched pliron-llvm has the std
feature (pliron clone on pr-191); keep it at the branch tip until the
PR lands upstream.

Validation (pliron clone on pr-191): cargo test --workspace 2992
passed, 0 failed; smoketest 171/171.
Per upstream guidance (Vaivaswatha, on pliron PR #182): the dialect
conversion driver records every value type change it makes, and hands
each rewrite an OperandsInfo carrying the full pre-conversion type
history of its operands. That is the intended way to read source-dialect
types late, so use it instead of stamping alignment in a module pre-pass
before conversion starts.

- mir.store / mir.ref: recover the stored/referenced value's ABI
  alignment via value_abi_align (current type first, then the operand's
  recorded history, newest first) at the op's own rewrite.
- mir.load / mir.alloca: read their own result types, which the driver
  never converts ahead of the op's rewrite.
- Delete stamp_module_memory_op_alignments / stamp_memory_op_alignment
  and the copy_alignment attribute round-trip. Net -59 lines.

Equivalence and validation (RTX 5090 / CC 12.0):
- pr182_probe .ll byte-identical to the pre-pass fix on pliron master.
- All 312 .ll artifacts across all 171 examples byte-identical between
  the pre-pass fix and this fix on pliron pr-182 (full-run comparison).
- cargo test --workspace 2992 passed, 0 failed on pr-182 and pr-191.
- smoketest 171/171 on pr-182 and pr-191.
The example guards a durable compiler invariant, not a one-off PR test:
repr(align(N)) ABI alignment must survive dialect conversion for values
in block-arg positions (function params, mem2reg join/loop args), where
the conversion driver may replace MIR types before any per-op rewrite
runs. Name it for what it checks. Docs reframed the same way; the
pliron PR #182 origin stays as context.
Picks up DialectConversion converting all block args (pliron#182),
no_std pliron-llvm behind an explicit std feature (pliron#191),
BytesAttr global initializers (pliron#198), and the conversion-trait
renames (pliron#201). The repr(align) recovery already reads the
OperandsInfo conversion history at rewrite time, so no pre-pass is
needed under the eager block-arg conversion.
An nvvm-dis older than the CUDA toolkit cannot parse newer LTOIR, and
under set -e the inspection failure aborted the whole build. Guard it
exactly like the small_type_ffi_test and mathdx_ffi_test siblings
already do: the binary LTOIR is the consumed artifact, the text dump
is debugging aid only.
@nihalpasham nihalpasham added build-related Build scripts, toolchain discovery, or compilation setup refactor Internal restructuring with no behavior change IR-lowering Lowering between dialects (dialect-mir to LLVM dialect) labels Jul 30, 2026
The repr_align_block_args example and one blank line in dialect-mir
predate the fmt gate; the rustc-codegen-cuda Cargo.lock still recorded
pliron as a path dependency left over from the removed local-clone
patch, and now records the pinned git source.
@nihalpasham
nihalpasham merged commit bead880 into main Jul 30, 2026
33 checks passed
vyncint added a commit to vyncint/cuda-oxide that referenced this pull request Aug 1, 2026
`dependency-licenses.csv` recorded `pliron` and `pliron-derive` as 0.12.0 from
crates.io. NVIDIA#593 moved them to 0.16.0 at git revision 0d3f25df and did not update
the CSV; `pliron-llvm`, a third crate from the same pin, was never recorded at
all. The upstream org also moved, so the listed repository URL
(`github.com/vaivaswatha/pliron`) no longer matches either.

CONTRIBUTING makes the file a contributor obligation ("If adding a new
dependency, update `dependency-licenses.csv` accordingly"), but nothing reads it:

    $ grep -rn "dependency-licenses" .github/workflows/ Justfile scripts/
    $

`cargo-deny` checks license policy against `deny.toml`; it does not verify this
CSV against the dependency graph. So the drift was invisible.

It matters more than an ordinary version bump because the source *kind* changed.
A license-provenance file claiming a dependency came from crates.io at 0.12.0,
when it is a pinned git revision of 0.16.0 under a different org, is wrong in the
fields the file exists to record. These three are the only git dependencies in
the lockfile -- every other row is a registry source -- so `3rd Party (git)`
distinguishes them rather than overloading `3rd Party (crates.io)`.

Version, source, and repository URL are taken from `Cargo.lock` and
`cargo metadata`; all three crates remain Apache-2.0. The file uses CRLF endings,
which this change preserves, so the diff is three lines.

Deliberately not included: eight further direct dependencies have no row
(`clap`, `futures`, `object`, `serde`, `serde_json`, `sha2`, `toml`, `trybuild`)
and `libmathdx-sys` is listed but absent from the graph. The CSV already carries
transitive packages, so its intended scope is broader than direct dependencies,
and which omissions are deliberate curation is not something the file records.
Noted on the issue for a maintainer decision rather than guessed at here.

Fixes NVIDIA#630

Signed-off-by: Vyncint Ng <[email protected]>
nihalpasham pushed a commit that referenced this pull request Aug 2, 2026
`dependency-licenses.csv` recorded `pliron` and `pliron-derive` as 0.12.0 from
crates.io. #593 moved them to 0.16.0 at git revision 0d3f25df and did not update
the CSV; `pliron-llvm`, a third crate from the same pin, was never recorded at
all. The upstream org also moved, so the listed repository URL
(`github.com/vaivaswatha/pliron`) no longer matches either.

CONTRIBUTING makes the file a contributor obligation ("If adding a new
dependency, update `dependency-licenses.csv` accordingly"), but nothing reads it:

    $ grep -rn "dependency-licenses" .github/workflows/ Justfile scripts/
    $

`cargo-deny` checks license policy against `deny.toml`; it does not verify this
CSV against the dependency graph. So the drift was invisible.

It matters more than an ordinary version bump because the source *kind* changed.
A license-provenance file claiming a dependency came from crates.io at 0.12.0,
when it is a pinned git revision of 0.16.0 under a different org, is wrong in the
fields the file exists to record. These three are the only git dependencies in
the lockfile -- every other row is a registry source -- so `3rd Party (git)`
distinguishes them rather than overloading `3rd Party (crates.io)`.

Version, source, and repository URL are taken from `Cargo.lock` and
`cargo metadata`; all three crates remain Apache-2.0. The file uses CRLF endings,
which this change preserves, so the diff is three lines.

Deliberately not included: eight further direct dependencies have no row
(`clap`, `futures`, `object`, `serde`, `serde_json`, `sha2`, `toml`, `trybuild`)
and `libmathdx-sys` is listed but absent from the graph. The CSV already carries
transitive packages, so its intended scope is broader than direct dependencies,
and which omissions are deliberate curation is not something the file records.
Noted on the issue for a maintainer decision rather than guessed at here.

Fixes #630

Signed-off-by: Vyncint Ng <[email protected]>
@nihalpasham
nihalpasham deleted the pliron-master-port branch September 5, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-related Build scripts, toolchain discovery, or compilation setup IR-lowering Lowering between dialects (dialect-mir to LLVM dialect) refactor Internal restructuring with no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant