Guest bindless indices clamp to a null before the host's dynamic descriptors; unsafe view bindings drop the draw #632
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!632
Loading…
Reference in a new issue
No description provided.
Delete branch "deama/Darner:c14/descriptor-isolation"
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?
Run in the game only inside a combined test build (official
mainc8258f9+ #594–#601 + this PR + the two other fix PRs from the same source), not on its own. Ported from uncommitted "Patch C14" work in a local VIctory-NVIDIA tree (before the rename), written to stop GPU timeouts.Contributor role (optional)
What it changes
ResourceDescriptorHeapindex at the view heap's last slot (999,999 on NVIDIA's 1,000,000-view heap), but the host's dynamic tables sit below it (606,783–999,998 by default). A stale or wild index the title computes can therefore select a descriptor the host made for another draw, often of another type. On the VIctory branch this was the top suspect in three driver timeouts (bugcheck 0x116) on an RTX 4080. The initiating GPU command was never identified, and other suspects were fixed at the same time.Two commits:
descriptors: guest bindless indices clamp to a null before the host's dynamic tables
draw: drop draws whose view bindings cannot be made safely
Every view heap keeps a guest null just before its dynamic tables (606,782 on NVIDIA); the title's slots end before it. A translation clamps an index whose every leaf is a
ResourceDescriptorHeapload to that null. Table indices (which the host may rewrite into its dynamic tables) still clamp at the last slot. In a phi/select/per-lane choice between a guest and a table descriptor, the guest operand is clamped on its own edge first, and a raw twin's index is clamped before the twin bit. Main's view-start size query keeps the access handle's range.The partition is the same in every heap, so a short title heap leaves a null-filled gap. On 2^21-slot heaps the dynamic tables default to 2^18 slots (
DARNER_DYNAMIC_SLOTSstill raises them to 2^20), leaving 1,835,006 title slots. Sampler heaps hold at least 2,048 initialized descriptors, because shaders clamp sampler indices to 2,047. A heap whose null fill fails is not used.Both shader cache keys include the guest null, so every shader is translated again once.
A draw or dispatch is dropped (counted in the F3 line, now "binds dropped for unavailable view heaps or descriptor table slots", and warned once) when: an indexed table's runtime-selected entry would cross into the guest null or dynamic tables and it can't be snapshotted; its shader reads view slots but only the one-slot fallback view heap is bound; or a direct root CBV/SRV is unset or has no backing (an explicit zero included), which used to leave the previous root descriptor bound.
Main's
HostHeap::releasesubtracted the title count instead of the start of the dynamic range; fixed with the partition.How it was tested
a091731660(branch head; gates below). Game runs used a combined test build that contains it.a091731660, Windows 10 22H2 with its built-in Direct3D 12 (no Shader Model 6.6), Rust 1.98.1:cargo clippy --workspace --all-targets --locked -- -D warnings: passedcargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passedcargo --config 'profile.test.package.darner-shader.opt-level=3' test --workspace --locked --no-fail-fast(the opt-level only speeds up darner-shader's exhaustive float tests): 66 failed, all of which fail on unmodifiedmain(c8258f9556) on this PC too (darner-shader tests that need Shader Model 6.6).maintoo, so its tests were run in batches that survive the abort and compared one by one withmain(main: 1658 pass, 8 fail, 139 need Shader Model 6.6, 81 ignored): no test that passes onmainfails here, none removed; 6 new tests: 2 need Shader Model 6.6 (abort here), 4 pass.cargo xtask policy: ok (576 files).DARNER_D3D12_DEBUG=1,DARNER_D3D12_ERROR_ABORT=1, from #594), 180 s: loads, restores the outdoor pose at about 102 s, and draws there at about 17 fps (debug layer on).dropped 0 draws or dispatchesandbinds dropped … 0.00/framein every report line, so the new drops removed nothing in this scene. A captured frame looks complete. The only debug-layer message was 1047 (a pooled texture still written by another queue), about 26 s after the pose, which stopped the strict run. The same message appears in a build of main + #594 + #596 alone (without this PR or any of #595 and #597–#601), so it predates this change.Texture2Dviews, so a clamped buffer, cube, CBV or UAV access can still meet a null of the wrong type). The fallback sampler heap is still one slot. Two new GPU tests need Shader Model 6.6 and did not run here. No GPU-timeout reproduction exists on Darner, so "fixes the black screens" is not shown.Checklist
main.docs/asset-policy.md.Checked for overlap
heap_handle_atcalls for root-buffer indices passHeapRange::Hostinstead oftrue. Also #292 and #394 (constant reads through root SRVs; different problem in the same area).[pr-fix][rendering][shaders] Guest bindless indices clamp to a null before the host's dynamic descriptors; unsafe view bindings drop the drawto Guest bindless indices clamp to a null before the host's dynamic descriptors; unsafe view bindings drop the drawTest needed — commit
a0917316; what to check:ResourceDescriptorHeapindex at the view heap's last slot (999,999 on NVIDIA's 1,000,000-view heap), but the host's dynamic tables sit below it (606,783–999,998 by default). A stale or wild index the title computes can therefore select a descriptor the host made for another draw, often of another type. On the an earlier fork branch this was the top suspect in three driver timeouts (bugcheck 0x116) on an RTX 4080. The initiating GPU command was never identified, and other suspects were fixed at the same time.Two commits:
descriptors: guest bindless indices clamp to a null before the host's dynamic tables
draw: drop draws whose view bindings cannot be made safely
Every view heap keeps a guest null just before its dynamic tables (606,782 on NVIDIA); the title's slots end before it. A translation clamps an index whose every leaf is a
ResourceDescriptorHeapload to that null. Table indices (which the host may rewrite into its dynamic tables) still clamp at the last slot. In a phi/select/per-lane choice between a guest and a table descriptor, the guest operand is clamped on its own edge first, and a raw twin's index is cEvidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.
Reply
testingto take this run; it's free again after 24 h with no results.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
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.