GPU/BVH: DispatchX ignores flag 0x20 — possible thread-count vs. group-count mismatch in builder dispatches #2750
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#2750
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?
@FunWithFlagsDev on GitHub · 2026-11-25 19:37 UTC · original
<html>Summary
While investigating why upstream VIctory does not yet build the title's ray-tracing acceleration structures, whereas DexNom's experimental Radeon renderer reports successful construction and traversal, I identified a potentially significant difference in the handling of
DispatchX.Upstream discards its flags and forwards the supplied dimensions directly to D3D12 as group counts.
DexNom preserves the flags and interprets bit
0x20in BVH builder dispatches as a thread-count mode, converting the requested dimensions into group counts and masking excess threads for two specifically identified builder shaders.This report investigates whether that difference represents an additional blocker for upstream BVH construction.
The Xbox flag semantics remain independently unverified. This is an investigation, not a confirmed root-cause fix.
1. Source-level comparison
Revisions inspected:
Repository | Commit -- | -- Marvisak/VIctory |13f91caee2fxceless/victory-fork |d510ee4a9bDexNom/VIctory |2e01ab4760The probe also permits checking individual lane counters and sentinel values.
The next step would be integrating these assertions into the actual VIctory translator and command-list dispatch path, rather than testing only manually supplied host parameters.
The HLSL probe has not yet been compiled or executed. No complete native test harness is supplied.
6. Relationship to existing BVH work
This investigation complements, rather than replaces:
#2699 / #2703 — root constants incorrectly interpreted as view offsets.
#2118 — all-or-none BVH builder execution.
#2311 — preventing traversal before the builder has completed.
#2098 — acceleration-structure view addresses.
#2040 — BVH pointer arithmetic and node loading.
#2711 — Wave64 compatibility limitations.
Even with the above corrections, incorrect dispatch dimensions could independently prevent valid acceleration-structure construction, if the proposed flag interpretation is confirmed.
7. Requested verification
Could a maintainer or independent tester confirm the intended semantics of
DispatchXflag0x20?A useful asset-free diagnostic would report:
Builder classification.
Dispatch flags.
Requested X/Y/Z dimensions.
Translated compute group dimensions.
Availability of partial-thread metadata.
Resulting host dispatch dimensions.
Binding success or refusal.
Submission and completion status.
A controlled comparison after the root-constant correction in #2703 would help isolate the effect of dispatch handling.
If the flag semantics are confirmed, a narrowly scoped implementation could be considered, with synthetic regression coverage and explicit refusal of unsupported configurations.
8. Attachment
bvh_dispatchx_audit.zipContains:
README.md— source references, assumptions and validation methodology.model.py— differential dispatch model.test_model.py— 14 automated tests.matrix.csv— all 372 evaluations.results.txt— recorded model results.counter_probe.hlsl— proposed native counter probe.Reproduction:
Credits and limitations
Credit to DexNom and its contributors for the original dispatch handling and partial-thread regression concept.
This independent comparative investigation is AI-assisted using ChatGPT.
No proprietary game assets, executable files, shader dumps, SDK headers or game captures were used or included.
Only public source inspection and Python-based synthetic validation were performed. No native D3D12 execution, Xbox API verification or gameplay performance measurements were performed.
The purpose of this report is to identify and independently validate a possible additional blocker in upstream BVH construction.
</html>## SummaryWhile investigating why upstream VIctory does not yet build the title's ray-tracing acceleration structures, whereas DexNom's experimental Radeon renderer reports successful construction and traversal, I identified a potentially significant difference in the handling of
DispatchX.Upstream discards its flags and forwards the supplied dimensions directly to D3D12 as group counts.
DexNom preserves the flags and interprets bit
0x20in BVH builder dispatches as a thread-count mode, converting the requested dimensions into group counts and masking excess threads for two specifically identified builder shaders.This report investigates whether that difference represents an additional blocker for upstream BVH construction.
The Xbox flag semantics remain independently unverified. This is an investigation, not a confirmed root-cause fix.
1. Source-level comparison
Revisions inspected:
13f91caee25f2fdf2c062be5f7a27f058e51cbcad510ee4a9b635bcc345207a73ccb4c4fceb8228c2e01ab4760db91820ef5f9a9f85761f83cd6b5d0Upstream
[crates/victory-gpu/src/list.rs:1113](https://github.com/Marvisak/VIctory/blob/13f91cae/crates/victory-gpu/src/list.rs#L1113):The flags are discarded, and the dimensions eventually reach the host
Dispatchcall unchanged.See
[draw.rs:1027](https://github.com/Marvisak/VIctory/blob/13f91cae/crates/victory-gpu/src/draw.rs#L1027).The Fxceless implementation exhibits the same behavior:
[fxceless/list.rs:1379](https://github.com/fxceless/victory-fork/blob/d510ee4a/crates/victory-gpu/src/list.rs#L1379).DexNom
[crates/victory-gpu/src/draw.rs:2287](https://github.com/DexNom/VIctory/blob/2e01ab47/crates/victory-gpu/src/draw.rs#L2287):When this condition holds, the dimensions are converted using ceiling division by the translated compute group's dimensions.
A separate shader parameter supplies the actual X thread limit for selected partial-group kernels.
Relevant sources:
github.com/DexNom/VIctory@2e01ab47/crates/victory-gpu/src/list.rs (L1322))github.com/DexNom/VIctory@2e01ab47/crates/victory-gpu/src/draw.rs (L2287))github.com/DexNom/VIctory@2e01ab47/crates/victory-shader/src/emit/mod.rs (L709))github.com/DexNom/VIctory@2e01ab47/crates/victory-shader/src/emit/lower.rs (L2173))github.com/DexNom/VIctory@2e01ab47/crates/victory-shader/src/emit/wave64_tests.rs (L139))The implementation was introduced in [DexNom commit bc3cd4b0](
github.com/DexNom/VIctory@bc3cd4b045).That commit contains several other changes, so successful BVH construction cannot be attributed to this change alone.
2. Potential consequence
The documented PC D3D12
Dispatchinterface expects group counts:https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-dispatch
If the Xbox call instead supplies thread counts when bit
0x20is set, forwarding them directly changes the number of shader invocations.For a one-dimensional shader with 64 threads per group:
Under that assumed contract, the unchanged path launches 64 times the requested number of threads.
Potential consequences include:
These consequences are hypotheses. No actual title-memory corruption or GPU timeout was reproduced in this investigation.
3. Ceiling division alone is insufficient
For a request of 74 threads with a group width of 64:
Without a partial-group mask, even the rounded path executes 54 unintended invocations.
DexNom's current shader-side protection is specialized to two identified shaders with group dimensions
[64, 1, 1].It must not be generalized indiscriminately:
4. Asset-free differential validation
The attached archive contains a Python model comparing four policies across 93 synthetic scenarios, for a total of 372 evaluations.
All 14 Python unit tests passed.
The conservative candidate still requires explicit rejection or correct splitting of its two invalid-dimension cases.
These scenarios are intentionally adversarial. They are not observed title frequencies or measurements of runtime correctness.
The model assumes the proposed thread-count semantics. It therefore tests the consequences of that assumption, rather than independently establishing the Xbox API contract.
5. Proposed native regression
An original synthetic HLSL counter probe is included.
It uses bounded UAV counters and atomic increments to distinguish:
Suggested reference cases:
The probe also permits checking individual lane counters and sentinel values.
The next step would be integrating these assertions into the actual VIctory translator and command-list dispatch path, rather than testing only manually supplied host parameters.
The HLSL probe has not yet been compiled or executed. No complete native test harness is supplied.
6. Relationship to existing BVH work
This investigation complements, rather than replaces:
Even with the above corrections, incorrect dispatch dimensions could independently prevent valid acceleration-structure construction, if the proposed flag interpretation is confirmed.
7. Requested verification
Could a maintainer or independent tester confirm the intended semantics of
DispatchXflag0x20?A useful asset-free diagnostic would report:
A controlled comparison after the root-constant correction in #2703 would help isolate the effect of dispatch handling.
If the flag semantics are confirmed, a narrowly scoped implementation could be considered, with synthetic regression coverage and explicit refusal of unsupported configurations.
8. Attachment
bvh_dispatchx_audit.zipContains:
README.md— source references, assumptions and validation methodology.model.py— differential dispatch model.test_model.py— 14 automated tests.matrix.csv— all 372 evaluations.results.txt— recorded model results.counter_probe.hlsl— proposed native counter probe.Reproduction:
Credits and limitations
Credit to DexNom and its contributors for the original dispatch handling and partial-thread regression concept.
bvh_dispatchx_audit.zip
No proprietary game assets, executable files, shader dumps, SDK headers or game captures were used or included.
Only public source inspection and Python-based synthetic validation were performed. No native D3D12 execution, Xbox API verification or gameplay performance measurements were performed.
The purpose of this report is to identify and independently validate a possible additional blocker in upstream BVH construction.
@Venom2054 on GitHub · 2026-11-25 19:57 UTC · original
I measured direct
DispatchXin the prologue on Windows 11 / RTX 5070 Ti, then checked the same entry point with an asset-free compute shader.Title trace. On my local integration with the #2118/#2311 gate enabled, I captured 53,617 direct builder requests across 259 frames. The gate reported 48 pipelines made and 5 refused out of 53. All 53,617 requests stopped before binding, so there was no host dispatch or completion for those title requests. The trace records the incoming flags and dimensions without changing either. Y and Z were 1 throughout.
0x200x8020Both shaders that DexNom specializes by DXBC digest were present. They match the two compute programs from my earlier #2311 controls. Of their 35,517 requests, 35,428 had X indivisible by 64. If X counts threads, almost every one needs a partial final group.
Native control. With one ready synthetic builder pipeline and a translated 64 × 1 × 1 shader, I called the Device11 command-list entry point and read fenced D3D12 pipeline statistics on the physical RTX. For X=65, both flags
0and0x20produced 4,160 CS invocations. For X=2, both produced 128. This confirms that the current host path interprets X as a group count for either flag. The title capture establishes that the flag and partial-sized requests actually occur. Xbox semantics and the effect on a completed title BVH remain open. This was an observation run before #2703.@FunWithFlagsDev on GitHub · 2026-11-25 20:13 UTC · original
Excellent independent validation. Thank you for performing both the title trace and the fenced native D3D12 control.
The distinction between incoming requests, recorded dispatches and completed GPU work is particularly valuable here.
Two additional observations stand out:
0x20are not divisible by 64 (99.75%). Under the proposed thread-count interpretation, partial-group handling is therefore essential rather than an uncommon edge case.0x8020requests reach X=82,606, exceeding the standard D3D12 limit of 65,535 groups per dimension. With a group width of 32, ceiling division would produce 2,582 groups, containing 82,624 invocations before tail masking, of which 18 would be excess.The second case warrants separate investigation because DexNom's explicit partial-thread shader specialization currently targets two 64×1×1 programs.
Could you additionally confirm:
0x8020requests have X indivisible by 32?For X=65 and a group width of 64, the expected invocation counts would be 4,160, 128 and 65, respectively, if the last policy uses a shader-side counter of active work. D3D12 pipeline statistics alone may still count masked invocations, so an atomic UAV counter would provide a complementary measurement.
I agree that the Xbox semantics and the effect on completed acceleration structures remain unverified. The new evidence substantially strengthens the investigation without yet establishing the root cause.
Thank you again for the reproducible hardware measurements.
@Venom2054 on GitHub · 2026-11-25 20:33 UTC · original
I checked the two
0x8020programs in the same prologue trace. 17,172 of 18,100 requests (94.87%) had an X indivisible by 32. Both programs use 32 × 1 × 1 in the guest metadata and the translated DXIL. Y and Z were 1 throughout.4ddd6f9702fab2a75062bc7a48e842f8Exactly five requests exceeded 65,535, all at X=82,606 for the second program. The builder gate held these title requests before host dispatch.
Bounds and barriers. I matched both programs by digest and inspected their native control flow offline. Neither contains a workgroup
s_barrier. The smaller program compares the global X index with a bound loaded from input memory. That check protects both output stores, and one store additionally requires index zero. The larger program has a similar entry check. Coverage of every later store and atomic operation remains open. The trace did not record the bounds loaded by the shaders, so their relationship to the incoming X is still unknown.Three-mode counter control. I ran a separate, asset-free D3D12 compute shader on the RTX 5070 Ti and WARP. It increments one UAV counter before the cutoff and a second after it. For requested X=65, both adapters gave the following launched / accepted counts after fence completion.
With the cutoff, zero out-of-range lanes wrote results. All six sentinel words and all 4,160 output slots matched their expected values in every case on both adapters. The D3D12 debug layer reported zero errors.
The earlier Device11 test measured which policy VIctory currently applies. This new standalone control explicitly selects each policy and measures its effect on shader-side work. Xbox flag semantics and correctness of the resulting title BVH remain open.
@FunWithFlagsDev on GitHub · 2026-11-25 20:42 UTC · original
<html>Thank you for the additional measurements. The agreement between physical hardware and WARP is particularly useful.
Combining both trace results, 52,600 of 53,617 builder requests (98.10%) have an X dimension that is not divisible by their respective group width.
Under the proposed thread-count interpretation, partial-group handling is therefore a fundamental requirement, not an exceptional case.
The two newly identified programs also help separate distinct correctness concerns:
4ddd6f9702fab2a7: X is always 1. Both unchanged forwarding and ceiling division launch one 32-thread group. The relevant difference is the active lane set, rather than the number of groups.5062bc7a48e842f8: ceiling division changes the group count, and five observed requests would exceed the standard D3D12 per-axis group limit if forwarded unchanged.The existing bounds checks are encouraging, but do not by themselves establish equivalence to a partial initial EXEC mask. Their relationship to the requested thread count remains unknown, and wave operations, reductions and atomic side effects may also need consideration.
The new synthetic results match the mathematical predictions in the attached audit. Importantly, the launched and accepted counters distinguish physical host invocations from logically active shader work.
I believe the next useful regression would exercise all three policies through the actual VIctory command-list entry point, with the translated shader rather than a standalone host dispatch.
Suggested controls:
Flags | Requested X | Group width | Expected host groups | Expected accepted lanes -- | -- | -- | -- | -- 0x0000 | 2 | 64 | 2 | 128 0x0020 | 65 | 64 | 2 | 65 0x8000 | 2 | 32 | 2 | 64 0x8020 | 1 | 32 | 1 | 1 0x8020 | 33 | 32 | 2 | 33 0x8020 | 65 | 32 | 3 | 65 0x8020 | 82,606 | 32 | 2,582 | 82,606The expected values are conditional on the proposed flag semantics.
A synthetic EXEC population test would additionally distinguish a genuine partial-wave implementation from a shader that merely suppresses out-of-range stores.
Existing implementations in fxceless/victory-fork #646 and #994 provide useful references for that integration.
The outstanding questions are now narrower: confirming the Xbox API contract, preserving initial EXEC semantics, and establishing the effect of the correction on completed BVH structures.
Thank you again for the independent validation.
</html>@tippythetaidum on GitHub · 2026-11-25 20:50 UTC · original
For cross-reference: victory-fork implemented this interpretation in an open PR, fxceless/victory-fork#994 (stacked on #993 and #854 there), with measurements that bear on the open question here.
What its description reports:
USE_THREAD_DIMENSIONS(0x20, and 0x8020 for its wave32 programs) on the header copies (DecompressHeader), the box rehydration of pre-built structures (Box32/Box16Rehydration) and the triangle reloads (ReloadTriangles, ReloadProcedurals).0x8020X=82,606 case): a dispatch split into several executions keeps the console thread ids right through a group base (#993 there).From my side: I merged that stack into my own tree, and on an RTX 5080 all 53 builder programs get host pipelines. I haven't measured whether the structures it builds are right, so I can't confirm the final picture from this alone.
AI-assisted (Claude Code, Claude Opus 5.5): reading and this text.
@kavabunga6 on GitHub · 2026-11-25 21:14 UTC · original
I ran the proposed 1-D controls through the Device11 command list on an RTX 5060 Ti (driver 617.42, Agility SDK 618). Each active lane of a translated synthetic guest shader wrote its entry
popcount(EXEC)at its global X index. I measured GPU invocations with D3D12 pipeline statistics and checked the entire output buffer after fence completion.With 64 threads per group,
DispatchX(65,1,1,0x20)produced 4,160 invocations and 4,160 writes on both Marvisak/VIctory#1960 (fc61f2e) and the parent of fxceless/victory-fork#646 (ca8829f). With the fix (36a2257), the same call produced 128 invocations and 65 writes. Slots 0–63 held64, slot 64 held1, and the remaining 4,111 slots kept0xDEADBEEF.The requested 32×1×1 controls also passed on
36a2257with a native wave32 guest shader.0x80000x80200x80200x80200x8020I also checked whether the partial mask carried over to the next command. After either a 33- or 74-thread partial dispatch at group width 64, an ordinary
Dispatch(2,1,1)wrote 128 values of64. Both calls used the same command list, PSO and root UAV binding. Between calls, the GPU captured the first result and refilled the same UAV with the sentinel, so the second readback independently verified all 128 writes.This was an asset-free PC test. Xbox flag semantics and the correctness of an in-game BVH remain open.
@Marvisak on GitHub · 2026-11-25 21:46 UTC · original
Automated triage for the maintainers.
The code side is confirmed on
main(61bfc77).dispatch_xincrates/victory-gpu/src/list.rsignores its_flagsargument and passesx, y, ztostate::dispatchas group counts. Nothing merged since changes that. The thread adds evidence that this matters:0x20(and0x8020) on builder dispatches. Almost all of them have an X that is not a multiple of the group size, and some reach X=82,606 (more than 65,535).The console meaning of the flag is still not verified directly. Handling it needs the shader side as well (partial last groups, and splitting past 65,535 groups).
A working implementation exists only on third-party forks (kavabunga6's
36a2257, and the fork stack tippythetaidum describes). No PR here carries it yet. Pull requests are open to everyone, so please open one against this repo and link this issue, with the native controls as tests. The related builder work is in #2118, #2311 and #2703.Generated by Claude Code