Repository navigation
startup: bind LOD-clamped static samplers (smpl) in the translated compute Dispatch - #2585
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>
Upstream now records the compute root and tables (slots 33 and 35) and has its own DllMain with x2w_startup::d3d12_process_terminating, so this branch's flag and DllMain go. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…compute-dispatch-heap-rootconst
…compute-dispatch-heap-bufindex
…compute-dispatch-samplers
Two device-free checks pass, and five mutations of the heap-index tracking are all caughtThe The other three checks in this PR ( Mutations of
|
| mutation | caught by |
|---|---|
the root-constant branch returns scale 2 instead of 1 |
heap_word |
| the root-constant branch removed entirely | heap_word |
the rc mark no longer recognised (return mark[1:] if … else None → return None) |
heap_word |
heap_index.clear() at a join replaced with pass |
heap_record and heap_word |
any write stops ending a register's mark (wrote = scalar_destinations(…) → set()) |
heap_record and heap_word |
The first three are heap_word's own business and it catches all three, which is what you would want from a check added
specifically for "6 more forms".
The last two are the interesting ones because they are caught by both, and they are the invariants that make the whole
scheme sound:
- clearing at a join — the comment says "another path into the join may hold a different word". Without the clear, a
mark from one predecessor survives into a block reachable from another, and the index is named for the wrong word. - any write ends a mark —
wrote = set()means a laters_movover the register leaves the stale mark in place, so
the new value is named by the old word's identity.
Both are invisible unless a fixture has two paths into a join and a write between the naming and the use, and both
fixtures here do.
Note on the two PRs
This PR's gfx2hlsl.py hunk is a superset of the earlier heap-record change I reviewed (heap_record is unchanged apart
from being joined by heap_word), so the mutations above cover the whole current state of the file's heap handling rather
than only the delta. If the two are stacked, the merged result is what I measured.
Method note
Four of my first five anchors missed purely on indentation — I had copied the leading spaces from a git diff excerpt,
where the + prefix shifts the column by one. Anchors taken by line number from the file itself (Get-Content indexed)
all hit. Worth doing that way in a file this size.
AI-assisted; pure Python, Windows 11 build 26300, no DXC or GPU for the rows above.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…compute-dispatch-samplers
…tch-translated # Conflicts: # docs/experiments.md
…te-dispatch-textures
… into startup/compute-dispatch-heap-rootconst
…ompute-dispatch-heap-bufindex
…mpute-dispatch-samplers
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>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Not merging yet: this branch still carries the commits of two open PRs, so it cannot land on its own.
Suggested path for @NiiRoZz: land #2470 and #2490 first (or rebuild this branch from current main so only the No push was made to the branch. No test was run on this head. AI-assisted; commands listed were executed locally. |
|
Merged origin/main into this branch (merge commit 03aa5ff, no force, no rebase). Conflicts were the pre-squash copies of the compute Dispatch chain; #2470 and #2490 are already in main via #2532 (checked by sm3, confirmed by MasterDomino in the #2470 thread), so I kept main's side everywhere and kept only this PR's own Review of what is left:
Verification (Windows Server 2025, merged head 03aa5ff, applied on top of the PR head):
AI-assisted; commands listed were executed locally. |
tedin7
left a comment
There was a problem hiding this comment.
Merged origin/main into this branch (merge commit 03aa5ff, no force, no rebase). Conflicts were the pre-squash copies of the compute Dispatch chain; #2470 and #2490 are already in main via #2532 (checked by sm3, confirmed by MasterDomino in the #2470 thread), so I kept main's side everywhere and kept only this PR's own smpl change. git diff origin/main --stat now shows 4 files only: d3d12_compute_dispatch.inl (+7), startup_stream_consumer.cpp, startup_compute_dispatch_texture_check.py, docs/experiments.md.
Review of what is left:
smpandsmpllines go through the draw path'sread_manifest_line;smpcandsmpheaprefuse with their own reasons. Sound.- The new filtered case (2x1 texture, wrap + linear sampler reads 0.5 at the left edge; clamp control reads 0;
smpc/smpheaprefused with one logged reason, output untouched) guards the behaviour: point or clamp would read 0.
Verification (Windows Server 2025, merged head 03aa5ff, applied on top of the PR head):
- dev:
ctest --preset dev -R '^startup_compute_dispatch_': 100% tests passed out of 8 (warp and hardware for dispatch, texture, heap, heap_word). - release:
ctest --preset release -R '^startup_compute_dispatch_' --no-tests=error: 8/8 passed. - Linux:
python3 tests/docs_links_check.py,python3 tests/bidi_controls_check.py,git diff --check origin/main...HEAD: clean. - RTX 3090: not available (pod full).
AI-assisted; commands listed were executed locally.
Depends on #2580. Refs #2274.
What changed
src/startup_stubs/d3d12_compute_dispatch.inl: the compute manifest reader acceptssmpl <i> <w0> <w1> <w2> <w3>lines, the static sampler with the descriptor's MinLOD and MaxLOD that the translator writes since startup: write smpl for LOD-limited samplers in the compute manifest #2482. They go through the draw path's own code (TranslatedSamplers::read_manifest_line,decode_staticsandcreate_translated_rootintranslated_sampler_bindings.h), so no second sampler mechanism is added. For compute, the only difference from a draw is that the root signature is set withSetComputeRootSignature; static samplers need nothing else at Dispatch.smpcgives "a comparison sampler" andsmpheapgives "a sampler from the sampler heap". Binding the heap table for compute would need the draw path's sampler snapshot (snapshot_samplers,create_sampler_snapshot_heap) taken from the compute root's sampler heap pointer,SetDescriptorHeapswith the sampler heap, andSetComputeRootDescriptorTable. That is left for the first program that needs it.tests/startup_compute_dispatch_texture_check.pyandtests/startup_stream_consumer.cpp: a new filtered case. The existing sampling case uses a 1x1 texture, so it cannot tell filter or address modes apart. The new case puts a constant wrap, linear sampler (MAX_LOD 12, so the translator writessmpl 0 0x0 0xc00000 0x18500000 0x0) in the texture input program. The consumer's newdispatch-sampled-2x1mode samples a 2x1 RGBA8 texture whose left texel has red 0 and right texel red 1.0, at the left edge. Only a linear filter that wraps reads 0.5 there.smpcline and an addedsmpheapline each refuse with one logged reason and leave the output untouched.docs/experiments.md: a subsection under the translated compute Dispatch section.Measured
Result: 8 of 8 passed (WARP and hardware for
startup_compute_dispatch,_texture,_heapand_heap_word), with no capability skips.New filtered case, on both adapters: every thread read red 0.5. With the clamp sampler, every thread read red 0. The
smpcandsmpheapcontrols refused with their reasons and left the output untouched.Negative control for the code change: with the
smplmatch disabled,startup_compute_dispatch_texture_warpfails. The Dispatch logsrefused: a sampler that is not a plain static one.Local census (counts only): 7 compute programs, about 135 thousand Dispatch calls, refused first for "a sampler that is not a plain static one". All 7 manifests hold only
smplsampler lines: 6 with one line and 1 with two. None hassmpcorsmpheap. In 6 of the 7, word 0 is 0x92 (clamp in U, V and W). The other uses wrap. When their manifests are read against the new classifier, every line of all 7 is accepted and each has a compiled program, so all 7 now pass manifest loading.Hypothesis / unverified
🤖 Generated with Claude Code