Repository navigation
startup: bind a compute heap record whose index is read from a table buffer - #2580
Conversation
…33 and 35) Header-only state in list_compute_root.h with a Linux-testable check. Dispatch (slot 14) is not handled here; the state is exposed through ready() and table() for it. Refs R0Y00#870.
…root or heap change
Compute root constants are kept per list next to the graphics ones, in a shared 16 x 8 word store that refuses parameter >= 16 and offset >= 8. A new compute root signature clears them.
Part of R0Y00#870. Forward Dispatch only with a desktop compute pipeline and root bound and group counts within 65535 per axis; refuse otherwise.
…nts, document slot 14
…t against the bound root Slot 43 clears a parameter's binding when a replacement is rejected, slot 33 clears all bindings, and the compute pipeline records its root so a mismatched pair is refused.
Compute root constants are kept per list next to the graphics ones, in a shared 16 x 8 word store that refuses parameter >= 16 and offset >= 8. A new compute root signature clears them.
Part of R0Y00#870. Forward Dispatch only with a desktop compute pipeline and root bound and group counts within 65535 per axis; refuse otherwise.
…nts, document slot 14
…t against the bound root Slot 43 clears a parameter's binding when a replacement is rejected, slot 33 clears all bindings, and the compute pipeline records its root so a mismatched pair is refused.
Conflicts in d3d12_xs_device.cpp and docs/experiments.md resolved by keeping both sides: the pipeline root out-parameter of the stream builder next to the cached-mesh root, the bound root SRV mask next to the recorded upload SRV addresses, and both table entries and document sections. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Conflicts in d3d12_draw.inl and d3d12_xs_device.cpp resolved by keeping both sides: graphics root constants go through the shared store and still mark the words a slot 40 call set. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A device slot 67 placeholder keeps the key of its published request. At
list slot 14 the stand-in loads the stage cs manifest and compiled
program for that key and records the dispatch: raw buffer inputs and
outputs from hardware descriptors in the recorded compute tables, entry
values from the recorded compute root constants. Other manifest lines
leave the pipeline untranslated; a dispatch that cannot be bound
completely is refused with one logged reason and records nothing.
startup_compute_dispatch_{warp,hardware} drives a source-built program
through the stand-in list and reads the output back, with controls
before translation, without a Dispatch and for a refused output.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Dispatches that arrive before the offline translation no longer use up the lines kept for refusals at bind time. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The per-call refusal lines share one small budget, so a run cannot rank
keys by dispatch count. Each key now keeps its Dispatch count, the calls
recorded and the reason and table descriptor of its first refusal; the
periodic totals are followed by the refused dispatches per reason and the
40 keys with the most dispatches. A manifest that exists but cannot be
bound is counted apart from an absent one ("not modelled").
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A `uav <i> tex2d float table <param> <byte> channels 4` manifest line is bound from the token of the unordered access view the title created in its descriptor memory. Everything else is refused with its own reason: an entry that is no such token, a view the desktop did not create, a view that is not 2D, a format a float4 store cannot target, and a texture bound to two slots of one dispatch. Programs without entry values, inputs or outputs load too: the translated root no longer emits an empty range or drops the table when only outputs exist. The fixture stores through the stand-in's own list into a 32x8 RGBA16_FLOAT texture and reads it back with CopyTextureRegion. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A `srv <i> tex2d table <param> <byte>` manifest line is bound from the token of the shader resource view the title created, through the texture the draw path samples for that resource, uploaded first when the title filled it in memory. `smp` lines become static samplers of the translated root. A dispatch is refused, never bound to a null view, when the entry is no such token, the resource has no desktop texture, the view is not 2D or names a packed format, or the upload fails. Sampler heaps, comparison samplers and other texture kinds keep the translation unavailable. The fixture samples a 1x1 texture into the stored words of the raw buffer case; without a view the dispatch is refused and the output is untouched. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…s test The device check drains the debug layer; a draw runs it on every 64th call and the queue's execute drains the rest. A view token whose resource the caller released is the caller's misuse, as on the draw path. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…puts, print every census key A texture is refused only when the same call reads and writes it; two outputs of one texture share the unordered access state. A packed output view format gets its own refusal reason. The census prints every dispatched key instead of the first 40, and the wording on refused calls says what may already be recorded (an input texture upload). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…tch-translated # Conflicts: # docs/experiments.md
…te-dispatch-textures
… into startup/compute-dispatch-heap-rootconst
…ompute-dispatch-heap-bufindex
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Merged Commands executed locally:
AI-assisted; commands listed were executed locally. |
tedin7
left a comment
There was a problem hiding this comment.
Merged origin/main into the branch (plain merge, no rebase, no force): f56592de.
- One conflict, in
CMakeLists.txt(the compute dispatch test block). Kept both sides: this PR'sstartup_compute_dispatch_heap_word_*and main'sstartup_compute_live_retry_*, both in the sharedset_tests_propertieslist.
Verification, run on the merged tree with the diff of #2710 applied on top (so it is tested as it will land):
x2w_pipe.py win2025 2580 --patch <merge diff + gh pr diff 2710> --regex 'startup_compute_dispatch|startup_gfx2hlsl_heap|startup_pixel_uav|startup_compute_live_retry|startup_stream'- Win2025 dev: 32/32 passed. Win2025 release: 32/32 passed (D3D12 WARP).
- The one conflict between this PR and #2710 (a comment line in
tests/startup_stream_consumer.cpp) was resolved by keeping both sides. When #2710 lands in main, the merge should be mechanical.
Ready to squash-merge once #2710 is in main and CI is green.
AI-assisted; commands listed were executed locally.
|
Win2025 WARP receipt after merging Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
Linux: Code review of this PR's own change: reads the index word only from the recording's upload memory and refuses placed buffers, view tokens and out-of-range words, each with a negative control. The author's mutation table covers all of them. No game progress is claimed. @ChazY11's note about #2580, #2585 and #2596 sharing the same hunks still applies: whichever merges first will make the others conflict. AI-assisted; commands listed were executed locally. |
tedin7
left a comment
There was a problem hiding this comment.
Win2025 WARP receipt after merging origin/main into this branch (new head 9f97acc; the run applied the same merge as a patch on f56592d). Main was merged twice; the only conflict was a comment block in tests/startup_stream_consumer.cpp, kept both sides.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
- Debug (
--preset dev) and Release/O2(--preset release), targetsstartup_stream_consumer d3d12_xs_shim, each: 100% tests passed, 8 of 8. - Tests that ran in both:
startup_compute_dispatch_heap_word_warp,startup_compute_dispatch_heap_word_hardware,startup_compute_dispatch_heap_warp,startup_compute_dispatch_heap_hardware,startup_compute_dispatch_warp,startup_compute_dispatch_hardware,startup_gfx2hlsl_heap_word,startup_gfx2hlsl_heap_record. - Windows Python checks:
tests/startup_gfx2hlsl_heap_word_check.pyrc=0,tests/startup_gfx2hlsl_heap_record_check.pyrc=0. - Note: the
_hardwaretests ran on the VM's WARP adapter only.
Linux: git diff --check origin/main...HEAD, docs_links_check.py, bidi_controls_check.py clean.
Code review of this PR's own change: reads the index word only from the recording's upload memory and refuses placed buffers, view tokens and out-of-range words, each with a negative control. The author's mutation table covers all of them. No game progress is claimed. @ChazY11's note about #2580, #2585 and #2596 sharing the same hunks still applies: whichever merges first will make the others conflict.
AI-assisted; commands listed were executed locally.
Depends on #2532 (this branch is stacked on it; review the commits after its head).
What changed
tools/startup/gfx2hlsl.py: the heap-record index may be a word thats_buffer_load_dword(xN)reads from an unmodified table buffer descriptor, at a literal byte offset or at<root constant word> * k + c(s_mul_i32,s_mulk_i32,s_add_u32,s_add_i32,s_addk_i32with literals, plus anyoffset:modifier), dword-aligned, with no branch target between the arithmetic and the load or between the load and the shift. The manifest line issrv <i> buf heap word table <parameter> <byte> at <offset> [rootconst <parameter> <word> times <k>]. Every other buffer-read index keeps a refusal, now worded... whose index is read from a buffer other than a table buffer at a dispatch-constant offset.src/startup_stubs/d3d12_compute_dispatch.inl: parses the two new forms, reads the table record, computes the byte offset in 32-bit arithmetic, reads the index word and binds the heap record through the existing startup: compute input named by a resource heap record a root constant indexes #2532 path. New refusals, each one logged reason and nothing recorded:a heap index word is not in the list's upload memory(view token or memory outside the list's slot 148 upload allocations) anda heap index word is outside its table buffer(word paststride * num_recordsbytes, with a stride of 0 counted as 1).tests/startup_stream_consumer.cpp:dispatch-heap-wordmodes and three controls.tests/startup_gfx2hlsl_heap_record_check.py: the two "index read from a buffer" controls used a literal offset, which is now accepted; they now read the index at a group-ID offset (s14), which stays refused with the same message prefix.tests/startup_gfx2hlsl_heap_word_check.py,tests/startup_compute_dispatch_heap_word_check.py; registered inCMakeLists.txt, the Windows workflow andAGENTS.md.docs/experiments.mdparagraph next to the heap-record text.Why the CPU read is sound
The word is read when the dispatch is recorded, not when the GPU runs. That is only correct if nothing on the GPU writes the word, so the stand-in reads it only from the recording's upload memory, which no GPU command writes, and refuses a placed buffer or a view token. A per-thread or group-ID index can't be read once on the CPU, and neither can a register sum or a modified descriptor, so all of these keep a refusal.
Tests
Commit under test: ba79c8b (code; the docs commits 5c248dc and 62b5ccc change no code), on #2532 head 1efce19.
Results: both translator checks PASS with reassembly,
startup_translator_check.pyreports 0 failed, ctest 10/10 passed, no exit-77 skips.Environment: Windows 10.0.26300.10075. WARP is the Microsoft Basic Render Driver 10.0.26100.10068. The hardware run used an NVIDIA GeForce RTX 5090 on driver 32.0.16.2135. The debug layer was enabled and logged no error message.
Each control was checked against a mutant: apply the mutant, rebuild, rerun, then revert. No mutant was committed.
times)at)-placedcontrol-pastcontrol (output written)Measured vs hypothesis
Measured: one synthetic program, on WARP and on one physical adapter. In a local set of 158 compute requests that hold such a load, 153 stopped first at the buffer-read index. All 153 change their first refusal, and none translates fully yet. 145 now stop at a non-heap instruction, 6 at the narrower buffer refusal and 2 at an 8-dword record. Their next first refusals:
vcclive at ans_cbranch_execzjoinv_fma_mix_f32src_sccins_mul_i32v_mad_u32_u16src_sccins_mov_b32s_and_b32live at an execz joinv_readfirstlane_b32s_buffer_load_dwordx8live at an execz joinCeiling: 145 programs hold a heap load that now lowers, but counting every refusal site, 120 of the 158 still hold a refused heap-record load:
With the branch-target clear disabled in a scratch copy (a diagnostic only, never committed), the programs with a refused x4 buffer-form site drop from 90 to 10. The main shape that stays refused is therefore an offset computed, or a word read, before a branch target. It stays refused because another path into the join may carry a different word. About 97 programs also load an 8-dword (image) heap record, which stays refused regardless.
Hypothesis, not measured:
🤖 Generated with Claude Code