Skip to content

startup: pixel image_store sparse DMASK as component stores - #16

Open
SimSalabimse wants to merge 242 commits into
mainfrom
cursor/image-store-sparse-dmask-e885
Open

SimSalabimse wants to merge 242 commits into
mainfrom
cursor/image-store-sparse-dmask-e885

Conversation

@SimSalabimse

@SimSalabimse SimSalabimse commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Change

Refs R0Y00#2618.

A pixel-stage 2D image_store with a partial DMASK now writes only the selected components (w0[uint2(x, y)].xz = float2(...)). It does not read the texel. A float4 read-modify-write is not used: that form stores every channel, so two invocations that hit one texel with disjoint masks can put stale values back, and the load needs a typed UAV format.

Compute stores, D16 stores and array stores still require dmask:0xf. The full-mask store is unchanged.

A source-built fixture draws two pixels in one pass. Both address texel (1, 2). One stores x (dmask:0x1, 1.0) and the other stores z (dmask:0x4, 2.0). From a -1 clear the texel must read back (1, -1, 2, -1). Writing the second value into y instead of z must mismatch.

A manifest line may end in typedload when the binding must support a typed UAV load. The translator does not emit that word for a component store. A binding that asks for the load is refused before the draw when the format has no typed UAV load, and no view is written.

Verification

Commit under test: 3162ce77, on top of a merge of upstream main 8c9f168f.

Linux, Python 3.12, LLVM 15.0.7:

./out/pe-env/bin/python -B tests/startup_pixel_image_store_check.py
./out/pe-env/bin/python -B tests/startup_pixel_image_store_check.py binary llvm-mc-15
./out/pe-env/bin/python -B tests/startup_compute_image_store_check.py
./out/pe-env/bin/python -B tests/startup_compute_image_store_d16_check.py

All four passed. The same interpreter then ran the python-linux list (209 checks) and the LLVM 15 pixel-binary list (135 checks). Both runs printed all N checks passed. No DXC, WARP or hardware draw was run here.

Windows, still to run on the test PC. A capability skip (77) is neither a pass nor a failure:

ctest --preset dev --no-tests=error -R '^startup_pixel_image_store' -V

That selection is startup_pixel_image_store_controls, startup_pixel_image_store_warp and startup_pixel_image_store_hardware. The draw modes cover the sparse dmask:0x5 store, the two-pixel same-texel store, the y-for-z mutation, and --startup-image-store-reject-load.

Evidence and follow-up

The fixtures are hand-assembled gfx1013 words, checked against llvm-mc -arch=amdgcn -mcpu=gfx1013. No game files or captured programs.

The component store does not need exclusive texel ownership or a typed UAV load, because it never reads the texel and never writes an unselected channel. DXC must keep the HLSL swizzle as a masked store; if a driver expands it to a full-vector write, the same-texel readback is the failure.

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.

AI-assisted (Cursor)

Open in Web Open in Cursor 

Ammmae0x and others added 30 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>
…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>
* tests: split four long CPU checks into parallel ctest cases

* docs: say in the file headers that CTest runs the parts and check runs them all

* fix: let the no-path x87 aggregate modes parse without file arguments
Alexofbulgaria and others added 12 commits November 26, 2026 12:12
x2w_xmem_write_physical created a backing section for any page number it
was given. A write to a page that was never granted, or whose grant had
been released, left a section outside any grant, and the next grant of
that page number mapped the written bytes instead of zeros.

The write now checks era_physical::owns for every token, under the same
mutex as the section lookup, and refuses an unowned page the way
XMemMapPhysicalPages does: FALSE with ERROR_INVALID_PARAMETER, before any
section is created for it.

tests/xmem_physical_write_owner_check.py (CTest xmem_physical_write_owner)
covers a never-granted page, a released page, an unowned second token and
the permissive token shape, with controls for a write to a granted page
and for a written page that is released and granted again.

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

