Ray tracing: a copy out of a builder result page is recorded on the card, behind the builder's dispatches #4827
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4827
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4826"
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?
@cafeoh on GitHub · 2026-12-01 10:25 UTC · original
cafeoh:fix/bvh-size-copy-on-card→main· +104 −0 · 3 files · 1 commits · openFollow-up to #1412, closed on 11-30 because it predates v2026.11.29.01: it still happens on current main
5fabb46ea(with #718'sVICTORY_BVH_SIZE_ANSWERon by default, as eleboucher and nick0451 also found there), and docs/fork-ray-tracing.md still lists the overlap.Scope: the software structure walk only (
VICTORY_BVH_BUILDER=1withoutVICTORY_HW_RT). With hardware RT the title's builder is off and none of these copies happen, so #4694 users on DXR 1.1 cards are not affected either way. It matters for cards without DXR 1.1 and for anyone who keeps the walk in shaders.What it changes
The title copies a structure's compacted size out of the slot the builder's size program writes, in the same list or the next, and places the next structure by it. Today that copy is made from the CPU's side at submission, before the size program has run on the card, so the title reads the slot's previous value (#1412: "it takes 0x1c00 bytes for C, which is B's size"), and the next structure's copy writes over it.
VICTORY_BVH_SIZE_COPY=1copies again after the list, but only where the destination has no host copy.With this change, a title copy whose source lies in a builder result page is recorded as a
CopyBufferRegionon the card at its place in the list, behind the size program's dispatch (with the barriers around it), and the destination is marked as written by the card. The CPU never reads the slot.On by default;
VICTORY_BVH_SIZE_COPY_ON_CARD=0gives the old path. A log line counts the copies made on the card and those left to the usual path.How it was tested
RTX 2080 Ti 11 GB, Windows 10, Ryzen 7 7800X3D, Series S, ray tracing on (software walk), DLSS off, release build, the launcher's defaults (no other switches), 89 s after the world shows, shaders and pipelines made beforehand, PresentMon, last 40 s, runs in the order with / without / with / without:
On main
5fabb46ea(this branch):Earlier, on main
f5c3d2434: with 11.84 / 12.47 fps, without 10.31 / 10.47 (frames over 250 ms: 9 / 8 against 45 / 20). One1251c319with #4568's revert: with 16.09 / 15.94, without 13.61 / 12.92.The counter: about 5,000 copies a run made on the card on this branch (6,000 on the release), none left over. The screen-probe trace program (CS_ScreenProbes_TraceRays) no longer grows over the run as structures overlap.
Not tested: AMD, Series X profile, DLSS on, sessions longer than about 3 minutes. Pictures: lighting looked the same at a glance; no frame-by-frame comparison.
Checked for overlap
VICTORY_BVH_SIZE_COPY, copies after the list, merged and off by default), #718 (answers at the builder call, on by default, does not cover every copy), #1413 (trace). #4760 changes hardware RT's postbuild sizes only. No open PR records the copy on the card.@gut0to on GitHub · 2026-12-01 15:17 UTC · original · reviewed
AI-assisted review: I traced the new BVH result-source lookup through list recording and submission ordering. I used AI assistance and verified that this diff adds no regression test for the path.
@ -1441,1 +1441,4 @@}// Out of a page the structure builder stores results in: on the card,// behind its dispatches (VICTORY_BVH_SIZE_COPY_ON_CARD).if crate::memory::size_copy_on_card()@gut0to on GitHub · 2026-12-01 15:17 UTC · original
Could this default-on path get an end-to-end GPU regression? Its correctness depends on finding the builder result-page shadow and copying from it after the builder dispatches, with the destination reflecting that value when the list lands. The existing size-copy test covers only the older late_size_copy predicate; this diff adds no test for result_source or place_result_copy. A WARP test that writes a known size into the source, records the title copy after that write, submits, then checks the destination would catch source-offset and ordering regressions.
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.