Skip to content

runtime: resolve readable guest Mesh86 root SRVs - #3813

Draft
lambirou wants to merge 46 commits into
R0Y00:mainfrom
lambirou:codex/mesh86-root-srv-128
Draft

lambirou wants to merge 46 commits into
R0Y00:mainfrom
lambirou:codex/mesh86-root-srv-128

Conversation

@lambirou

@lambirou lambirou commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem

After #3810, the focus run reaches the prologue and key 13c660ac281d07d5 passes the 18-byte material t0, then refuses at t1 root=3:

x2w-mesh86 material refused ... stage=mesh srv=t1 root=3 needed=128 size=0 ... reason=root SRV has no mapped buffer

The four DispatchMesh calls that draw the prologue therefore bind no geometry. The 128-byte range is readable guest memory that no live D3D12 resource owns, so the upload-ring, placement-index and committed-resource lookups all miss.

Change

  • Resolve a readable guest root SRV through the recording-owned upload snapshot, the same backing rule slot 44 already uses for root SRVs and the root-CBV branch uses for scalar loads. The snapshot also makes a range whose guest offset is not 16-byte aligned addressable by the desktop raw SRV.
  • Refuse a range that overlaps a GPU-written resource before copying title bytes, so the desktop bytes stay authoritative.
  • Replace root SRV has no mapped buffer with a named reason and a bounded X2W_D3D12_TRACE_DIRECT_MESH row carrying the address, readability, VirtualQuery state/type, placement result and resource-index result. A reserved page now reports root SRV range is not readable in title memory.

Tests

tests/startup_mesh86_root_srv_check.py publishes a PS-less profile 6 with one 128-byte root SRV, then runs startup_indirect_draw_indexed twice:

  • positive: a committed 64 KiB private page at offset 0x40; the mesh stage reads dwords 0 and 124 and writes depth 0.5.
  • negative: a reserved page; the bind must print the named refusal and leave the depth clear.
. .\tools\dev.ps1
cmake --preset release -DINTAKE_PYTHON=<python>
cmake --build --preset release --target startup_indirect_draw_indexed
python -B tests/startup_mesh86_root_srv_check.py <dxc> out\build\release\startup_indirect_draw_indexed.exe hardware
python -B tests/startup_mesh86_root_srv_check.py <dxc> out\build\release\startup_indirect_draw_indexed.exe warp

Results on this worktree (f40d7a0c):

  • RX 9060 XT, driver 32.0.32029.2010: positive read depth 0.5 (8/8 non-clear pixels, all 0x8000); negative refused by name with depth clear.
  • Microsoft Basic Render Driver 10.0.26100.10068: the 128-byte root SRV binds and DispatchMesh is recorded; WARP then removes the device after the mesh dispatch (0x887a0005), so the depth readback is a capability skip. The negative control passes.
ctest --test-dir out/build/release --no-tests=error -j1 -R '^startup_mesh86_root_srv_' --output-on-failure
1/2 Test #4234: startup_mesh86_root_srv_warp ....... Passed
2/2 Test #4235: startup_mesh86_root_srv_hardware ... Passed

Focus title

The previous focus run stopped at the old root SRV has no mapped buffer refusal. The final integration run with the material and input fixes is launched separately; its refusal or mesh-bind result will be recorded here.

Stack

Stacked on #3725 / #3803 (integration head f4c9e174). Refs #3639, #3641, #870.

mumba17 and others added 30 commits December 1, 2026 08:55
The shared scalar ALU already lowers all three, SCC included. The mesh
frontend refused them with "unsupported mesh instruction or EXEC state".
They now join s_bfe_u32 and s_min_u32 on the shared path, with the same
EXEC and VCC destination refusals.

On a native Mesh86 capture (1,569 distinct slot 86 programs), these were
the first refusal for 555 of them, and 122 more now translate fully.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up on R0Y00#3708. After s_cmp_eq_u32 s20, 0, an s_cselect_b32
behind s_brev_b32 still selects on the compare's SCC, and behind s_not_b32
on (result != 0). Both selects reach the exported X.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adopt the existing committed desktop backing for a placed material view, refresh it from title memory at submit, and copy only changed runs. Keep the existing backing and its fences; a submitted GPU write stops refreshes. Add a source-built two-SRV fixture with range, token, stale, budget and mutant controls.

Refs R0Y00#3640, R0Y00#3638, R0Y00#3545.
Both are already lowered by the shared ALU (the reciprocal as v_rcp_f32,
the shift as an arithmetic right shift by src0 & 31). The mesh lane ALU
list now admits them, so the full_exec || exec_skip rule and the
partial-write merge apply unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up on R0Y00#3709: v-rcp-iflag-f32 now checks that the reciprocal's
bits reach the exported X, as v-ashrrev-i32 already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… in the mesh frontend

The mesh frontend narrowed EXEC only for v_cmpx_eq_u32, ne_u32 and lt_u32,
and for v_cmpx_gt_u32 only in the lane-linear count form. Mesh86 programs
also use v_cmpx_lg_f32, v_cmpx_gt_f32 and a per-lane v_cmpx_gt_u32.

They now get the same EXEC-only narrowing through the shared compare: lg is
an ordered fcmp one and gt_f32 an ordered ogt, so a NaN lane leaves EXEC,
and gt_u32 is icmp ugt. The count form of v_cmpx_gt_u32 is still matched
first. Float abs/neg, SDWA, DPP, clamp and omod stay refused.

Part of R0Y00#3703.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…re the guard

Inside the vertex skip, skinned mesh programs save EXEC, narrow it with
one v_cmpx_ne_u32 and no EXECZ, run straight-line VALU work and restore
the saved vertex mask. The restore was refused as "mesh EXEC write inside
a lane-skip block".

