Skip to content

experimental: shader: accept vertex scalar-tail joins, proved raw-store descriptors and dead EXEC saves (draft, do not merge) - #3896

Draft
SimSalabimse wants to merge 19 commits into
R0Y00:mainfrom
SimSalabimse:local/native-vertex-walls-11
Draft

SimSalabimse wants to merge 19 commits into
R0Y00:mainfrom
SimSalabimse:local/native-vertex-walls-11

Conversation

@SimSalabimse

Copy link
Copy Markdown
Contributor

Draft, do not merge. Experimental piece of the native graphics path work (getting the native shader path to draw real frames). Do not merge until it has been tested on the Windows test PC.

What it changes

Vertex EXEC regions in the native lowering (src/gfx1013_direct_graphics.inl):

  • A forward uniform s_cbranch_scc0, s_cbranch_scc1 or s_cbranch_vccz may land on a join that reaches a vertex EXEC scalar tail, when the skipped region leaves no side effect still visible.
  • A masked vertex raw store may use a byte-address descriptor, or a descriptor recovered after a join, when a load already proved that user-SGPR slot.
  • A write of the saved EXEC is refused with the opcode and registers named, and is kept when the saved value is restored before any read.

tests/native_vertex_walls_check.py is extended for these shapes, and two of its controls are fixed so they run against the real dump format.

Dependencies

This branch is stacked. It is 19 commits ahead of main: the 17 below the two new commits are the staged native path work that is not on main yet (diagnostics, fixed pixel entry layouts, pixel EXEC arms, vertex fetch before a scalar branch, and an earlier proved raw store in a masked vertex arm). Only the top two commits, "Accept vertex scalar-tail joins, proved raw-store descriptors, and dead EXEC saves" and "Fix two vertex-walls controls so they run against the real dump format", are new in this PR, so review those alone. It overlaps in intent with #3880 (a second vertex EXECZ into a scalar-tail join); the two will need to be reconciled. The branch does not merge cleanly into current main (conflict in src/direct_compute_cache.cpp from the stack) and will be rebased once the stack below it has landed.

Tests

None yet. This has not been built or run through ctest, DXC, WARP or hardware. Planned: native_vertex_walls*, then native_direct_container, native_execz_join_mask_*, native_graphics_vertex_vcc_join_*, native_pixel_exec_arms, native_pixel_entry_* and startup_ngg_slice, one GPU test at a time.

Not measured: whether any title shader reaches the newly accepted shapes in a real run.

AI-assisted (Cursor)

cursoragent and others added 19 commits December 1, 2026 13:10
Add opt-in lines for a graphics descriptor range that does not cover a
shader fetch and for an index view with no proven desktop buffer range.
The coverage check and both refusals are unchanged.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
…op cap.

A refused-table slot whose shadow id is 0 is classified from its 32 title bytes and logged as a title view kind. Native compute inputs log a source class when it changes. X2W_NATIVE_LOOP_GUARD caps scc and execnz back edges; with the variable unset the branch text is unchanged.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
X2W_NATIVE_LOOP_GUARD atomic-adds a space-3 root UAV when the cap trips and Present logs that count. X2W_NATIVE_STALE_INPUT_HOLD reuses the last accepted small snapshot when a new one is zero, leading-zero, or a four-dword splat. X2W_NATIVE_TABLE_TOKEN_EXTEND allows a past-range graphics fetch only when the heap slot is a matching stand-in view token. All three stay off unless the env var starts with 1.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
X2W_LOG_TARGET_BIND names the first target-bind failure for a key, and again when the reason changes. X2W_TARGET_BIND_FIX types a typeless render-target view from a typed resource of the same family and skips a slice outside the resource. Both stay off unless the env var starts with 1.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Undefine pre-existing min and max macros before numeric_limits is used, with a synthetic macro regression check. Add the loop-guard and stale-input dispatch refusals to the triage allowlist.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
An integer RTV variant now gets a uint or int SV_Target as wide as the export, and the export stores the register bits. A float signature row is retyped for that format. A uint or sint signature that disagrees with the format is still refused, and a packed export to an integer target stays refused. Float targets keep the four-wide float row. Colour next to uncompressed depth translates, with the colour target still float when no variant asks.

