Repository navigation
Conversation
…gs (xcl-dev#2088) Part of xcl-dev#2088 Restrict bitcode declaration compaction/canonicalization to split compute dispatch pieces (Module::try_to_canonical_bitcode + Shader::finish_optimized_canonical) so unsplit graphics and whole compute shaders preserve exact upstream bitcode while semantically identical pieces share identical DXIL containers and driver cache keys. Additionally prune statically unreferenced dx.resources / PSV0 bindings in each piece when all dx.op.createHandleFromBinding calls use constant ResBind operands, preserving dynamic indexing, wave64 metadata, NaN/-0.0 bit patterns, and static sampler register mappings. Co-Authored-By: Gemini 4 Hydrogen <noreply@antigravity.dev>
|
Tested on \dfead3702a1e8c3b6b30afeccf51efc1e885b10b\ (\dfead370, clean PR head):
Not tested
AI use
|
Prime1997
left a comment
There was a problem hiding this comment.
Read-through and GPU run of dfead37. An AI tool (Claude Code) helped with the reading and ran the tests; each point below was checked against the code at this head.
Test results (RTX 3060 Ti 8 GB, NVIDIA 617.14 / 32.0.16.1714, i5-10400, Windows 11 26200.9974, rustc 1.100.0, DXC 1.9.2609.5, debug, isolated cache and data roots):
cargo test --lib gpu::dxil:: -- --test-threads=4: 189 passed, 0 failed, 3 ignored. One test reported SKIPPED (dispatch_chain_native_wave64_builds_whole, this card has no wave64). The GPU halves of the tests ran.
Points for the author
- The
.chain.psoname does not include the root signature or static samplers, and pruning now makes the pieces sampler-agnostic. I could not confirm how a driver reacts when a cached blob made under one sampler set is offered to a pipeline with another. If the answer is "it refuses and we rebuild", that is fine, but it would be good to have a test that shows it, or the sampler set in the name. - Every existing piece blob goes cold once after this change, because the canonical form changes the hash. Expected, but worth saying in the description so people do not report the one-time rebuild as a regression.
- The description gives the counts after the change (for example 90 pieces to 32 unique builds) and the DXIL size before and after, but not the unique-pipeline count for the same corpus on main, and no compile time. That one comparison would make the benefit reviewable.
- Nit: the canonical writer gains several
expect()calls. As far as I can tell a panic there comes back as anErrfrom the translator thread'sjoinrather than taking the process down, but returning the error directly would be clearer. - A few of the new tests assert less than their names promise. Worth a pass to make each one fail when the behaviour in its name is removed.
I did not find a defect. The reach looks narrow (only programs that are actually split), so points 1 and 3 are what I would want answered before this leaves draft.
Generated by Claude Code
Canonicalizes DXIL bitcode emission and prunes statically unused resource bindings on split compute dispatch-chain pieces so semantically identical pieces share identical DXIL containers and driver cache keys.
Part of #2088.
What is in it
crates/xcl/src/gpu/dxil/module.rs: deterministic canonical bitcode emission (Module::try_to_canonical_bitcode,BitcodePlan,PlanWalker) scoped to split compute pieces without altering unsplit compute or graphics bitcode.crates/xcl/src/gpu/dxil/shader.rs:Shader::finish_optimized_canonicalandShader::prune_unused_bindings.crates/xcl/src/gpu/dxil/module/split.rsandcrates/xcl/src/gpu/dxil/graphics_tests.rs: piece-local static binding pruning inmake_pieceplus determinism, dynamic indexing,Phi/undef, NaN/-0.0, and GPU parity tests.Tested
32.0.16.1656),rustc 1.98.1.cargo build --locked --workspace -j 2: passed (0errors).cargo test --locked -j 2 -p xcl --lib gpu::dxil:: -- --test-threads=1:189 passed; 0 failed; 3 ignored(34.89s;SKIPPED gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole: no wave64, ignoreddump_dxc_lowering,amd_reduced_seeds,debug_seed).cargo test --locked -j 2 -p xcl --test gpu_compute_e2e -- --test-threads=1:7 passed; 0 failed; 0 ignored(8.05s;SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows).cargo test --locked -j 2 -p xcl --test e2e -- --test-threads=1:4 passed; 0 failed; 0 ignored(11.89s).git diff --check b49be183..dfead370: passed (0errors).b49be183vsdfead370, 28 compute units / 50 split pieces / 33 unique PSOs, 3 alternating trials per arm):0validation failures across all trials; total serialized piece DXIL dropped from6,353,292 Bto6,238,132 B(-1.81%).90pieces ->32unique PSO builds,58cache hits,0validation failures) and 30 captured compute units (52pieces ->35unique PSO builds,17cache hits,0validation failures).Regression run
scripts/smoke.ps1execution on an unpacked retail build and full non-DXIL workspace test sweep before marking ready for review.Not tested
cargo test --workspaceondfead370(DXIL library,gpu_compute_e2e, ande2everified above), pairedscripts/smoke.ps1(no retail title directory on this machine), AMD / Intel hardware, Linux / Wine.AI use
Gemini); assisted with implementation, tests, benchmark validation, and PR preparation under author direction.