When the CMPX runs, every register is exact for the skip's guard lanes.
A write under the narrowed mask whose old value is still that exact value
(unchanged since the CMPX, or itself merged) is now merged per lane with
it, so it stays exact for the guard. A restore of the guard's saved mask
keeps every register that is unchanged since the CMPX or merged, and
clears the rest, such as a register first written under the narrowed
mask. A second narrowing, or a restore of a mask saved under the narrowed
EXEC, stays refused.

Part of R0Y00#3703.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…at the same restore

The R0Y00#3671 lane-limit proof tags partial VGPRs with the vertex skip's lane
count when the skip closes, so an export under the same count may read them
after full EXEC returns. It required the closing skip's guard to be the
current lane mask. When a nested CMPX skip inside the vertex skip exits to
the same EXEC restore, the nested mask is still current at the outer close,
so the proof was skipped and the restore erased the position VGPRs
("graphics register undefined on an incoming path").

A nested per-lane skip now records the parent guard when it opens directly
after a single CMPX that narrowed it. Nothing ran under the narrowed mask
outside that skip, and the skip branches per thread, so after it closes
every register is exact for each of the parent's lanes. If the parent then
closes at the same instruction, its lane limit applies as before. Any other
narrowing, a write between the CMPX and the EXECZ, or another path arriving
at the restore keeps the previous behavior.

Part of R0Y00#3703 (item 6).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…estore

A chain of per-lane skips, each opened straight after a CMPX that narrows
the skip around it, merges every register per lane when it closes. R0Y00#3710
carried that fact from one nested skip to its parent only, and only when
the parent closed at the same instruction. Skinned mesh programs nest
three such skips inside the vertex skip and close all of them at a restore
of the vertex mask, after which the vertex skip goes on. The restore then
treated every register written since the mask was saved as stale and
cleared it, so the next read refused with "graphics register undefined on
an incoming path".

The carried lane set now passes through any depth of skips closing at one
pc, and an EXEC restore at that pc keeps the register file when the
restored mask is the carried guard of the enclosing skip. The set is tied
to its pc so it never describes a later instruction. A write between the
innermost CMPX and its EXECZ, or a narrowing that is not a CMPX, still
breaks the chain.

Part of R0Y00#3703.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…able V#

The mesh frontend accepted buffer_load_format_x only from a resource heap
slot. Skinned slot 86 programs read the V# whole from a bound descriptor
table instead and were refused with "formatted mesh load lacks an
R32_UINT resource heap contract".

Translator: a format load whose V# comes from a bound table goes through
the shared typed-buffer SRV path, as in vertex and pixel shaders, which
checks the table binding and all four descriptor words. The R0Y00#3720
control that kept this route refused under heap tokens now checks that
it compiles without a token view.

Runtime: slot 86 accepts a one-dword typed_buffer_srv from a descriptor
table and binds it as an R32_UINT buffer view through the same checks as
a typed heap slot (R32_UINT token view, or a raw V# with the identity
component map and a 4-byte stride). A raw table V# must also name a
32-bit format (32_UINT, 32_SINT or 32_FLOAT), so the view returns the
dword the guest load would. Those word 3 checks live in
mesh86_typed_vsharp.h with unit tests and two mutation controls.

Part of R0Y00#3703.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A merged value is exact for the guard's lanes only in the register it was
merged into. Keying the merges by value let a copy of a merged value into
another register pass the restore as exact. Record the merged value per
register instead, and add the copy fixture from review plus a second merge
into the same register.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A raw V# with SWIZZLE_ENABLE (word 1 bit 31) or ADD_TID_ENABLE (word 3
bit 23) set addresses elements differently from the linear R32_UINT view
slot 86 binds, so refuse it on both the heap and the table route. Add a
linear_addressing unit case with two header mutation controls, and run
the mesh86_typed_vsharp tests in the pr preset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pr test filter runs mesh86_typed_vsharp_*, but the pr build preset
only builds its listed targets, so CI reported the tests as not run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Inside a SAVEEXEC then arm the compiler often copies EXEC, runs some
vector work, narrows EXEC with one CMPX, skips with EXECZ and restores the
copy. Each lane runs the work and then the skipped instructions only if
the compare holds: the same if-only region s_and_saveexec_b64 would open
on the compare. The then-arm scan now registers it as a child region and
the mesh frontend lowers it as a nested diamond on the shared compare,
through the existing nested SAVEEXEC join and restore. The region needs
its own restore of the copied register inside the arm; anything else
stays an EXEC read of the then arm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The compiler also narrows the rest of an if-only SAVEEXEC then arm with a
CMPX whose EXECZ skips to the arm's end, leaving the EXEC copy unrestored.
The rest of the arm is then the region, and the SAVEEXEC restore ends
both. Accept that form when the enclosing arm has no else arm (its
inverse would read the narrowed EXEC), and visit the join address again
after the region closes so the enclosing arm ends there too. Regions
chain the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A buffer_load_dword, or a buffer_load_format_x from a descriptor-table
V#, without OFFEN, with a uniform IDXEN index if any and a constant or
uniform SOFFSET, reads the same address in every lane. Until the shader
stores to memory it returns the same dwords in every lane, so mark them
uniform under the same conditions as the heap typed load and let a
following v_readfirstlane read them. The address is checked before the
load, whose destination may be its own index register.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…of' into codex/m1-slot86-evidence

# Conflicts:
#	CMakePresets.json
#	docs/experiments/mesh86-pixel-execz.md
… codex/m1-slot86-evidence

# Conflicts:
#	CMakePresets.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants