Repository navigation
Recompiler: validate DXIL containers and split pieces in translated cache - #2540
ramon-victor wants to merge 1 commit into
Conversation
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
|
Tested: current PR head merged onto current
Not tested: retail titles (no title data on this lane, counts only). AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
|
Independent desktop NVIDIA verification of PR #2540 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib translated_cache_rejects_invalid_dxil_and_split_pieces -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1324 filtered out × 3 (0.00s × 3, 0 skipped) |
cargo test --release -p xcl --lib gpu::recomp::pso:: (3 consecutive runs) |
25 passed; 0 failed; 1 ignored; 1299 filtered out × 3 (0.08s, 0.10s, 0.08s, 0 skipped) |
cargo build --release -p xcl |
Clean build (1m 13s, exit 0, 0 new warnings) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact parent & merge-base (e1d84b7d9153f86a97d2ec5d209d196046fc0bea, cached baseline on the same machine):
xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1531 (PresentX 1531)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13982 MB
PR #2540 (f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49):
xcl-smoke v1
commit: f5cb7eaa1c54b3ab321bf1f3c026826008dfeb49
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1587 (PresentX 1587)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14018 MB
Runtime log observations (xcl.log)
9222log lines,0[ERROR]/ device-removal / panic lines.- Final draw/memory telemetry in log:
19438 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14018 MB committed by the process; video memory 6116 MB local, 4683 MB non-local.
Limits of coverage
- Rejection of invalid DXIL containers and malformed split pieces on translated-cache load was verified via
translated_cache_rejects_invalid_dxil_and_split_pieces(3/3) andgpu::recomp::pso::(25/0/1× 3). - The 60 s retail smoke ran against our intact warm shader cache on
title: 29640639, confirming zero false rejections or runtime regression (frame-count and commit deltas vs. cached parent reflect single-run startup variance, not this PR).
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
|
merge-check Test-only diff against the #2540 + current-main trial mergediff --git a/crates/xcl/src/gpu/recomp/pso.rs b/crates/xcl/src/gpu/recomp/pso.rs
index 4cc5aff6..e6e124e0 100644
--- a/crates/xcl/src/gpu/recomp/pso.rs
+++ b/crates/xcl/src/gpu/recomp/pso.rs
@@ -2707,7 +2707,7 @@
// write neither `.bin` nor `.err`, and allow a valid translation afterward.
let blob1 = b"console-bad-whole-dxil";
let err = translated::cached_rerouted(&dir, ident, 7, blob1, Stage::Compute, 0, 1, false, || {
- Ok((Compiled { dxil: bad_bytes.clone(), samplers: Vec::new(), dispatch_chain: None }, true))
+ Ok((Compiled { dxil: bad_bytes.clone(), samplers: Vec::new(), dispatch_chain: None, dispatch_remap: None }, true))
})
.err()
.expect("cached_rerouted must reject invalid whole DXIL");
@@ -2728,7 +2728,7 @@
for (i, chain) in bad_chains.into_iter().enumerate() {
let blob = format!("console-bad-chain-{i}");
let err = translated::cached_rerouted(&dir, ident, 7, blob.as_bytes(), Stage::Compute, 0, 1, false, || {
- Ok((Compiled { dxil: valid_piece.clone(), samplers: Vec::new(), dispatch_chain: Some(std::sync::Arc::new(chain)) }, true))
+ Ok((Compiled { dxil: valid_piece.clone(), samplers: Vec::new(), dispatch_chain: Some(std::sync::Arc::new(chain)), dispatch_remap: None }, true))
})
.err()
.expect("cached_rerouted must reject invalid dispatch_chain");
@@ -2749,6 +2749,7 @@
dispatch_chain: Some(std::sync::Arc::new(crate::gpu::dxil::kernel::DispatchChain {
dwords_per_group: 4,
pieces: vec![valid_piece.clone(), bad_bytes.clone()],
})),
+ dispatch_remap: None,
};
translated::store_in(&path_store, ident, blob_store, &bad_compiled);
assert!(!path_store.exists(), "store_in must refuse to write invalid dispatch_chain pieces");
@@ -2763,6 +2764,7 @@
dispatch_chain: Some(std::sync::Arc::new(crate::gpu::dxil::kernel::DispatchChain {
dwords_per_group: 8,
pieces: vec![valid_piece.clone(), compiled(22).dxil],
})),
+ dispatch_remap: None,
};
let r1 = translated::cached_rerouted(&dir, ident, 7, blob_ok, Stage::Compute, 0, 1, false, || Ok((good.clone(), true))).unwrap();
let r2 = translated::cached_rerouted(&dir, ident, 7, blob_ok, Stage::Compute, 0, 1, false, || panic!("must hit cache")).unwrap();performance: reasoned only. Validation reads DXIL container headers/chunk ranges on enabled-cache misses and valid cold writes; warm cache hits add no new check. No frame-time or memory benchmark was run. |
|
merge-check claim |
|
merge-check |
|
#2535 made the same change (#2463 item 3: container checks in AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
Enforces DXIL container and split
dispatch_chainvalidation intranslated::cached_rerouted,translated::cached_in, andtranslated::store_in, matching the invariants already enforced bytranslated::load_in.Previously, the production path
translated::cached_reroutedskippeddxc::valid_dxil_container(&c.dxil)(unlike the test-onlycached_in), and none ofstore_in,cached_in, orcached_reroutedvalidatedc.dispatch_chain(dwords_per_group > 0,pieces.len() >= 2, andvalid_dxil_container(piece)for every piece). A corrupt or truncated whole container or split piece could therefore be returned directly to D3D12 and persisted to disk (whereload_inlater rejected it).Part of #2463 (specifically item 3's container/piece validation;
direct_output()already trackscompact_nest_tag()onmain).What is in it
crates/xcl/src/gpu/recomp/pso.rs:translated::valid_compiled(c: &Compiled) -> boolverifyingdxc::valid_dxil_container(&c.dxil)and, whendispatch_chainisSome,dwords_per_group > 0,pieces.len() >= 2, andvalid_dxil_containeron every piece.valid_compiledinstore_in,cached_in, andcached_rerouted(returning an error without writing.binor a permanent.errmarker when validation fails).shader_cache_tests::translated_cache_rejects_invalid_dxil_and_split_piecescovering invalid whole DXIL incached_rerouted, malformeddispatch_chaincases (bad piece bytes,< 2pieces,0dwords per group) acrosscached_rerouted,cached_in, andstore_in, plus a valid 2-piece round-trip.Tested
621.24, wave32), AMD Ryzen 7 5700X, 32 GiB RAM, Windows 11 Pro (26300),rustc 1.99.0(x86_64-pc-windows-msvc), DXC/DXIL1.8.2502.11(Windows SDK10.0.26100.0).cargo test -p xcl --lib translated_cache_rejects_invalid_dxil_and_split_pieces -- --nocapturefailed (0 passed, 1 failed:cached_rerouted must reject invalid whole DXIL).cargo test -p xcl --lib gpu::recomp::pso:: -- --test-threads=1:25 passed, 0 failed, 1 ignored(repeated_pso_shader_compilebenchmark)..\scripts\test.ps1, debug):1424 passed, 0 failed, 46 ignored(skipped on this adapter: wave64-only GPU tests, unsupported per-lane semantics variants,no heap windows).cargo build --release -p xcl) and clean 60 s retail smoke run (.\scripts\smoke.ps1).Regression run
Baseline (
main):PR (
f5cb7ea):Not tested
translated::cached_rerouted,cached_in, andstore_in).AI use
main, implementedvalid_compiledacrossstore_in/cached_in/cached_reroutedand its failing-first unit tests, ran.\scripts\test.ps1, release build, and the 60 ssmoke.ps1run, and drafted this PR description.