Repository navigation
Conversation
…in direct DXIL bitcode Compute transitive reachability over globals, function declarations, and module constants from live blocks and metadata before numbering values in Module::write_bitcode. Drop dead constants from BLOCK_CONSTANTS via a compacted value-id map, ignore unreachable Op::Phi incoming edges when seeding roots, and only trace ConstDef::Aggregate elements and global initializers once their owning constant or global is reachable. Part of xcl-dev#2508 Part of xcl-dev#1833
|
Native wave64 run (the wave64 tests skipped on the RTX 4060) on an AMD RX 9070 XT, plus an RTX 3060: the 3 new tests pass, and nothing else changes in the direct-DXIL GPU suite. Head
On both cards, the only result changes against Not tested: cold-cache rebuild timings, the D3D12 debug-layer tests (no |
Compute transitive liveness for globals, declarations, and module constants from reachable instructions and metadata. Trace only live global initializers and aggregate elements, then compact the constant block through a stable old-to-new value map. This removes dead constants and prevents an unreachable aggregate from retaining otherwise-unused internal symbols while preserving idempotent serialization and reachable Phi semantics. GNU Windows-target cargo check passed here. Upstream validation includes native AMD wave64 and NVIDIA direct-DXIL GPU suites; Windows/MSVC and GPU execution were not repeated on this host. Adapted from PR xcl-dev#2640. Assisted-by: Google Antigravity (Gemini 4 Neon) Assisted-by: Codex (GPT-5.6-sol)
Compute transitive liveness for globals, declarations, and module constants from reachable instructions and metadata. Trace only live global initializers and aggregate elements, then compact the constant block through a stable old-to-new value map. This removes dead constants and prevents an unreachable aggregate from retaining otherwise-unused internal symbols while preserving idempotent serialization and reachable Phi semantics. GNU Windows-target cargo check passed here. Upstream validation includes native AMD wave64 and NVIDIA direct-DXIL GPU suites; Windows/MSVC and GPU execution were not repeated on this host. Adapted from PR xcl-dev#2640. Assisted-by: Google Antigravity (Gemini 4 Neon) Assisted-by: Codex (GPT-5.6-sol)
Compute transitive liveness for globals, declarations, and module constants from reachable instructions and metadata. Trace only live global initializers and aggregate elements, then compact the constant block through a stable old-to-new value map. This removes dead constants and prevents an unreachable aggregate from retaining otherwise-unused internal symbols while preserving idempotent serialization and reachable Phi semantics. GNU Windows-target cargo check passed here. Upstream validation includes native AMD wave64 and NVIDIA direct-DXIL GPU suites; Windows/MSVC and GPU execution were not repeated on this host. Adapted from PR xcl-dev#2640. Assisted-by: Google Antigravity (Gemini 4 Neon) Assisted-by: Codex (GPT-5.6-sol)
Compute transitive liveness for globals, declarations, and module constants from reachable instructions and metadata. Trace only live global initializers and aggregate elements, then compact the constant block through a stable old-to-new value map. This removes dead constants and prevents an unreachable aggregate from retaining otherwise-unused internal symbols while preserving idempotent serialization and reachable Phi semantics. GNU Windows-target cargo check passed here. Upstream validation includes native AMD wave64 and NVIDIA direct-DXIL GPU suites; Windows/MSVC and GPU execution were not repeated on this host. Adapted from PR xcl-dev#2640. Assisted-by: Google Antigravity (Gemini 4 Neon) Assisted-by: Codex (GPT-5.6-sol) Assisted-by: Codex (GPT-5.6-sol)
Compute transitive liveness for globals, declarations, and module constants from reachable instructions and metadata. Trace only live global initializers and aggregate elements, then compact the constant block through a stable old-to-new value map. This removes dead constants and prevents an unreachable aggregate from retaining otherwise-unused internal symbols while preserving idempotent serialization and reachable Phi semantics. GNU Windows-target cargo check passed here. Upstream validation includes native AMD wave64 and NVIDIA direct-DXIL GPU suites; Windows/MSVC and GPU execution were not repeated on this host. Adapted from PR #2640. Assisted-by: Google Antigravity (Gemini 4 Neon) Assisted-by: Codex (GPT-5.6-sol) Assisted-by: Codex (GPT-5.6-sol)
|
merge-check |
|
merge-check claim |
|
merge-check |
|
main has this change. Commit 09a65d6 ("Recompiler: prune unreachable direct-DXIL module values") says it was adapted from this PR. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
Closing as superseded: this change is already on Two independent checks found this: Foniass's close list on #1607 and ours against current AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents. |
What is in it
Prunes unused module constants and fixes dead-aggregate global/function retention during direct DXIL bitcode serialization in
crates/xcl/src/gpu/dxil/module.rs:Module::live_values): Computes(gused, fused, cused)over reachable blocks (order) and metadata (MdDef::Val), seedingOp::Callcallees + args, only reachable incoming edges ofOp::Phi(matchingwrite_inst), and all otherOp::for_each_operandoperands. TracesGlobalDef::initandConstDef::Aggregateelements only once the owning global or constant is marked live.write_bitcodescanned everyConstDef::Aggregateinself.consts, so an unreferenced aggregate referencing an otherwise-unused internal global or function kept that declaration alive in the emitted module.BLOCK_CONSTANTSwithout mutatingModule: Buildscmap: Vec<Option<u64>>in original constant order (preservingelem_idx < agg_idxordering forCST_CODE_AGGREGATE), mapsValue::Const(c)throughconst_base + cmap[c], omitsBLOCK_CONSTANTSwhenn_consts == 0, and emits onlycusedentries while keepingwrite_bitcodeidempotent.Part of #2508
Part of #1833
Tested
live_valuessemantics (cargo test --release -p xcl --lib "gpu::dxil::module::tests::" -- --test-threads=1 --nocapture):3 passed; 2 failed; 0 ignored:unused_scalar_constants_produce_identical_bitcodefailed (dead constant 3 retained)dead_aggregate_does_not_retain_unused_global_while_live_global_init_is_keptfailed (unexpected global liveness: [true, true, false], confirmingdead_aggretainedg_dead_inner)XCL_ADAPTER=warp,XCL_WARP=1,cargo test --release -p xcl --lib "gpu::dxil::module::tests::" -- --test-threads=1 --nocapture):5 passed; 0 failed; 0 ignored; 0 skipped(0.01s, DXC1.9.2609.5validated and disassembled the pruned shader container; zero warnings inmodule.rs).cargo test --release -p xcl --lib "gpu::dxil::" -- --test-threads=1 --nocapture):187 passed; 0 failed; 3 ignored(36.91s,gpu::dxil::module::tests::5/0/0,0skipped;1pre-existingSKIPPED:gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole: no wave64).Regression run
Full release workspace on RTX 4060 (
cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture):37test binaries,1438 passed; 0 failed; 47 ignored,29pre-existing environment-gatedSKIPPEDlines:21skipped:no wave64(RTX 4060 is wave32)3skipped: wave32per-lane form: refusedby driver (f16 arithmetic,f16 packed,f32 conversions)3skipped: no D3D12 debug layer (d3d12SDKLayers.dllunavailable on host: debug-layerdred: false/trueanduploads_start_from_each_subresources_state)1skipped:pso_measurement_compiles_an_exact_synthetic_record(cannot disable driver cache on Windows)1skipped:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)Paired 60 s RTX 4060 smoke capture (
scripts/smoke.ps1):Base (
origin/mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7):PR (
b7cfe9b224f31ddf6ba06c2d614bc446132b6062):Not tested
29host-gated workspace tests skipped on this RTX 4060 machine (wave64 hardware, wave32 per-lane driver support, D3D12 SDK debug layer, driver cache disable, and heap windows).AI use
Google Antigravity (Gemini 4 Neon) wrote the patch, unit tests, and PR description; all commands, test runs, and paired 60 s GPU smoke captures were executed directly in this workspace.