GPU: a placed buffer view that starts off an element of its host copy is left null, and hit detection removes the device; fix on a fork #981
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#981
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@SantannaCarlos on GitHub · 2026-11-24 14:37 UTC · original
What
A view of memory the title placed itself (methods 0x230 and 0x238) names its own start, which need not be a multiple of its stride. When such a buffer shader view started off an element of its host copy,
buffer_srvleft the slot null and shaders read zeros through it.CS_ComputeHitDetectionSkinnedResults(eeed82b877b44b5f) reads one of these (a structured view, stride 56) and took down both GPUs right after its first use in the world (details in #71).Such a view now reads a copy of just its bytes that starts at the view: made on first use, keyed by (start, length), held by the slot. The copy is a host copy like the others, so its own refresh copies the pages the title wrote, from title memory. Unordered access views off an element stay null, as before.
Known limit, commented as a shortcut in the code: the copy is prepared from title memory, so it does not see what a shader of the same submission wrote in that range before the read. Getting that right needs host buffer states tracked across the whole submission (#334), so the bytes can be copied on the GPU inside the list.
Also in the commit: one
view_range_ofnow gives the view's range to bothbuffer_srvandreadable, which computed it differently; the warning for a null buffer shader view names its kind (placed or registered), stride and range; a diagnostics build nulls the views of the strides listed inVICTORY_NULL_VIEW_STRIDES.Branch: https://github.com/SantannaCarlos/VIctory/tree/fix/view-off-element, one commit on
ffe310e(compare: https://github.com/Marvisak/VIctory/compare/main...SantannaCarlos:fix/view-off-element).Tested
cargo clippy --workspace --all-targets -- -D warnings, with and without--all-features;cargo test --workspace;cargo xtask policy.0x164E) in the same PC, with the diag tree from my comments on #71 (loop limit 64, DRED on, Enter-only input), runs of up to 10 minutes:Per world frame on the 4070 (mesh off), preparation took a median of 357–367 ms with this refresh path (605 ms with an earlier revision of this branch that copied each view twice).
Two alternatives were measured and dropped. Leaving the view null when its submission writes its range brought the stop back: the range that covers these views is the whole 174 MB buffer that holds them, declared written in every submission, so 470–1,340 views per frame were nulled. Copying the bytes on the GPU inside the list before each read kept both cards running too, but its barriers had the wrong before state in about 28% of the copies (the buffer had already been promoted earlier in the same list) and it copied ~3 GB per frame.
Not tested: unordered access views off an element (still null); the case where a shader of the same submission writes the view's range before reading it.
Related
#912 adds a zero-element check at the top of
buffer_srv; the two branches conflict there only textually (both checks belong, the zero-element one first). #334 is what the shortcut above waits for.@andrewpozdnakov7-jpg on GitHub · 2026-11-24 15:01 UTC · original
I reproduced a publication race in the aligned-shadow cache at
17c27b3ad81f9521101266156365633fe18588d1. Concurrent recorders can get different live buffers for the same range. The cache then refreshes one buffer while another descriptor can still hold the other.The WARP fixture uses eight concurrent requests and inspects the mapped bytes after refreshing the cached copy. On the author head the test fails because a caller retains a different buffer. With the follow-up, every caller retains the refreshed buffer and reads the expected value. The focused test passed eight repeated runs. Full GPU diagnostics: 58 passed, 1 ignored. Clippy and the asset policy check passed.
The fix rechecks the cache under its lock when publishing a copy. One commit directly on the author head. Fix and regression
Synthetic buffer fixture on native Windows D3D12 WARP. AI-assisted.
@SantannaCarlos on GitHub · 2026-11-24 15:06 UTC · original
Now a PR, with a second commit for unordered views of the same kind: #1019.