Repository navigation
startup: gate the BVH builder compute stages all or none - #2920
Conversation
KelboLive
left a comment
There was a problem hiding this comment.
PR #2920 by @lambirou -- startup: gate the BVH builder compute stages all or none
What works
- Solid foundational work establishing the 0x100 linear layout in gfx10_layout.h with careful derivation from AMD addrlib
- The linear_mode = 0 constant elegantly extends block_log2() to accept mode 0 without changing the tiled modes switch logic
- supports() check is correct: mode == linear_mode bypasses the block_log2 >= 12 requirement since linear has no tail
- Test infrastructure is excellent -- linear_order_control (expected failure with largest mip first), linear_addrlib (338K element addresses), and the unpadded negative control all add strong coverage
- Documentation accurately restates addrlib's linear mode algorithm in clear, testable terms
Issues
- supports() currently allows block-compressed formats (BC1-BC7) in linear mode via the fallthrough -- BC formats are block-based and don't have linear row semantics; consider gating them out explicitly like 1D does in #2929
- The check script in startup_address_console_check.py builds linear backing bytes from addrlib equations. This is correct but the linear path could break if the hardcoded equations drift from addrlib; a comment linking to the Mesa commit that derives these equations would help
Recommendations
- Good discipline in including the negative control (unpadded rows test) to verify the 256-byte pitch requirement
- Consider adding a TODO or assert in supports() that blocks linear mode for BC formats until explicitly validated against addrlib
Overall
A well-researched, well-tested implementation. The linear layout extension is cleanly separated from tiled modes. Minor concern about BC format handling in linear mode, but the existing refusal behavior is safe. Ready for merge.
R0Y00
left a comment
There was a problem hiding this comment.
The runtime gate cannot see the pipelines it tracks at 160b21d9. Slot 62 marks the wrapper as builder_pipeline, but neither it nor note_compute_binding_pipeline sets compute_request_key. The only assignment to that field is in the slot 67 specialization, which never records a builder pipeline. Both list_dispatch and the Dispatch arm of list_execute_indirect require a nonzero request key before calling compute_builder_dispatch_allowed. A slot 62 builder wrapper therefore bypasses both gates, and the helper unit test cannot catch that wiring gap.
Please exercise the public creation and dispatch paths with a source-built helper DLL whose basename matches the builder module. The fixture should show that an incomplete builder set refuses both direct and indirect Dispatch with the flag enabled, while a non-builder path and request publication keep their normal behavior. If the experimental flag is intended as a diagnostic cutoff only, describe that limit and still verify that it actually reaches the intended caller.
|
Fixed in The wiring gap was real: the gate was behind
Added a source-built runtime fixture:
Local CTest: |
|
The fix is on |
|
@R0Y00 the gate wiring and the runtime helper-DLL fixture are on |
R0Y00
left a comment
There was a problem hiding this comment.
The new wrapper tag routes slot 62 through the gate. The completed-set path still drops the first Dispatch. On 3e10c525, a source-built WARP control passed two valid desktop DXIL compute shaders through the slot 62 helper and bound one placeholder. The log first said 2 tracked pipelines, all have a desktop PSO; Dispatch allowed, then refused the same Dispatch(1, 1, 1) with requires a desktop compute pipeline and root. The three existing focused tests passed in both Debug and Release /O2 at that head.
The same state transition is present in the latest head 9b2bcc67: make_compute_builder_pipeline publishes the PSO and metadata on the wrapper, while compute_builder_dispatch_allowed returns without rebinding that PSO or refreshing the command list's cached compute pipeline and root. The downstream direct and indirect paths still use that cached state. Please refresh and bind the current pipeline on the list when the gate completes the set, and add a completed-set control that verifies the first direct Dispatch and an indirect Dispatch with valid arguments reach the GPU.
|
Fixed in When the gate completes the set it now refreshes the recording's cached compute state ( The runtime fixture now has a completed-set mode: two valid desktop DXIL compute shaders created through the source-built Local CTest: |
|
Windows dev + release receipt on All three run on WARP: the 106-case unit test, the runtime fixture (incomplete set refused direct + indirect; completed set direct + indirect reaches the list; non-builder untouched), and the slot 67 request check with the gate enabled. |
R0Y00
left a comment
There was a problem hiding this comment.
The first-dispatch state issue is resolved at b163d809. The gate now updates the list's cached pipeline/root state and binds the PSO before either caller continues. I rebuilt the gate unit test, runtime fixture, builder module and slot-67 consumer on local integration tree 7d83e45a against main 98007de5. ctest --preset <dev|release> --no-tests=error -V -R '^startup_compute_builder_gate($|_)' passed 3/3 in Debug /Z7 and 3/3 in Release /O2, with no skips (Windows 11 26200.9974, SDK 10.0.26100, WARP 10.0.26100.9818). The completed set gets past the first direct dispatch and the valid indirect dispatch without the previous refusal, the incomplete set still refuses both paths, and the slot-67 request control still matches. This fixture checks command recording with a source-built no-op shader and does not measure shader output or original EXE behavior.
What changed
The console BVH structure builder's compute stages feed each other through title memory. A stage that runs on data a missing stage never wrote computes store offsets from garbage; the observed failure ran 14 of 35 translated stages and the title died within a second on pointers that had become bounding-box bit patterns.
This adds an opt-in all-or-none gate:
X2W_COMPUTE_BUILDER_GATE=1, off by default.XboxBvhBuilder.dll. An unresolved caller is left untracked rather than guessed.compute_request_key. It is called at both public Dispatch paths: list slot 14Dispatchand list slot 61ExecuteIndirectwith a Dispatch signature.builder gate refused N.The pure classifier and state machine are in
src/startup_stubs/compute_builder_gate.h; the runtime wiring is covered by a source-built module namedXboxBvhBuilder.dllthat calls the public slot 62 vtable entry.Tests
Passed locally on WARP:
startup_compute_builder_gate: 106 cases, 0 failures (classifier, gate off, all present, one missing, on-the-spot creation, permanent off after a failure, non-builder unaffected, full table refusal).startup_compute_builder_gate_runtime: two builder pipelines created through the source-builtXboxBvhBuilder.dll; a directDispatchand an indirectExecuteIndirectare both refused with the gate enabled; the same direct call through a non-builder slot 62 wrapper produces no gate refusal.startup_compute_builder_gate_request_warp: the existing slot 67 request check passes withX2W_COMPUTE_BUILDER_GATE=1, so request publication keeps its normal path.d3d12_xs_shimbuilds with the hook.Limits
The runtime helper uses a fake console container. It proves the caller-module tag and that both public Dispatch paths reach the gate; it does not claim a completed translated builder set. A console DXIL program still fails desktop PSO creation by name and turns the builder off, which is the intended conservative result until real translations exist. A real-title run with the gate on must report either
all have a desktop PSOor one named reason.Refs #870, #1758.
AI-assisted.