AI-assisted (Cursor)
X2W_LOG_PIXEL_ENTRY_LAYOUT=1 writes one line per translation key with the address stored at state block A +0x58, the enable mask when one is stored, whether a reviewed sidecar was used, and that sidecar's pixel input address. Unset, the refusal text is unchanged.

AI-assisted (Cursor)
The vertex program is the shared fullscreen triangle. The draw was using a scissor the size of the 8x4 target, so every pixel was overwritten. The other slot-57 draws scissor to the left half and leave the clear on the right.

AI-assisted (Cursor)
One table in src/fixed_pixel_entry.h is what the unreflected and reflected
fixed-entry checks accept. Layouts without an I,J pair allow NUM_INTERP 0..7
when the stage reads no PARAM. The refusal line now includes in_control.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
The pixel shader's SV_Position.w is clip w (WARP and a hardware adapter agree), while the POS_W entry VGPR holds 1/w. SV_IsFrontFace is all ones when true; the entry VGPR holds 1.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
The PSI1 dword at +8 is the full control register. Packed-position and
captured-count checks now use that field, and control refusals log it.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Those ops do not read PARAM, barycentrics, or parameter LDS. vintrp,
ds, s_swappc_b64, and WQM stay refused, and the refusal names the opcode.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
…I,J entries

A raw stage with no position export is the pixel stage, so a stage that only
kills lanes and exports null is no longer ambiguous. A plain v_cmpx before a
skip branch to the null export lowers to a discard with no render target.

On a no-I,J fixed pixel entry, v_interp_mov_f32 from P0 reads a flat PARAM
input (nointerpolation TEXCOORD) when the attribute is below NUM_INTERP and the
vertex stage exports it. Smooth fetches stay refused. The paired vertex stage
takes the fixed vertex ABI and an SV_Position row.

Synthetic fixtures only: controls, refusal controls, and a WARP/hardware draw.
…terpolation in a loop preheader

The fixed vertex fetch prologue sits before the first branch, so a VS with a later
uniform scalar branch no longer counts as non-straight. A branch back to the entry
still refuses it.

A pixel interpolation pair outside every loop body, such as the preheader behind a
zero-trip guard, still reads untouched entry barycentrics. Interpolation inside a loop
body stays refused.

Synthetic fixtures only: controls and refusal controls in native_direct_container.
s_cbranch_execz over a masked pixel arm becomes a lane branch when the
arm cannot be observed by an inactive lane, including nested arms and
non-derivative image reads. A whole-quad discard's empty-wave skip is
dropped when the export is already under the coverage mask. Read-only
uniform image loads and pure pixel ALU feed readfirstlane. Refusals keep
their prefixes and name the exec writer and the skipped effects.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
…-arm control.

A nested arm opens with s_mov_b64 sN, exec. The enclosing arm refused that as a body op, so only top-level arms translated. The enclosing arm now accepts it. A nested proof that fails still leaves the v_cmpx that follows, which the body refuses. The long-arm control now defines the colour register before the arm and builds its 24 moves with a comprehension.

AI-assisted (Cursor)
… branch into a vertex EXEC tail.

A buffer_store_raw whose descriptor, offset and data already lower outside an arm stays in the arm block, so only lanes that pass the execz enter it. Other memory effects keep the same refusal prefix with a detail suffix. A forward s_cbranch_scc0 or s_cbranch_vccz into the scalar tail is a normal scalar edge when SCC or VCC is wave-uniform and the branch follows the EXEC mask; every other entry stays refused.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
The block splitter required a bare label line, but dxc prints the preds comment on it, so the arm-store check saw one block. The backward-branch control put its branch after s_endpgm, where it is never decoded; it now sits before s_endpgm.

AI-assisted (Cursor)
…ad EXEC saves.

A forward uniform s_cbranch_scc0, s_cbranch_scc1, or s_cbranch_vccz may land
on a join that reaches a vertex EXEC scalar tail when the skipped region leaves
no side effect still visible. A masked vertex raw store may use a byte-address
descriptor, or a descriptor recovered after a join, when a load already proved
that user-SGPR slot. A write of the saved EXEC names its opcode and registers,
and is kept when the saved value is restored before any read.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
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.

2 participants