You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cpp-migration: pass captured heap view types into the in-runtime native compute route (#2958) #3023
Target branch cpp-migration. Follow-up to #2908 (#2972), part of #2935.
Problem. The in-process native compute route of #2958 (X2W_NATIVE_SHADERS, src/startup_stubs/d3d12_compute_dispatch.inl) translates slot 67 requests with x2w::translate_compute(read_compute_request(path), 0, true). That call takes no HeapViewContract, so a request that reads a GPU-selected global SRV heap slot is refused on this route, although #2972 can translate it offline when the view types are known.
Plan.
Record each heap slot's view type when the stand-in creates the SRV (classify_global_srv_view from src/startup_stubs/native_global_srv.h).
At Dispatch, resolve the slots the request can select and build the contract from the recorded types.
Pass the contract into the translation of the slot 67 request (today prepare_direct_compute refuses a contract for non-container requests, and translate_compute has no contract parameter).
Before the Dispatch, check that the live heap still matches the contract; otherwise refuse and keep the gfx2hlsl.py fallback.
Test. A source-built compute workload through the stand-in that reads a buffer, a 2D texture and an empty slot through a GPU-selected index, _warp (capability skip where needed) and _hardware, plus a negative control that indexes one slot off.
I'm taking it; a PR follows. Environment: Windows 11 build 26200, NVIDIA GeForce RTX 3080, plus WARP.
A census over a local start-up capture (compile_dxil --refusals, 2,689 slot 67 requests, counts only) gives 941 first refusals of this kind. In those programs the heap index is read from buffer data per wave, so the runtime cannot resolve it at Dispatch. Behind the contract there are more walls:
Typed loads (buffer_load_format_*) through the heap descriptor. With 1 done in a local prototype, 906 requests stop here.
Runtime: a shader-visible heap with title slot k at desktop index k as raw views, plus a contract check over all selectable slots at Dispatch (one captured slot is not enough for per-wave selection).
I'll continue with 2 next unless someone else is on it.
Runtime acceptance criteria for stage 3 (from R0Y00's review of #3025). Before the runtime supplies a raw-view contract for GPU-selected slots, its fixture must check both of these:
a selectable slot whose guest descriptor has a stride above 1 (byte count num_records * stride), read through the byte-address rewrite;
a slot whose guest byte count does not match the desktop view: the dispatch must refuse it before the shader runs, not read past or short of the view.
#3025 does not cover either: its descriptor words stay symbolic.
Step 2a is #3034 (builds on #3025): formatted loads (tbuffer_load_format_*) through the byte-address rewritten descriptor, table or GPU-selected heap slot, now read the same raw view as the raw load.
Additions to the stage-3 runtime acceptance criteria from that change:
A formatted load bounds its whole element with the desktop raw view's size (getDimensions), not with the guest window's byte count. The runtime must create the raw view for a GPU-selected heap window with exactly the guest window's byte count (num_records * max(stride, 1)). The startup manifest route already sizes a table window that way.
The descriptor's DST_SEL (word 3) is not applied; only the identity channel order is translated. The runtime contract should either check identity DST_SEL on every selectable slot or the translator has to apply it.
Typed heap loads (buffer_load_format_*) are the next step and need their own view contract.
Typed heap loads: #3042 adds HeapViewContract::typed_dword for one-channel 32-bit typed buffer slots (buffer_load_format_x with an idxen index through the GPU-selected heap descriptor), with .views channel metadata and a fixture section.
On the local capture (counts only) the 906 typed heap loads all have that one-channel shape, but with typed_dword forced, 895 of those programs then stop at a raw read of another heap slot: they read the heap raw and typed through different selectors. Covering them needs more than one captured selection per dispatch (raw and typed contracts per load class), which I plan as the next step before the runtime contract.
Translator side of the mixed case is in #3063: HeapViewContract::raw_and_typed_dword lets one program read some GPU-selected heap slots raw and others with one-channel typed loads (the kind of each load picks the path). .views gains also <slot> <type> lines for further selections of the same dispatch (selector word k = selection k).
For stage 3 (runtime), additional acceptance points from this step:
the runtime must produce one selection per selector word (also lines), deduplicated; a slot named twice is refused;
for every slot a raw load can select the raw_buffer conditions hold, for every slot a typed load can select the typed_dword conditions; the translator cannot check which index feeds which load.
@JB2WIN I’m checking the ordered compiler prerequisites for retargeting #3063. I’ll start with a narrowly scoped carry of your merged #3034 byte-window MTBUF change onto main, preserving authorship and rerunning its own controls. I found no open main carry in the PR search. The in-process heap contract stays with your existing work here.
The first prerequisite is ready for review in #3232. Release and Debug passed the RTX 4070 replay, and the same four tests passed with Agility 1.620.2 and WARP 1.0.22. I have #3042 applied locally on top with its typed-slot replay passing in Release, and will hold its main PR until #3232 lands.
Activity
coordination: claim native/compute-heap-view-contract (R0Y00#3023 hea…
JB2WIN commentedon Nov 27, 2026
Update: the first step is #3025.
A census over a local start-up capture (
compile_dxil --refusals, 2,689 slot 67 requests, counts only) gives 941 first refusals of this kind. In those programs the heap index is read from buffer data per wave, so the runtime cannot resolve it at Dispatch. Behind the contract there are more walls:buffer_load_format_*) through the heap descriptor. With 1 done in a local prototype, 906 requests stop here.I'll continue with 2 next unless someone else is on it.
AI-assisted.
JB2WIN commentedon Nov 27, 2026
Runtime acceptance criteria for stage 3 (from R0Y00's review of #3025). Before the runtime supplies a raw-view contract for GPU-selected slots, its fixture must check both of these:
num_records * stride), read through the byte-address rewrite;#3025 does not cover either: its descriptor words stay symbolic.
AI-assisted.
native: refuse a heap byte window only for a loop around its heap load
coordination: claim native/heap-typed-load (R0Y00#3023 stage 2 typed …
JB2WIN commentedon Nov 27, 2026
Step 2a is #3034 (builds on #3025): formatted loads (
tbuffer_load_format_*) through the byte-address rewritten descriptor, table or GPU-selected heap slot, now read the same raw view as the raw load.Additions to the stage-3 runtime acceptance criteria from that change:
getDimensions), not with the guest window's byte count. The runtime must create the raw view for a GPU-selected heap window with exactly the guest window's byte count (num_records * max(stride, 1)). The startup manifest route already sizes a table window that way.Typed heap loads (
buffer_load_format_*) are the next step and need their own view contract.AI-assisted.
native: read the byte-address rewrite of a GPU-selected heap descript…
native: read formatted loads through a byte-address rewritten descriptor
coordination: claim native/heap-typed-dword-load (R0Y00#3023 typed he…
native: read formatted loads through byte-address rewritten descripto…
JB2WIN commentedon Nov 27, 2026
Typed heap loads: #3042 adds
HeapViewContract::typed_dwordfor one-channel 32-bit typed buffer slots (buffer_load_format_xwith anidxenindex through the GPU-selected heap descriptor), with.viewschannel metadata and a fixture section.On the local capture (counts only) the 906 typed heap loads all have that one-channel shape, but with
typed_dwordforced, 895 of those programs then stop at a raw read of another heap slot: they read the heap raw and typed through different selectors. Covering them needs more than one captured selection per dispatch (raw and typed contracts per load class), which I plan as the next step before the runtime contract.AI-assisted.
coordination: release native/heap-typed-load (R0Y00#3023 stage 2 type…
native: read single-channel typed buffers from GPU-selected heap slots (
coordination: release native/heap-typed-dword-load (R0Y00#3023 typed …
coordination: claim native/heap-mixed-raw-typed (R0Y00#3023 mixed raw…
coordination: claim native/heap-mixed-raw-typed (R0Y00#3023 mixed raw…
JB2WIN commentedon Nov 27, 2026
Translator side of the mixed case is in #3063:
HeapViewContract::raw_and_typed_dwordlets one program read some GPU-selected heap slots raw and others with one-channel typed loads (the kind of each load picks the path)..viewsgainsalso <slot> <type>lines for further selections of the same dispatch (selector word k = selection k).For stage 3 (runtime), additional acceptance points from this step:
alsolines), deduplicated; a slot named twice is refused;raw_bufferconditions hold, for every slot a typed load can select thetyped_dwordconditions; the translator cannot check which index feeds which load.AI-assisted.
RonLogic commentedon Nov 28, 2026
@JB2WIN I’m checking the ordered compiler prerequisites for retargeting #3063. I’ll start with a narrowly scoped carry of your merged #3034 byte-window MTBUF change onto
main, preserving authorship and rerunning its own controls. I found no openmaincarry in the PR search. The in-process heap contract stays with your existing work here.RonLogic commentedon Nov 28, 2026
The first prerequisite is ready for review in #3232. Release and Debug passed the RTX 4070 replay, and the same four tests passed with Agility 1.620.2 and WARP 1.0.22. I have #3042 applied locally on top with its typed-slot replay passing in Release, and will hold its main PR until #3232 lands.
native: read formatted loads through a byte-address rewritten descriptor