parse_when checked that the parsed number was finite before adding the
running cursor for a relative time (@+<s>), so 1@+1e308,2@+1e308 was
accepted with at = inf, while the absolute 2@1e999 is rejected as "bad
time". A wait at infinity never begins and silently blocks the rest of
the script. Check the resulting time instead, so both forms share the
rule and the reason. Finite results are unchanged.

Rows added to the syntax test: relative overflow for a button entry,
wait and mark (the earlier items stay accepted), the absolute control,
and a large finite relative sum that is still accepted.

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

* tests: accept 4 ulps for v_log_f32 in the transcendental fixture

An RTX 4090 reads log2(0.125) as c03fffff, 1 ulp above -3.0, through both FXC
and DXC (R0Y00#2797). The Direct3D 11.3 functional specification bounds log to
2^-21 relative error, or 2^-21 absolute for inputs in [0.5, 2], which is at
least 4 ulps of every result in the fixture.

The lane runner takes an optional per-operation ulp bound. The renderer still
compares exactly. A mismatch passes only if every reported actual= lane is
within the bound, and the mutated draw must land within the bound of the
mutation and outside the bound of the reference. Zero ulps stays exact
equality, so the integer families are unchanged.

Refs R0Y00#2797

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

* tests: do not tolerate a log2 mismatch that also logged debug errors

The renderer exits 1 on a readback mismatch whether or not the debug layer
reported errors, so an in-bound lane could hide a validation failure. The
runner now uses the actual= words only from the startup_flat_param mismatch
line of a run whose debug_errors is 0. The experiments note records the 0 and
1 ulp negative controls on the RTX 4090.

Refs R0Y00#2797

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

* tests: note that a nonzero ulp bound accepts either signed zero

Refs R0Y00#2797

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…ps its sign (R0Y00#2818)

On an RX 5700 XT (R0Y00#2729) and an RX 9070 XT (R0Y00#2746) the -0 case of
startup_gfx2hlsl_fma_mix_dispatch_hardware read back 00000000. Their probes
lost the sign only when a binary16 operand widened by f16tof32 fed a
non-precise multiply or mad. Non-precise HLSL arithmetic need not keep a zero's
sign.

All three forms now call mix32(a, b, c), a precise mad. Operand order, half
selection and modifiers are unchanged; saturate stays outside. mad still lets
a backend fuse, so the 1 ULP note stands. The dispatch mode prints a
fused/unfused probe per adapter, and a control helper that clears a -0 result
must fail exactly the -0 case.

The translation changes, so the cache revision moves to x2w-startup-shader-28
(and 28cs) in gfx2hlsl.py, d3d12_draw.inl and the tests that spell it.

Refs R0Y00#2729
Refs R0Y00#2746

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…0Y00#2821)

The forced-wave64 column said only "Passed, 64 lanes"; the NVIDIA rows that
report a range carry it, and the AMD rows do not. This adds the measured
32-64 range from a source build at 49f53ae and one evidence link to it,
keeping the existing links together on the same row (same adapter, driver
already cited once).

Refs #1

Co-authored-by: panam <panam@local>
Refuse exhausted upload storage instead of reusing capacity without completion.
Check the reservation cursor and retained backing with an authored portable fixture.
…Part of R0Y00#2413) (R0Y00#2824)

A slot 57 colour pixel stage whose only null export is the early exit LLVM
SILateBranchLowering and Mesa ACO place after the program's s_endpgm was
refused as a mixed null export. kill_exit_block accepts that block when it is
`exp null off, off, off, off done vm` then the final s_endpgm, and every
branch into it enters with EXEC zero: s_cbranch_execz, or s_cbranch_scc0
directly after s_cselect exec, exec, 0 (the demote form). All other mixed
forms stay refused with the existing message.

Checks: startup_mesh57_depth_only_check.py (both forms plus ten near misses)
and startup_mesh57_skeleton_kill_exit_{warp,hardware}, which draw both pairs
against a CPU rasteriser without the killed triangles; the pair without the
kill must differ at the 115 killed pixels.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
…in gfx2hlsl (Part of R0Y00#1723) (R0Y00#2795)

* shader: clear the lane-mask mark on scalar writes of descriptor data in gfx2hlsl

Scalar ALU on descriptor data (an s_mov of a descriptor word, a field
extract or mask of one, an s_add_u32 to a descriptor pointer) records only
a symbol for its destination and skipped set_s, so the destination kept a
lane-mask mark from an earlier write. The stride clamp of a
structured-to-raw conversion (s_bfe_u32 sN, desc, 0xe0010 then
s_max_u32 sN, sN, 1) then read as a lane-mask read. The descriptor-data
path now clears the mark on its destination SGPRs before writing them;
lower() has already classified the sources, so a mask read by the same
instruction is treated as before.

Part of R0Y00#1723

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sir6MraM8AjP6AcLDr3paU

* docs: state the control result on the current translator

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sir6MraM8AjP6AcLDr3paU

* docs: the captured stride clamp is in a pixel program

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sir6MraM8AjP6AcLDr3paU

* tests: dispatch the clamped structured-to-raw store after a lane mask in its register

Case I-raw-mask of startup_gfx2hlsl_compute_check writes a lane mask into s21 with
v_cmp_gt_u32_e64, then extracts and clamps the store descriptor's stride into s21 and
stores as case A. The WARP and hardware dispatches compare all 320 words with the CPU
reference. Control: s_max_u32 of the mask itself stays refused. On the translator
without the descriptor-data mark clear, the case is refused.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Co-authored-by: Roland EDI <rolandedi@users.noreply.github.com>
Keep main's image_store lowering, including compute 2D-array stores
and the refusal of a partial DMASK.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
A float4 read-modify-write stores every channel, so two invocations that
hit one texel with disjoint masks can put stale values back, and the load
needs a typed UAV format. A swizzle store writes only the selected
components and does not read the texel.

Compute, D16 and array stores stay on dmask 0xf. A two-pixel fixture
checks that both channel updates survive, and swapping the second store
onto another channel is the negative control. A manifest binding that
asks for a typed UAV load is refused before the draw when the format
cannot be loaded.

Refs R0Y00#2618

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
@cursor cursor Bot changed the title startup: pixel image_store sparse DMASK via read-modify-write (Refs #2618) startup: pixel image_store sparse DMASK as component stores Nov 26, 2026
R0D4X and others added 17 commits November 26, 2026 13:47
…Y00#2830)

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

When direct indexed draws had vertex streams bound (srv.source == 1),
they unconditionally rejected live index buffer aliasing, falling back
to recording-time snapshots and index scanning.

Replace the blanket vertex-stream check with stream_needs_slicing,
which only disables live aliasing if a stream requires slicing (e.g.
unplaced or unaligned guest vertex buffers). If all referenced streams
are aligned placed buffers with live aliases, live_indices is retained,
avoiding unnecessary recording-time copies and preserving pre-submission
writes to both the index and vertex buffers.

Also retain placed vertex buffer alias resources alongside the
recording. Extend tests/startup_direct_index_late_write_check.py with
positive placed vertex stream cases and an unplaced negative control
(late-visible-vb-unplaced).

Fixes R0Y00#2714
…0#2840)

A title on the Series S profile may present its picture on a plane above a black plane 0, which leaves the output window black by default. Link the console profile section to Presented planes and name X2W_PRESENT_COMPOSITE=1 and X2W_PRESENT_PLANE, without claiming every title does this.
…0#2734)

* startup: keep the split indirect Dispatch cache past DLL detach

Review of R0Y00#2683: with X2W_SPLIT_INDIRECT_DISPATCH=1 on an RX 9070 XT
(driver 32.0.32029.2010), startup_indirect_count_split_hardware printed
every expected readback and then exited with 0xC0000409 (fail-fast in
amdxc64.dll). The stack ran through the destructor of the function-local
static SplitIndirectDispatch during DLL detach, which released the
rewrite's pipeline state there. The reviewer measured a never-destroyed
instance exiting 0 in 3 of 3 runs on that adapter.

split_indirect_dispatch() now returns a heap instance that is never
destroyed. Its entries were already kept for the life of the process.
docs/experiments.md records the lifetime and the fault.

AI-assisted.

* startup: state the split cache's lifetime boundary

Review of R0Y00#2734: the splitter cache is process-owned and released only by
process exit. Explicit unload and reload of d3d12_xs.dll in a live host is
not a supported path, since each load allocates a new cache that nothing
tears down outside the loader lock; supporting it needs that teardown and
its own coverage. The header comment and docs/experiments.md now say so.

The docs also record the RX 9070 XT pair from the review (6 of 6 exit 0
with the change, 4 of 4 0xC0000409 with the static restored) and a
measured answer to the device-pointer question: the cached root signature
and pipeline each hold a device reference (count 1 -> 3, still 2 after the
application's Release, on the RX 5700 XT and WARP), so a cached device is
never destroyed and its address cannot be reused while an entry holds them.

AI-assisted.

---------

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

* startup: record a bounded per-draw texel history

* startup: label each pixel-history sample with its frame

* startup: include the texel coordinates in the pixel history

---------

Co-authored-by: Roland EDI <rolandedi@users.noreply.github.com>
…rstlane_b32 (R0Y00#2842)

* shader: prove uniform compute image_load results uniform for v_readfirstlane_b32

Refs R0Y00#2644

* test: resolve branch label offset in img_load_controls for llvm-mc
…art of R0Y00#2125) (R0Y00#2835)

* shader: recognise whole wave32 reductions in gfx2hlsl pixel stages (Part of R0Y00#2125)

Recognise the complete wave32 reduction chain in a straight-line pixel stage,
in the three shapes the R0Y00#2125 censuses report for every wave32 chain:
s_or_saveexec_b32 sS, -1, the identity fill v_cndmask_b32_e64 vT, <identity>,
vX, sS, the DPP16 steps quad_perm:[1,0,3,2], quad_perm:[2,3,0,1],
row_half_mirror and row_mirror (fi:1), v_permlanex16_b32 vP, vT, 0, 0, the
combine, s_mov_b32 exec_lo, sS and v_readlane_b32 sD, vT, 31, for v_or_b32,
v_min_u32 and v_max_u32, lowered to one WaveActiveBitOr / WaveActiveMin /
WaveActiveMax over the active lanes of the desktop wave. The min chain may
read its lane later: after its restore, one v_cndmask_b32_sdwa (lowered as
usual), the saveexec of a max chain, then the readlane, which that max chain
carries before its fill; vT rewritten in between, the max chain's saved EXEC
overwritten, or no max chain to carry it are refused. The entry EXEC must
hold without s_wqm, so helper lanes are left out on both sides. Other shapes
that start like a chain are refused with their reason.

tests/startup_gfx2hlsl_wave_reduce_check.py runs the source chains on a 32-lane
model, checks the translation and every refusal, and draws a triangle with
partly covered quads on WARP and hardware against a CPU reference per desktop
wave, with planted errors that must fail. offscreen_check gains
--startup-pixel-dump for that readback. The tests are registered in
tests/cmake/startup_gfx2hlsl_wave_reduce.cmake, the controls and the binary
mode are listed for the Linux jobs in tests/checks, and the note is
docs/experiments/startup-gfx2hlsl-wave-reduce.md.

* tests: assemble the wave reduction branch fixtures to an object (R0Y00#2125)

llvm-mc -show-encoding prints a branch to a label with its offset still a
fixup ([A,A,0x88,0xbf]), so the binary mode compared the three programs with
a branch against unresolved words. Those programs are now assembled with
-filetype=obj and compared with the .text section; the others keep the
-show-encoding path.

Also refuse a fill constant of 5 for each operation, by name, so a fill
table that accepts one more constant fails the controls.
…0#2730) (R0Y00#2844)

startup_gfx2hlsl_f32_med3: the restored branchless helper of the draw
control is computed as `precise`. Without it, an RX 5700 XT folded the
median against the fixture's constant bounds into a clamp and drew the
ISA's 0x3f800000 on the NaN lane with FXC and DXC, so the control could
not catch the defect. With `precise` the NaN lane draws 0x40000000 and the
other three lanes match, on that adapter and WARP. The text mutation that
the translator must reject keeps the plain helper.

compute_store_aot_mac_f32: before the hardware `fused mad()` mutation is
required to fail, its readback is compared with the fused and the unfused
model, which differ at word 0 (4097 * 4097 - 16785408). Exactly one must
match all 320 words; a compile, dispatch or readback failure, or any other
readback, fails the test. Where the unfused model matches, the mutation
equals the lowering and is logged as inapplicable on that adapter. The
full comparison, the four reference controls and the other two mutations
stay mandatory, and the test is never skipped.

AI-assisted.

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

* startup: keep the view tables consistent when an allocation fails

note_view added a new record to view_records, view_materialized and
view_ids one after the other, with no handler for a failed allocation.

Everything that can allocate now runs first, so a record goes into all
three containers or into none. On failure the process keeps running, a
log line names the container, the destination descriptor is left
untracked, and the resources of a created view leave the retire class.

startup_view_alloc injects the failure at each of the three sites, for
slot 18 and a slot 19 view with a counter resource. This does not reduce
the memory the records use.

Refs R0Y00#1199

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

* startup: register startup_view_alloc in a tests/cmake fragment

New test registrations go in tests/cmake/<family>.cmake, so move the
startup_view_alloc block out of CMakeLists.txt. The block is unchanged.

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

* startup: zero the view descriptions in startup_view_alloc

The stand-in identifies a view by every byte of its description. The
fixture rebuilt the constant buffer view description with brace
initialization, which need not clear its padding, so the same view could
get a new id. A review reported this as six failures in a Release build.

Zero the three view descriptions with memset before setting their fields.
Only the fixture changes.

Refs R0Y00#1199

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

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
R0Y00#2618) (R0Y00#2854)

s_ff1_i32_b32 sD, exec_lo followed by v_readlane_b32 sX, vY, sD reads vY
from the lowest lane in EXEC. In a straight-line pixel stage whose EXEC is
still the entry mask at the s_ff1 and at each readlane, without s_wqm, the
pair becomes WaveReadLaneFirst(vY) over the active lanes of the desktop
wave, under the packing contract of the R0Y00#2835 wave reductions. sD is a
symbol with no run-time value. Any read of it other than a v_readlane_b32
lane select is refused, as are branches, a changed EXEC, s_wqm, a
v_writelane_b32 spill source and a program that names exec_hi.

tests/startup_gfx2hlsl_pixel_first_lane_check.py runs the pair on a 32-lane
model, checks the translation and every refusal by its reason, and draws the
wave reduction triangle against the input of the lowest covered lane of
each desktop wave, with four planted errors that must fail. The tests are
registered in tests/cmake/startup_gfx2hlsl_pixel_first_lane.cmake and
listed for the Linux jobs in tests/checks. The note is
docs/experiments/startup-gfx2hlsl-pixel-first-lane.md.
…0#2856)

Co-authored-by: R0D4X <R0D4X@users.noreply.github.com>
* fix(startup): reuse upload ring chunks after GPU completion

* docs: describe upload ring chunk reuse and the gate-ring-reuse fixture

The ring now recycles a chunk once no recording holds it and every queue
that used it has completed. Replace the passages that still said it never
resets storage, and name the new gate_ring_reuse mode.

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

---------

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Co-authored-by: The Void <mrdominogrm@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Keep partial pixel 2D image_store masks as component swizzle stores, the typed-load refusal before the draw, and the same-texel fixture. Keep the pixel-stage 2D-array image_store and its UAV binding.

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.