Skip to content

startup: lower constant-lane writelane/readlane spills in translate_mesh57 - #8

Open
SimSalabimse wants to merge 86 commits into
mainfrom
cursor/mesh57-t7-lane-spill-17da
Open

SimSalabimse wants to merge 86 commits into
mainfrom
cursor/mesh57-t7-lane-spill-17da

Conversation

@SimSalabimse

@SimSalabimse SimSalabimse commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Change

Part of R0Y00#2413 item T7: accept the constant-lane v_writelane_b32 / v_readlane_b32 spill idiom in translate_mesh57, mirroring R0Y00#2127 / mesh_entry_aot LANE_SPILL_OPS (and the pixel spill helpers in gfx2hlsl).

Claim: R0Y00#2413 (comment) (main 66026a39).

AI-assisted.

Verification

Host (Linux pe-env / system Python):

python3 -B tests/startup_mesh57_lane_spill_check.py
python3 -B tests/startup_mesh57_skeleton_check.py
python3 -B tests/startup_gfx2hlsl_sgpr_spill_check.py
python3 -B tests/mesh_lane_spill_check.py
python3 -B tests/docs_links_check.py

All reported ok / PASS here.

Windows verification:

ctest --preset release --no-tests=error -j 1 -V -R '^startup_mesh57_lane_spill'

Expected: host startup_mesh57_lane_spill pass; startup_mesh57_lane_spill_warp pass; startup_mesh57_lane_spill_hardware pass or skip 77 without a mesh-capable GPU.

Evidence and follow-up

  • Fixture: hand-assembled words matching tests/startup_mesh57_skeleton.s plus the spill/reload sequence; llvm-mc binary mode is wired in CI.
  • Negative controls: unwritten lane, SGPR-selected lane, lane 64, v_mov into the spill VGPR, missing colour writelane; draw mutant zeroes sp30_3 in HLSL and must change pixels.
  • Bounded lowerers (mesh_entry_aot) are unchanged.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.
Open in Web Open in Cursor 

