Shaders: the fused multiply-add probe binds a sampler heap #2922
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2922
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2922"
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?
@0xkn0wh3r3 on GitHub · 2026-11-26 00:10 UTC · original
0xkn0wh3r3:shaders/fmad-probe-sampler-heap-fix→main· +11 −1 · 1 files · 1 commits · openThe problem
emit::host::Host::fuses_fmadruns once as the GPU host is made (victory-gpu'sHost::new), to tell whether the GPU fusesmad. It records its dispatch with the root signature a translated program gets. That root signature, fromroot_signature_for, setsD3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED, but the probe bound only the view heap. D3D12 requires a sampler heap to be bound before such a root signature is set; without one the behavior is undefined, and with the debug layer on every start reports:It is the first error of the run, so the debug layer's report of a later, unrelated failure can lead with it. The other probes in the file already bind a sampler heap.
The fix
The probe now binds a one-slot shader-visible sampler heap with its view heap. It samples nothing; the heap is there because the root signature requires it. It lives until the probe's fence wait completes, like the view heap.
Testing
There is no new test here. Checking for the error needs the debug layer enabled before the device is made, and the host is made once per process, so a test needs its own process; that harness stays in #2041. Coverage:
emit::semantics_tests::hosts_that_do_not_fuse_are_namedrunsfuses_fmadon WARP and the hardware adapter (no debug layer): passes, hardware adapter reports fused.victory-gpuruns the probe while making its host, so with a diagnostics build andVICTORY_D3D12_DEBUG=1the error above is what the debug layer reports at startup onmain. With #2041's harness applied locally on top of this branch,host::tests::making_the_host_leaves_no_debug_layer_errors(withVICTORY_REQUIRE_DEBUG_LAYER=1, so a skip would fail) passes on an RTX 5070 Ti with the debug layer installed; with this commit's change reverted it fails with the error above. The harness is not part of this PR.cargo test --release -p victory-shader --features host --libon an RTX 5070 Ti: 298 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);emit::memory_tests::heap_direct_texture_reads_mark_their_heap_indexwas skipped (crashes the process onmainhere too).cargo clippy -p victory-shader --all-targets, with and without--features host: clean.cargo xtask policy: ok.Split out of #2041 at the triage's suggestion; #2041 keeps the debug-layer test harness.
@Marvisak on GitHub · 2026-11-26 04:32 UTC · original
Automated triage for the maintainers.
Merge candidate.
Host::fuses_fmadinemit/host.rsuses a root signature withSAMPLER_HEAP_DIRECTLY_INDEXEDbut bound only the view heap, which the debug layer reports as error 1419. The fix binds a one-slot shader-visible sampler heap as the other probes in the same file already do, and keeps it alive until the fence wait completes. Small and correct by my reading of the D3D12 rules.CI: passing.
Generated by Claude Code
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.