Shaders: the fused multiply-add probe binds a sampler heap #2039
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2041"
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?
Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T03:58:02Z.
The problem
With the D3D12 debug layer on, every start reports an error before any title work runs. It is the first error of the run, so when a later failure happens, the debug layer's report of that failure can lead with this unrelated one.
The cause is
emit::host::Host::fuses_fmad. It runs once as the host is made, to tell whether the GPU fusesmad. It records its dispatch with the root signature a translated program gets, which indexes the sampler heap directly, but it bound only a view heap. D3D12 requires a sampler heap bound before such a root signature is set. The debug layer reports:The other probes in the file bind one already.
How it was found
Running
cargo test -p victory-gpu --features diagnosticswithVICTORY_D3D12_DEBUG=1and printing whatHost::log_messagesreads. The same run also reports barrier errors from a depth twin's copies in a list's prelude (draw::tests::a_depth_texture_written_through_unordered_views_reads_as_depth, second round). #1803 already fixes those, so that part is not here.The fix
host::rerun_with_debug_layerruns a test again in a child process withVICTORY_D3D12_DEBUG=1(diagnostics builds only; the host is made once per process, so it can only get the layer at its start). The errorsHost::log_messagesreads are kept for the test. The child prints its outcome (checkedonce it has read the layer's messages, orskipped:and why); the parent fails if it says neither, and fails a skip whenVICTORY_REQUIRE_DEBUG_LAYER=1is set.Testing
host::tests::making_the_host_leaves_no_debug_layer_errors: makes the host under the debug layer and finds no errors. Without the fix it fails with the error above.cargo test -p victory-gpu --features diagnostics --libon an RTX 5070 Ti (driver 621.24, debug layer installed): the new test passes; it fails onmainwith the error above. All other tests pass exceptdescriptor::host::tests::dynamic_slots_are_held_until_releasedandmemory::tests::lists_share_a_table_and_copies_keep_their_views, which fail the same way onmain(#1835). Withoutdiagnostics, the new test is not built.cargo test --release -p victory-shader --lib: 244 passed. The 3 failures (emit::stride_tests::*x2,emit::synthetic_tests::gathers_at_a_level_match_the_hardware) fail the same way onmainon this GPU (#1835).cargo clippy -p victory-gpu --all-targetswith and without--features diagnostics, andcargo clippy -p victory-shader --all-targets --features host: clean.Related
#1803 fixes the depth twin's barrier errors seen in the same run.
rerun_with_debug_layerwould give #1803 a regression test the same way.Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T04:06:52Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):cargo test -p victory-shader --lib making_the_host_leaves_no_debug_layer_errors— passed on both RTX 5090 hardware andVICTORY_D3D12_WARP=1cargo clippy -p victory-gpu -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean fix binding a sampler heap for the FMA probe so host initialization produces zero D3D12 debug layer errors. Looks good.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T04:26:00Z.
Review: APPROVED
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main
940d32f69b,cargo test -p victory-shader --locked.144 passed / 0 failed / 2 ignored. Fused multiply-add probe binds a sampler heap — probe-path fix; mixed gpu+shader, gpu half Windows-only.
Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-25T04:08:45Z.
Triage verdict — Keep the binding fix, make debug-layer coverage observable (
8c23a7b)Evidence
Checks and limits
cargo test -p victory-gpu --features diagnostics --lib making_the_host_leaves_no_debug_layer_errorsunder WARP. In a disposable variant requiring device initialization and a debug InfoQueue, the device initialized but the InfoQueue assertion failed. The hardware selection showed the same result. This confirms a green result can occur without reading debug messages. The before/after result with the debug layer active is author-reported. Skip and assertion pathNext step
This verification was AI-assisted.
Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T06:25:45Z.
Thanks @jeremygold02, done in
e54d51d. The child process now prints its outcome:checkedonce it has read the debug layer's messages, orskipped:with the reason (no device, or no debug layer installed). The parent prints a skip as a skip and fails if the child says neither. WithVICTORY_REQUIRE_DEBUG_LAYER=1set, a skip fails, so a green run in that mode means the InfoQueue really was read.On an RTX 5070 Ti with the layer installed it reports
checked. With the layer check forced off it prints the skip and passes, and fails once the switch is set. (Part of the miss was that, with one test thread, libtest printstest <name> ...before the test runs, so the parent matches the outcome anywhere in a line.)Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T09:19:22Z.
Automated triage for the maintainers.
Needs work: needs the maintainer's decision.
Host::fuses_fmadfix (crates/victory-shader/src/emit/host.rs, commitc8ada18) is still right and is now also split out as #2922, which can land on its own.crates/victory-gpu/src/host.rs:rerun_with_debug_layerre-runs the test binary throughstd::process::Command::new(current_exe()), with thechecked/skipped:outcome protocol andVICTORY_REQUIRE_DEBUG_LAYER. Because it spawns a process, only the maintainer can decide whether to take it.On your reply: agreed with the plan. Once #2922 lands, rebasing to drop
c8ada18leaves a harness-only PR for the maintainer to decide on; nothing else is needed from you meanwhile.CI: passing (
check).Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T09:37:56Z.
Offline measurement on a retail dump
Result: no count change against
main.I merged head
e54d51dfontomain940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 23,918 with this PR.No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.
No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T00:11:12Z.
Thanks for the triage.
fuses_fmadfix: split out into #2922 (one commit,cc785ae, on currentmain; onlycrates/victory-shader/src/emit/host.rs). Without the harness there is no new test in it. I checked it by applying this PR's harness locally on top of it:host::tests::making_the_host_leaves_no_debug_layer_errorswithVICTORY_REQUIRE_DEBUG_LAYER=1passes, and fails with the id 1419 sampler-heap error once the fix is reverted.rerun_with_debug_layer,DEBUG_ERRORS, the outcome marker,VICTORY_REQUIRE_DEBUG_LAYER): understood, that's your call. This PR stays open as just the harness. Once #2922 lands I'll rebase it to drop the fix commit. If you'd rather not take the harness, I'll close it.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.