Shaders: identify direct translation artifacts in dump manifests #2553
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2553
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2553"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@mokkamokacaffe on GitHub · 2026-11-25 22:45 UTC · original
mokkamokacaffe:diagnostics/dxil-dump-identity→main· +223 −5 · 3 files · 4 commits · draftPart of #2541.
What is in it
xcl shaders --direct --dump <dir>writes a versioned.manifest.jsonbeside each program'sguest.binanddirect.dxilordirect.err.txt. The files share a prefix so a report can be matched to its artifacts.scripts/verify_shader_dump.pyverifies saved bundles without the source shader pack or a GPU: it recomputes the guest/DXIL FNV-1a hashes or compares rejected-translation diagnostic bytes exactly.scripts/test_verify_shader_dump.pycovers successful and rejected translations, large binary inputs, mismatches, absent files/fields, invalid schemas, malformed JSON, and multi-manifest failure handling.translation_wall_usmeasures elapsed time around the translation worker call, including the wait for its result. Driver PSO creation is outside that interval.Tested
b0d2fb814b92148710d0f91e590d6c1f9fe26cd2:python3 -B -m unittest discover -s scripts -p 'test_*.py': 30 passed, 0 failed.cargo check -p xcl --tests --target x86_64-pc-windows-msvc: passed in a Linux cross-check environment using a locallib.exe-compatible archive wrapper. This was compile-only; Windows test binaries were not executed.git diff --check: passed.76e7793, independently checked on Windows 11 / RTX 3060 Ti after merging then-currentmain:cargo test -p xcl --libreported all tests that ran passed, 0 failed and 27 ignored. This predates the stale-manifest fix and is supporting evidence, not exact-head validation.Regression run
Pending paired
xcl-smokeblocks from currentmainand this PR's clean headb0d2fb814b92148710d0f91e590d6c1f9fe26cd2, with the same title and duration.Not tested
AI use
38cdb20f, assisted by OpenAI Codex (GPT-6); the commit was cherry-picked with its original authorship preserved.@DavidM1911 on GitHub · 2026-11-25 23:06 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.Thanks!
— Devin
@RavenCurseBurg on GitHub · 2026-11-25 23:06 UTC · original · edited 2026-11-26 13:49 UTC
Verified
76e7793dbb5ec337a0b30aa832d25f2fa2d1e5eeafter the cherry-pick. The offline checker and its tests match the original files from38cdb20fbyte-for-byte.python -B -m unittest discover -s scripts -p "test_*.py"passed 30/30. All 12 two-manifest CLI cases passed again: a valid second manifest was processed after an invalid first one, and none of the saved file snapshots changed. This verifies the adopted offline checker. I did not execute XCL’s Rust dump writer or load a retail pack. Windows 11, Core i7-13700, Python 3.14.3. OpenAI Codex (GPT-6) ran the checks.Earlier verification
I prepared an offline artifact checker and tests on
effef6719d431ac360ce9d6f46c55e87b1bd486afor the success/error checks listed in this PR. Runpython -B scripts/verify_shader_dump.py FILE.manifest.jsonon a saved dump. It reads the sibling guest file and the result selected by the manifest, recomputes the FNV-1a hashes, and compares a rejected translation's UTF-8 error bytes exactly. It also accepts multiple manifests and returns a failure status if any comparison fails.I ran 12 two-manifest CLI cases using synthetic files, including a 131,073-byte binary guest with independently computed hash
9fd6a807c893b7df. Both outcome types passed. The ten mismatch, missing-file/field, schema and malformed-JSON cases returned 1, still processed the following valid manifest and left all files byte-identical. A rejection with an old DXIL file present selected the error file.python -B -m unittest discover -s scripts -p "test_*.py"passed all 30 tests, including five for the checker.Windows 11 26100.9711, i7-13700, Python 3.14.3. I tested the offline checker only. End-to-end generation with XCL and a shader pack remains unverified here. OpenAI Codex (GPT-6) prepared the checker and ran the tests.
Rechecked the offline verifier on
b0d2fb814b92148710d0f91e590d6c1f9fe26cd2following the writer change. With unchanged guest/DXIL files and a directory blocking the error-file path, a retained old manifest still verified. After I removed that manifest to represent an interrupted replacement, the CLI returned 1 and still verified a second intact bundle. Publishing a new error manifest selected its exact error text even with the old DXIL present. The verifier left all three fixture states unchanged.I ran
python -B scripts/verify_shader_dump.py sample.manifest.json other.manifest.jsonon those synthetic states, reran the 12 earlier CLI cases, and ranpython -B -m unittest discover -s scripts -p "test_*.py"(30 passed). Windows 11 build 26100, Core i7-13700, Python 3.14.3. OpenAI Codex (GPT-6) ran these checks. I constructed the file states directly. The native Rust writer regression and paired retail smoke were outside this run.@DavidM1911 on GitHub · 2026-11-26 01:36 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
@ -2374,3 +2415,1 @@match &r {Ok(dxil) => dump("direct.dxil", dxil),Err(e) => dump("direct.err.txt", e.as_bytes()),if let Some(dir) = &dump_dir {@luckyteagirl on GitHub · 2026-11-25 23:39 UTC · original
The manifest is written even if the earlier
dump("guest.bin", ...)or DXIL/error dump failed; that closure discards eachwriteerror. In that case this new record can advertise hashes for artifacts that were not saved, and the run gives no immediate clue which file failed. Could the artifact writes return/report their errors (or record which artifacts were persisted) before emitting the manifest? A small test can make one sibling path unwritable while allowing the manifest write and assert the failure is visible.@ -2374,3 +2415,1 @@match &r {Ok(dxil) => dump("direct.dxil", dxil),Err(e) => dump("direct.err.txt", e.as_bytes()),if let Some(dir) = &dump_dir {@mokkamokacaffe on GitHub · 2026-11-26 00:04 UTC · original
Addressed in
b6bd0c0. The requiredguest.binand DXIL/error artifact writes now return their errors and complete before the manifest is written. A failed sibling write reports its exact path and prevents publication of the manifest.I also added
direct_dump_does_not_publish_a_manifest_for_a_missing_artifact, which makessample.guest.binunwritable and verifies that the error is visible and neither the result artifact nor manifest is created. The Windows MSVC-target test build passes.@SlopTart on GitHub · 2026-11-26 05:13 UTC · original
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.Targeted run of
direct_dump_does_not_publish_a_manifest_for_a_missing_artifact: passed.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.
@luckyteagirl on GitHub · 2026-11-26 06:55 UTC · original · reviewed
Reusing a
--dumpdirectory can leave a manifest that still verifies after a rerun fails. The prefix is stable for the same record and program. If the first run writes DXIL and a later run produces a translation error, a failed write to.direct.err.txtreturns before the old manifest is replaced. The unchanged guest and old DXIL still match that manifest.I reproduced the file sequence on Windows by placing a directory at the error artifact path. The sibling write raised
PermissionErrorand the exact-head verifier exited 0 with “guest and translated DXIL match.”Could the writer invalidate the existing manifest before it starts replacing artifacts, or use separate names for each generation? A regression can seed a valid bundle, force an artifact write failure on the rerun, and check that the old manifest cannot be mistaken for its result.
@mokkamokacaffe on GitHub · 2026-11-26 13:01 UTC · original
Fixed in
b0d2fb8.write_direct_dumpnow removes the existing manifest before replacing any sibling artifact. Failure to invalidate the manifest aborts before changing the bundle; failure of any later artifact write leaves no manifest that can authenticate the previous generation.The new
direct_dump_invalidates_an_old_manifest_before_replacing_artifactsregression reproduces the reported sequence: it writes a valid bundle, makes the next.direct.err.txtpath unwritable, runs a failing replacement, and asserts that the old manifest is gone.Checked
python3 -B -m unittest discover -s scripts -p 'test_*.py': 30 passed, 0 failed.cargo check -p xcl --tests --target x86_64-pc-windows-msvc: passed as a compile-only Linux cross-check with a local archive wrapper.git diff --check: passed.Not tested
AI use
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.