Ammmae0x and others added 22 commits November 26, 2026 00:28
…ts with CLI suite (R0Y00#2608)

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…0#2613)

X2W_D3D12_VIEW_CENSUS=1 counts new distinct view records by device slot
and logs the record vector capacity and hash bucket count before an
insertion that is expected to grow either. Record identity, ids and
descriptor binding do not change.

Refs R0Y00#1199

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
…Y00#2475)

* startup: lower v_pack_b32_f16 with op_sel and neg/abs in gfx2hlsl

D[15:0] = S0.f16, D[31:16] = S1.f16 (AMD RDNA 2 ISA, VOP3
V_PACK_B32_F16). op_sel[i] selects the high half of source i (LLVM 15:
VOP3_OPSEL); neg and abs act on bit 15 of the selected half, abs first.
The halves are copied as bits, as pixel_aot lowers the same instruction;
no binary16 denormal flush or NaN quieting is modelled (assumed).
Register sources only: an inline float constant on a binary16 operand
is a binary16 value. A destination op_sel bit and clamp are refused.

Test: tests/startup_gfx2hlsl_pack_b32_f16_check.py evaluates the emitted
expression for every op_sel x abs x neg combination over sample register
pairs against a bit reference (2304 cases), plus an SGPR source.
Negative controls: swapped halves and neg-before-abs are caught by the
reference; without the handler the instruction is refused, as on main.

* gfx2hlsl: explain the low/high half reads and the strict op_sel spelling in v_pack_b32_f16 (comments only)

* tests: verify packed binary16 output words on D3D12

---------

Co-authored-by: Royoo <3230853833@qq.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…ght with CLI suite (R0Y00#2609)

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…32 (R0Y00#2623)

A lane-mask register (a compare result, vcc_lo, exec_lo, a saved EXEC
copy) holds only the current lane's bit in the one-lane model, while
RDNA 2 reads the whole mask word when the register is a data operand.
v_cndmask_b32 (both data operands) and v_mov_b32 (plain, e64 and SDWA
DWORD) took such a register through u()/u_src and emitted the lane bit.
They now refuse it, after stripping the source modifiers; the lane
select of v_cndmask is unchanged.

Tests that moved a mask with v_mov_b32 first now expect the new refusal,
or read the mask as a lane select instead so they still reach the
refusal they test. The SDWA check that accepted a whole-mask move now
expects a refusal.

AI-assisted.
…R0Y00#2615)

* tests: run compute store references on a shared renderer device

* tests: compare the descriptor fixture using one device for its reference cases

* tests: use one root signature and compute pipeline for the reference batch

* tests: retain case labels and 320-word diagnostics in the shared compute run

---------

Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…0Y00#2617)

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
- Preserve ordinary vector ALU classification and translator refusal.
- Exercise the authored encodings and dashboard categories.

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…2611)

An unplaced buffer memory SRV (device slot 70, R0Y00#2395) wrapped the whole
allocation holding the view with OpenExistingHeapFromAddress. A 6 KiB view
in a ~2.15 GiB title startup block wrapped the block; afterwards each
VirtualQuery over it took seconds and DirectStorage requests stalled for
~120 s. Wrap only allocations up to the existing 256 MiB span limit (size
from one region-information call); larger ones take the upload copy.

Co-authored-by: lukaslw-lab <291379150+lukaslw-lab@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… with CLI suite (R0Y00#2620)

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
… gfx2hlsl (Part of R0Y00#1723) (R0Y00#2082)

* feat: lower image_sample_d to SampleGrad in gfx2hlsl

Part of R0Y00#1723. 2D, 2D array and 3D gradient samples; image_sample_c_d is refused by name (needs SM 6.8).

* test: register startup_image_sample_d in CMake

Part of R0Y00#1723.

* startup: keep the guest LOD cap for image_sample_d and document the form in gfx2hlsl

* test: WARP and hardware readback for image_sample_d against a CPU reference

* tests: build the implicit Sample negative control with two arguments

---------

Co-authored-by: Royoo <3230853833@qq.com>
…0Y00#2622)

Prove tip translate_mesh57 refuses a back-edge outside the accepted
group-memory exchanges by the named loop reason, with a mutant that
drops the back-edge and an exact-string oracle.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
… gfx2hlsl (Part of R0Y00#1723) (R0Y00#2069)

* fix: carry descriptor pointers through s_add_u32/s_addc_u32 in gfx2hlsl

A table or root pointer advanced by a literal offset now keeps its source and
byte offset, so a following s_load reads the advanced descriptor. A register
addend on a pointer is refused instead of silently keeping the old pointer.

Part of R0Y00#1723

* shader: refuse descriptor pointer advances across branches and detached s_addc_u32 in gfx2hlsl (Part of R0Y00#1723)

* shader: keep the pointer-advance bookkeeping safe for stages without branch state (Part of R0Y00#1723)

* fix: keep the branch-join refusal for pointer adds in branching shaders

* fix: require the matching high-word add before folding an advanced descriptor pointer

* fix: advance 32-bit table pointers without a high word and judge the high operand by content

* fix: keep descriptor pointer pair open until its matching s_addc_u32

* fix: let the descriptor pointer pair pass translate's SCC check, add WARP readback case

* fix: refuse an untracked-offset pointer as a descriptor, run the pointer check in Linux CI

* fix: refuse a root pointer load whose high word was overwritten

* Revert "fix: refuse a root pointer load whose high word was overwritten"

This reverts commit 0f226c5.
…#2634)

shader_cache_rekey.py re-keyed graphics, RTV and slot 67 compute requests
and only counted slot 57 mesh requests. mesh57_key hashes the request
files under a versioned prefix, so after a revision that changes it a
kept cache lost every slot 57 request. The tool now recomputes that key
with mesh57_key and copies .ps57, .root and the .m57 ready marker under
the new name, with the rules the other kinds follow: everything read
first, nothing written on a missing or unreadable part, temporary name
then rename, an existing target left alone. Slot 86 is still only
counted.

AI-assisted.
…shader_census with CLI suite (R0Y00#2437)

* shader: extract main(argv), bounds checks, and struct/zlib guards in shader_census with CLI suite

* tests: accept Python 3.14+ argparse message in shader_census_cli_check

---------

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/mesh57-t7-lane-spill-17da branch from 95c66ba to e131743 Compare November 25, 2026 23:59
chasegrindy and others added 7 commits November 26, 2026 08:01
…R0Y00#2636)

Track ordinary and oversized compute view heaps separately from the graphics lookup. Keep the table when the same heap is rebound and clear it on changes or unset. Cover the recorder in the CPU checks.

Co-authored-by: chasegrindy <302242206+chasegrindy@users.noreply.github.com>
…0Y00#2635)

Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…2638)

* shader: lower s_bitset0/1_b32 in gfx2hlsl (R0Y00#2023 Item J)

Port the pixel_aot bit set/clear SOP1 forms so ordinary vertex and pixel
pipelines that only need an in-place scalar bit update stop refusing at
s_bitset1_b32. SCC stays unchanged; lane masks and descriptor SGPRs refuse.

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

* test: pin sopk descriptor-refusal mutation to sopk-only raise

s_bitset0/1_b32 reused the plain-scalar sym allow-list line, so the
sopk_accum mutant needle was no longer unique. Match the sopk raise that
formats with `base` instead.

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

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
…0Y00#1974)

* feat: record command-list slot 14 Dispatch on the desktop list

Part of R0Y00#870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* fix: pass pipeline root out-param in slot86 mesh cached pipeline build

* tests: drive native slot 14 Dispatch through the stand-in

startup_list_dispatch_native creates a guest device on a desktop
adapter (WARP or hardware, debug layer on when installed) and drives
command-list slots 86, 25, 33, 43, 148, 14, 9 and 139 of the stand-in.
Each refused case must write exactly one
"x2w-render Dispatch(x, y, z) refused: <reason>" line, with the
expected reason, to X2W_TRAP_LOG:

- a root SRV never set;
- a rejected (foreign address) or misaligned slot 43 replacement after
  a valid one;
- a root changed and changed back without a new slot 43;
- a pipeline built against another root;
- a root with a descriptor table, and a root with a static sampler;
- an unset root SRV with zero groups;
- 65536 groups on X;
- a Dispatch on the closed list;
- a Dispatch after Reset without new bindings.

A forwarded case must write no line. The fixture wraps a
pipeline-statistics query around every slot 14 call on an open list,
recorded on the underlying desktop list: CSInvocations must be 4 per
group when forwarded and 0 when refused. The fully bound call is
recorded alone and read back first, so a slot 14 that records nothing
fails on its count. All three recordings are executed to a fence and
the debug layer must report no error.

The skip_srv control drops slot 43 from the first forwarded case and
must report it as refused. Each of these one-line changes to
d3d12_xs_device.cpp makes the WARP and hardware tests fail: the
refusal branch never taken, compute_srv_bound not cleared by slot 33,
the bit not cleared by a rejected slot 43, compute_root_has_arguments
forced false, root_matches_pipeline forced true, and the slot 14
registration removed.

The docs section now names the device fixture and corrects the
sentence on which compute root-argument slots have handlers.

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

* docs: list_dispatch header names slot 43 as forwarded

---------

Co-authored-by: The Void <mrdominogrm@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Royoo <3230853833@qq.com>
…ews (Part of R0Y00#870) (R0Y00#1975)

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* fix: track which compute root constant words were set; drop slot 40 claim
…joins (R0Y00#2507)

* fix: carry descriptor pointers through s_add_u32/s_addc_u32 in gfx2hlsl

A table or root pointer advanced by a literal offset now keeps its source and
byte offset, so a following s_load reads the advanced descriptor. A register
addend on a pointer is refused instead of silently keeping the old pointer.

Part of R0Y00#1723

* shader: refuse descriptor pointer advances across branches and detached s_addc_u32 in gfx2hlsl (Part of R0Y00#1723)

* shader: keep the pointer-advance bookkeeping safe for stages without branch state (Part of R0Y00#1723)

* fix: keep the branch-join refusal for pointer adds in branching shaders

* fix: require the matching high-word add before folding an advanced descriptor pointer

* fix: advance 32-bit table pointers without a high word and judge the high operand by content

* shader: keep 32-bit table offsets at agreeing forward graphics joins

Track a literal table address across copies and forward paths only when the incoming resource and byte offset agree. Exercise the published manifest against two GPU resources and compare all 32 pixels, including the root constant used by the branches.

AI-assisted with Codex (GPT-6.2 Astra, xhigh).

* fix: keep descriptor pointer pair open until its matching s_addc_u32

* tests: cover vertex-table carries and backward edges in pointer propagation

Exercise the two surviving mutations reported on R0Y00#2507 using full source-built programs. AI-assisted with Codex (GPT-6.2 Astra, xhigh).

* fix: let the descriptor pointer pair pass translate's SCC check, add WARP readback case

* fix: refuse an untracked-offset pointer as a descriptor, run the pointer check in Linux CI

* fix: refuse a root pointer load whose high word was overwritten

* Revert "fix: refuse a root pointer load whose high word was overwritten"

This reverts commit 0f226c5.

---------

Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
roansystemlabs and others added 8 commits November 26, 2026 10:10
… the CPU (Part of R0Y00#2413) (R0Y00#2680)

* startup: write nothing for the null export target in gfx2hlsl

The null target carries no channel; its only effect is the vm discard
emitted before it. Same change as the open R0Y00#2026, so a rebase onto it
drops this commit.

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

* startup: translate slot 57 mesh requests with a depth-only pixel stage (Part of R0Y00#2413)

A pixel stage whose only export is the null target was refused with
'slot 57 mesh with a depth-only pixel stage is not covered'. It now
translates with the pair: the pixel stage has no SV_Target, keeps the vm
discard of an alpha test, and the manifest has an empty targets line.

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

* startup: refuse a slot 57 null export mixed with another export (Part of R0Y00#2413)

The slot 57 depth-only profile is a pixel stage whose only export target is
null. A null export before or after an mrt0, mrtz or param0 export passed the
role check and was published; it is now refused in translate_mesh57 before any
source or manifest is written. The general pixel path keeps its mixed forms.

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

* tests: draw a slot 57 depth-only pair and compare depth with the CPU

A source-built gfx1013 pixel stage narrows EXEC with v_cmpx and exports
only to the null target. The pair is drawn twice into a D32 target cleared
to the sentinel 1.0 (depth test LESS) on WARP and hardware; colour must
stay cleared and depth must match the CPU rasteriser, so covered and
discarded pixels are told apart. A reference without the depth writes and
the same mesh without the discard must each fail. Offline controls refuse
the drawn stage with a colour export before its null export (the slot 57
mixed-export refusal) and a mismatched pair in both directions, and check
that pending_keys needs both bytecodes.

Part of R0Y00#2413

---------

Co-authored-by: NiiRoZz <simonin.remi25@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Royoo <3230853833@qq.com>
…for v_readfirstlane_b32 (R0Y00#2446)

* gfx2hlsl: prove a compute buffer load with a uniform address uniform

v_readfirstlane_b32 needs a vector source with the same value in every
active lane. A buffer_load_dword or buffer_load_format_x in a compute
program reads a read-only descriptor (a descriptor used for a load and a
store is already refused), so with a uniform VGPR index or offset, a
uniform scalar offset and exec known in the entry block, every lane reads
the same dword. Mark the destination uniform there. The value has no
recomputable expression, so reads past the entry block still refuse.

Tests: positive cases plus negative controls for a varying VGPR offset, a
varying scalar offset, a graphics stage, no stage kind, unknown exec, a
read after the entry block and a varying overwrite.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* test: WARP readback for readfirstlane of a uniform buffer load

Compute case N: v_readfirstlane_b32 of a buffer load at a uniform address, xored into each lane's own word, dispatched on D3D12 and compared with a CPU reference. A per-lane address is refused. Control n-dropped-broadcast must mismatch.

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
…tem F) (R0Y00#2639)

* shader: lower s_ff1 of a general scalar (R0Y00#2022 Item F)

Keep the compute-entry exec_lo fold to lane 0, and add firstbitlow /
lo-then-hi scan for ordinary SGPR and immediate sources. Lane masks and
descriptor words stay refused. CPU fixture with a negative control.

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

* shader: keep s_ff1 b32 general; leave b64 SGPR pair to R0Y00#2072

Refuse live s_ff1_i32_b64 SGPR pairs (owned by open R0Y00#2072). Keep
zero-extended b64 immediates and add a D3D12 UAV dispatch fixture for
the b32 edge words (including firstbitlow(0) == 0xffffffff).

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

* shader: keep s_ff1_i32_b64 out of SCALAR_BITS after rebase

Main's SCALAR_BITS install was overwriting Stage.op_s_ff1_i32_b64.
Leave the dedicated handler for zero-extended immediates (R0Y00#2022 F / R0Y00#2072).

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

* shader: lower s_ff1_i32_b64 SGPR pairs after R0Y00#2072 merge

Keep the Stage handler for zero-extended immediates and emit the same
64-bit firstbitlow scan for register pairs so bit_scan CI stays green.

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

* test: read back s_ff1_i32_b64 of a live SGPR pair on D3D12 (lo/hi cases against a CPU reference)

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
Co-authored-by: R0D4X <R0D4X@users.noreply.github.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
…translator (R0Y00#2432)

Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
…esh57

Accept the R0Y00#2127 constant-lane v_writelane_b32 / v_readlane_b32 idiom on the
slot 57 mesh request path (Part of R0Y00#2413 T7). Spill-only VGPRs become scalar
slots; ordinary vector use, unwritten lanes and non-constant lanes stay refused.
Source-built host checks and WARP/hardware draw fixtures cover the happy path
and a mutant that zeroes the spilled colour word.

AI-assisted.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Refuse raw EXEC writelane sources under the one-lane model, scan
pre-skeleton instructions so exchange VGPRs stay spill-unsafe, park an
ordinary scalar in lane 63, and mutate only the colour spill assignment
so the multi-decl keeps sp30_63 for DXC.

Refs R0Y00#2413

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
@cursor
cursor Bot force-pushed the cursor/mesh57-t7-lane-spill-17da branch from e529f97 to d4ba1d1 Compare November 26, 2026 02:15
NiiRoZz and others added 21 commits November 26, 2026 03:16
…t indexes (R0Y00#2532)

* feat: record the compute root signature and descriptor tables (slots 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.

* feat: record compute descriptor tables (slot 35) and clear them on a root or heap change

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of R0Y00#870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of R0Y00#870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* fix: pass pipeline root out-param in slot86 mesh cached pipeline build

* fix: track which compute root constant words were set; drop slot 40 claim

* Dispatch translated compute programs with raw table buffers

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>

* Log untranslated compute dispatches on their own line budget

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>

* Count compute dispatches per key with their first refusal

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>

* Dispatch translated compute programs that store to 2D textures

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>

* Dispatch translated compute programs that read 2D textures

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>

* Check a compute manifest without entry values at Dispatch

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* Document texture views and the census of translated compute Dispatch

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* Check the device on every 64th translated Dispatch and drop a liveness 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>

* Compute dispatch: allow two outputs of one texture, refuse packed outputs, 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>

* startup: compute input named by a resource heap record a root constant indexes

gfx2hlsl.py lowers one form of a register-offset load through the directly
indexed resource heap pointer of a compute root signature:

    s_lshl_b32 R, <root constant word>, 5
    s_load_dwordx4 D, s[H:H+1], R      ; s[H+1] a constant zero, no offset:

with no write of R and no branch target in between. D is a buffer descriptor
and the manifest names it `srv <i> buf heap rootconst <parameter> <word>`.
Every other form keeps a refusal that names it, including an index read from
a buffer.

The stand-in records the title memory of the list's view heap on every slot 32
call (it kept only the sampler heap and, for oversized heaps, the wrapper) and
a Dispatch reads the 16-byte descriptor at byte `word << 5` of that memory,
then binds it through the path a table record takes. A record outside the heap
refuses the dispatch and binds nothing.

Checks: tests/startup_gfx2hlsl_heap_record_check.py (manifest and HLSL exact,
19 refused controls, one translator mutation, LLVM 15 reassembly) and
tests/startup_compute_dispatch_heap_check.py on WARP and a physical adapter.

Refs R0Y00#2274

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* startup: drop a heap record control whose branch target was inside an instruction

The second positive case of startup_gfx2hlsl_heap_record_check.py branched to
the second dword of the two-dword heap load. The case with a branch target
before the shift already covers the form outside the entry block. The
experiments entry now says that WARP's descriptor increment is not 32 bytes.

Refs R0Y00#2274

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* startup: read the stage kind as the other handlers do in the heap load

A check added on main calls op_s_load_dwordx8 on a stage built without a
kind; the heap record branch read self.kind directly.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* startup: avoid calling the compute driver after process termination begins

The slot 67 cache owns desktop COM objects until module teardown. During process termination, the driver can already be shut down when static destructors run. Keep normal reference release on explicit unload and skip driver calls only during process termination.

AI-assisted with Codex (GPT-6.2 Astra, xhigh).

* Repair a broken line in the dispatch check

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* Pin four existing texture dispatch refusals: integer view format, manifest version, stage, output also an input

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* Drop the repeated compute root reset left by merging two slot 14 snapshots

list_compute_root cleared compute_srv_bound and recomputed
compute_root_has_arguments twice; the second copy came from the second
R0Y00#1974 snapshot merge and changed nothing.

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

---------

Co-authored-by: tedin7 <tedin7@users.noreply.github.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
* shader: lower the SDWA form of v_cndmask_b32 in gfx2hlsl

The VOP2 select in SDWA form was refused as "SDWA form of v_cndmask_b32".
sdwa() now lowers it as a two-source integer operation: each source takes
its src0_sel/src1_sel field (sext() sign-extends), the select reads VCC,
its fourth operand, the way the plain v_cndmask_b32 does, and
dst_sel/dst_unused place the result. clamp, float modifiers and
UNUSED_SEXT stay refused.

Test: startup_gfx2hlsl_sdwa_check.py pins the emitted text.
startup_gfx2hlsl_sdwa_cndmask_check.py draws a constructed gfx1013 pixel
stage with four selects over 16 x 16 pixels on WARP and hardware (FXC
ps_5_1 and DXC ps_6_0): all 1,024 words match a bit model, and six
mutated selects fail against it and match their own. Its binary mode
requires LLVM 15 to assemble the fixture to the same words. With the
previous translator the fixture is refused.

* tests: keep an SDWA select draw failure across a later capability skip

Review follow-up. run_pixel_words exited 77 on a renderer skip even after
an earlier check had failed, so ctest reported a skip instead of the
failure. It now exits 1 when a check has failed, as R0Y00#2380 did for the
sibling draw fixtures.

Test: with a check failed and the renderer returning 77, the old code
exits 77 and the new code exits 1; without a failure both exit 77.

---------

Co-authored-by: lewisalex86 <lewisalex86@gmail.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
…Y00#1706)

The VEC_U table lowers v_bfe_u32, v_mad_u32_u24, v_lshl_add_u32,
v_add_lshl_u32, v_add3_u32, v_or3_b32, v_and_or_b32, v_lshl_or_b32,
v_xad_u32 and v_bfi_b32, and no check ran any of them.

tests/startup_gfx2hlsl_int3_alu_check.py draws them with the shared
per-lane runner (tests/startup_gfx2hlsl_lane_alu.py, byte-identical to the
copy in the two-source family PR): one operation per lane on flat inputs,
exact result words, against references written from the RDNA 2 ISA
(field extract with S1[4:0]/S2[4:0], 24-bit products, shift counts from
bits 4:0, wrapping sums, bitfield insert), with widths and counts above 31,
bits above bit 23 and wrapping sums. Each operation has one mutated
lowering whose first draw must read its own mutated words.

All 40 draws match on WARP and an RX 6600 through FXC ps_5_1 and DXC
ps_6_0; the 20 mutated draws read their mutated words.

Co-authored-by: x2w-worker <noreply@users.noreply.github.com>
…R0Y00#1745)

The VEC_F table lowers v_rcp_f32, v_rcp_iflag_f32, v_sqrt_f32, v_rsq_f32,
v_exp_f32 and v_log_f32 to 1.0 / x, sqrt, rsqrt, exp2 and log2, and no
check ran any of them.

tests/startup_gfx2hlsl_float_transcendental_check.py draws them with the
shared per-lane runner (byte-identical copy of
tests/startup_gfx2hlsl_lane_alu.py) on powers of two (and 0 and 9 for the
square root), so every result is exact and the draw checks which function
and which base each operation is lowered to, not its precision. Each
operation has a mutated lowering whose first draw must read its own words.

All 24 draws match on WARP and an RX 6600 through FXC ps_5_1 and DXC
ps_6_0, and the 12 mutated draws read their mutated words.

Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
…s (X2W_TRACY) (R0Y00#2573)

* startup: Tracy memory pools for XMemAlloc and the stand-ins' C++ heaps (X2W_TRACY)

X2W_ALLOC, X2W_FREE and X2W_PLOT join the zone macros. XMemAlloc/XMemFree feed the pool "XMemAlloc", each
instrumented DLL reports its operator new/delete as "<target> C++ heap", and XMemVirtualAlloc commits are a
cumulative plot (the title frees those ranges with Win32 calls). Without the option the macros are no-ops.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* test: guard the X2W_TRACY operator new/delete replacement

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
…Y00#1673)

Refs R0Y00#1546. The four binary32 forms of the compute store profile
(v_add_f32, v_sub_f32, v_subrev_f32, v_mul_f32) also lower in their VOP3
_e64 spelling when a source carries a modifier as LLVM 15 prints it on a
register: -v, |v| or -|v|. The modifiers are sign-bit operations on the
word, abs first and then neg, as pixel_aot does for v_cvt_f64_f32_e64 and
the binary64 compare sources, so a signed zero or NaN payload keeps its
other bits and no float abs() or negation is emitted. No opcode is added.

The unmodified _e64 spelling and modifiers on the _e32 spelling stay
refused at the instruction. clamp and mul:2, mul:4, div:2 are refused with
"Unsupported float output modifier"; abs(), neg(), unbalanced bars and
modifiers on constants with "Unsupported float source modifier".

The fixture in tests/compute_alu_negabs_check.py puts each modifier on two
operations, over values of both signs and signed zeros. On WARP the three
read dispatches pass with all 320 words compared; 12 wrong references
(each modifier dropped or exchanged) and 12 mutated HLSL sources (each abs
mask or sign flip dropped, or a flip made an abs) each fail. A binary mode
for the Ubuntu LLVM 15 job checks that the disassembly prints the five
modified lines and translates identically.

Run: ctest --preset dev --no-tests=error -R '^compute_store_aot_f32_negabs_(warp|hardware)$' -V

Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
The VEC_F table lowers v_floor_f32, v_ceil_f32, v_trunc_f32, v_fract_f32
and v_rndne_f32 to HLSL floor, ceil, trunc, frac and round, and no check
ran any of them.

tests/startup_gfx2hlsl_float_round_check.py draws them with the shared
per-lane runner (byte-identical copy of tests/startup_gfx2hlsl_lane_alu.py)
against references written from the RDNA 2 ISA: signed zero results, round
half to even, and fract capped at 0x3f7fffff, on exact halves and
quarters, 1000000.5, the binary32 just below 0.5, 8388607.5 and -2^-30.
Each operation has a mutated lowering whose first draw must read its own
words.

All 20 draws match on WARP and an RX 6600 through FXC ps_5_1 and DXC
ps_6_0, the 10 mutated draws read their mutated words, and frac(-2^-30)
reads 0x3f7fffff on both adapters.

Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
R0Y00#2405 added s_mul_hi_i32 (and an early arity refuse for both mul_hi forms).
The negative control still expected only one non-IndexError survivor.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
…0Y00#2659)

* startup: accept sample_b and get_lod under entry EXEC after a join

image_sample_b and image_get_lod refused any prior branch target even when
EXEC was still the entry mask (M200-01 B/L: outside straight-line with every
lane active). Drop the blocks gate; keep the pixel + exec_known proof.
Fixtures: uniform join before the op accepted; divergent EXEC refused;
WARP draw of join-before sample_b bias -1.

Refs R0Y00#2618

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

* startup: require wave-uniform CF for sample_b and get_lod

Review on R0Y00#2659: dropping only the blocks gate accepted vcc/exec
branches before SampleBias / CalculateLevelOfDetail. Track uniform_cf
(cleared by divergent s_cbranch_*), keep scc-uniform joins, and refuse
vccz/vccnz/execz/execnz before the op in both fixtures.

Refs R0Y00#2618

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

* startup: refuse sample_b and get_lod inside a loop with a divergent back edge

A divergent backward branch after the read still lets lanes of one quad leave the loop at different passes, so the read runs again with uneven quads although no divergent branch precedes it in program order. Record the read sites and the divergent back edges and refuse a read that one of them spans. Tests: synthetic words with s_cbranch_vccnz/execnz right after the read, back to it (fail before, pass after).

* test: allow s_mul_hi_* own-arity templates in scalar table check

R0Y00#2405 added s_mul_hi_i32 (and an early arity refuse for both mul_hi forms).
The negative control still expected only one non-IndexError survivor.

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

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
…0#1703)

* startup: draw the gfx2hlsl two-source integer vector operations

The VEC_U table lowers v_add_nc_u32, v_sub_nc_u32, v_subrev_nc_u32,
v_mul_lo_u32, v_and_b32, v_or_b32, v_xor_b32, v_not_b32, v_lshlrev_b32,
v_lshrrev_b32, v_ashrrev_i32, v_min/max_u32, v_min/max_i32 and
v_mul_u32_u24 to single HLSL expressions; no check ran any of them.

tests/startup_gfx2hlsl_lane_alu.py turns the pixel fixture of
startup_gfx2hlsl_bit_alu_check.py into a runner for table families: one
operation per lane on flat inputs, alternating _e32 and _e64, exact result
words, recorded llvm-mc bodies with a binary mode, controls for modifiers
and operand counts, and one mutated lowering per operation whose draw must
read its own mutated words.

tests/startup_gfx2hlsl_int_alu_check.py is the first family. Its
references follow the RDNA 2 ISA (wrapping arithmetic, rev shifts by
S0[4:0], arithmetic shift, signed/unsigned order, 24-bit products) over
inputs with shift counts above 31, sign-bit values, wrapping products and
bits above bit 23. All 64 draws match on WARP and an RX 6600 through FXC
ps_5_1 and DXC ps_6_0, and the 32 mutated draws read their mutated words.

* build: close the foreach of the int_alu tests after merging main

---------

Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
…tor (R0Y00#2524)

* startup: prove spill-slot reads across branches in gfx2hlsl (R0Y00#2125)

v_writelane_b32 / v_readlane_b32 spill slots were refused in any pixel stage
with branches. A forward must-dataflow over the basic blocks (intersection at
joins, fixed point through loops) now gives the writes that can supply each
read. A single reaching write is accepted unless it lies in the region of a
branch not proven uniform that the read is outside; several reaching writes
are accepted only when none lies in such a region, and the reload then keeps
a constant only if every write stored it and is not claimed uniform. Every
other shape keeps a named refusal: no write on some path, a loop-carried
write, a write in a non-uniform region, a refused reaching write.

Refs R0Y00#2125

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

* test: draw the spill slot across uniform branches on D3D12

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
buffer_load_format_d16_{x,xy,xyz,xyzw} now use the descriptor-format
decoder, with the same validity rule and refusal. Two 16-bit channels
pack per word, x low. The format's type decides the value. FLOAT16
formats give their stored halves. UNORM and SNORM16 give binary16, rounded
to nearest even by long division with denormals kept. 16-bit UINT and
SINT give the 16-bit integer, not a float. 32-bit formats have no d16
rule here and are invalid. An odd count leaves the last word low-16 only:
it reaches a store or an ALU operand through v_and_b32 0xffff, as for
the caller-format D16 reads.

A second fixture makes ten d16 loads over the same t0 words. It compares
all 320 words for one and two groups on WARP and hardware. Three
invalid-format runs must leave u0 unwritten. Seven wrong references and
nine mutated sources must fail, among them integer-as-float, truncated
or flushed binary16, and swapped packing. LLVM 15 assembles both
fixtures and the round trip matches.

Refs R0Y00#2022 (item A, d16 follow-up to the format decoder)

AI-assisted (Claude Code); reviewed and run locally.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
* startup: draw the gfx2hlsl binary32 arithmetic operations

The VEC_F table lowers v_add_f32, v_sub_f32, v_subrev_f32, v_mul_f32,
v_mul_legacy_f32, v_min_f32, v_max_f32, v_fma_f32, v_mad_f32,
v_mad_legacy_f32, v_med3_f32, v_min3_f32 and v_max3_f32, and no check ran
any of them.

tests/startup_gfx2hlsl_float_alu_check.py draws them with the shared
per-lane runner (byte-identical copy of tests/startup_gfx2hlsl_lane_alu.py)
on inputs with exact results, against references written from the RDNA 2
ISA (S1 - S0 for subrev, the legacy multiply's 0 against inf and NaN, the
middle of three). Each operation has one mutated lowering whose first draw
must read its own mutated words.

All 52 draws match on WARP and an RX 6600 through FXC ps_5_1 and DXC
ps_6_0, and the 26 mutated draws read their mutated words. Not covered and
recorded in docs/experiments.md: the translation writes v_fma_f32 and
v_mad_f32 as a * b + c, which WARP rounds twice and the RX 6600 fuses, so
an inexact product reads 0 on one and 2^-24 on the other.

* test: follow main's mad32/med3_32 lowerings in the float ALU mutations

---------

Co-authored-by: x2w-worker <noreply@users.noreply.github.com>
…Y00#2690)

Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
…00#2448)

* startup: bind pixel-stage UAVs from the title's descriptor table

Refs R0Y00#1996 (item F). load_translation reads the 'uav N tex2d table P O'
line that gfx2hlsl.py writes for a pixel-stage image_store instead of
dropping the translation. The translated root signature gets a UAV range
after the SRVs in its view table, and each draw makes the view from the
unordered-access view the title created at that table entry, on mip 0 of a
2D texture. Version 2 manifests (the ones with uav lines) are read again;
each uav line is bound or refused by name, and the raw buffer line of the
vertex-stage stores (R0Y00#2059) stays refused.

Refused by name, nothing bound in place of the view: other line forms
(including a view qualifier or a channels field, as in the compute line)
when the manifest is loaded; at draw time no table, an entry outside the
table, an entry without a view, a view that is not a UAV, a resource
without ALLOW_UNORDERED_ACCESS, other resource or view dimensions, mips and
planes, integer, sRGB and non-colour formats, no typed UAV store, and a
texture that is also an SRV, a render target or the depth texture of the
draw. These checks run before any view of the draw is written. Indirect
draws refuse a translation with a uav line.

tests/startup_pixel_uav_check.py draws the source-built program of R0Y00#2155
through the runtime and reads back every word of four sentinel textures.

AI-assisted.

* test: pixel UAV no-ua case expects the empty-entry refusal now that skipped UAVs record no view

---------

Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
…2642)

* shader: lower s_quadmask_b32 in gfx2hlsl (R0Y00#1723)

Port the pixel_aot nibble-collapse SOP1 (each 4-bit group to one bit of D).
SCC is the nonzero test of the result. Lane masks and descriptor words are
refused. CPU fixture with a negative control.

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

* test: add D3D12 WARP dispatch readback for s_quadmask_b32

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

* docs: note s_quadmask_b32 WARP dispatch ctest

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

* test: allow s_mul_hi_* own-arity templates in scalar table check

R0Y00#2405 added s_mul_hi_i32 (and an early arity refuse for both mul_hi forms).
The negative control still expected only one non-IndexError survivor.

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

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
…adbacks (R0Y00#2693)

Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
…ns in gfx2hlsl (R0Y00#2698)

Lower the RDNA 2 `null` scalar operand (`code 125`) and replace
`reg_range(...)[1]` `TypeError` crashes on non-SGPR scalar destinations
with explicit `Unsupported` refusals in `tools/startup/gfx2hlsl.py`:

- Read `null` (`125`) as wave-uniform `0x00000000u` in `Stage.u`,
  `Stage.const_u32`, `Stage.uniform_source`, `Stage.scalar_const`,
  `SCALAR_CONST_FOLD`, `scalar_bitset`, `op_s_bfm_b32`, and
  `VOP3_ONLY_VEC_U` in `Stage.lower`.
- Lower 32-bit plain numeric/constant SALU writes to `null` in
  `Stage.scalar` and `op_s_bfm_b32`, discarding the register write while
  still emitting modeled `SCC` updates (`s_and_b32`, `s_or_b32`,
  `s_xor_b32`, `s_andn2_b32`, `s_orn2_b32`, `s_not_b32`, `s_nand_b32`,
  `s_nor_b32`, `s_xnor_b32`, `s_lshl_b32`, `s_lshr_b32`, `s_ashr_i32`,
  `s_bfe_u32`, `s_absdiff_i32`) and preserving `SCC` on non-SCC writes
  (`s_mov_b32`, `s_movk_i32`, `s_brev_b32`, `s_mul_i32`, `s_bfm_b32`).
- Refuse `_b64`, lane-mask (`exec`/`vcc`/mask SGPR), `SCC_UNMODELLED`,
  and descriptor/pointer writes to `null`, as well as unmodelled scalar
  destinations (`vcc_hi`, `exec_hi`, `ttmp*`), with explicit
  `gfx2hlsl.Unsupported` reasons instead of `TypeError`.

Add `tests/startup_gfx2hlsl_scalar_null_check.py` covering LLVM 15
`llvm-mc` / `libLLVM` round-trips, boundary `SCC` evaluation across all
14 32-bit SCC-writing SALU ops, destination refusal sweeps across all 48
`SCA` ops plus `s_bfm_b32`, and WARP / hardware D3D12 pixel draws (`FXC
ps_5_1` + `DXC ps_6_0`) and root-constant SALU+branch buffer readbacks
with negative controls.

Refs R0Y00#2618, R0Y00#1723, R0Y00#2463.

AI-assisted.
… T6) (R0Y00#2630)

* startup: lower constant-trip mesh57 loops outside exchanges (R0Y00#2413 T6)

Accept one proven constant-trip SCC back-edge in translate_mesh57 by unrolling
it; keep data-dependent, EXEC-carrying, and unconditional loops refused by the
existing named reason. Source-built fixture draws with a CPU rasteriser oracle;
the once-through mutant fails that reference.

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

* tests: spell mesh57 loop branches as numeric SOPP offsets

llvm-mc encodes labeled s_cbranch targets differently from the relative
SIMM16 words the fixture embeds; match startup_mesh57_skeleton.s style.

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

* startup: tighten mesh57 loop trip signedness and once-through draw oracle

Take compare signedness alone, refuse reversed s_sub trip steps, and require
a real draw-reference mismatch for the once-through mutant.

Refs R0Y00#2413

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

* test: allow s_mul_hi_* own-arity templates in scalar table check

R0Y00#2405 added s_mul_hi_i32 (and an early arity refuse for both mul_hi forms).
The negative control still expected only one non-IndexError survivor.

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

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
…-id bit (R0Y00#2455)

* gfx2hlsl: prove a compute buffer load with a uniform address uniform

v_readfirstlane_b32 needs a vector source with the same value in every
active lane. A buffer_load_dword or buffer_load_format_x in a compute
program reads a read-only descriptor (a descriptor used for a load and a
store is already refused), so with a uniform VGPR index or offset, a
uniform scalar offset and exec known in the entry block, every lane reads
the same dword. Mark the destination uniform there. The value has no
recomputable expression, so reads past the entry block still refuse.

Tests: positive cases plus negative controls for a varying VGPR offset, a
varying scalar offset, a graphics stage, no stage kind, unknown exec, a
read after the entry block and a varying overwrite.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* gfx2hlsl: prove a thread-id shift uniform when it clears every thread-id bit

In a compute entry block, v_lshrrev_b32 by n of the X thread id (v0, each
local id has its own VGPR) is 0 in every lane when the group's X size is at
most 1 << n. The same holds for (uniform << K) + v0 built by
v_lshl_add_u32 with n <= K and size <= 1 << K: the low K bits of the base
are clear, the sum does not carry, and the shifted value is the uniform
part. The nearest earlier writer is the definition (program order is
execution order in the entry block), v0 must be unwritten at it and the
scalar unwritten after it. The value records a recomputable expression, so
a read past the entry block is accepted too, until the scalar changes.

Everything else keeps refusing by name: a larger group, a shift larger
than the scale, a varying or rewritten scalar, a vector base, a rewritten
v0, another stage and any modifier.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.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.