Skip to content

startup: lower pixel-stage image_store to a typed UAV store - #2155

Merged
R0Y00 merged 11 commits into
R0Y00:mainfrom
rasptum:shader/pixel-image-store
Nov 25, 2026
Merged

R0Y00 merged 11 commits into
R0Y00:mainfrom
rasptum:shader/pixel-image-store

Conversation

@rasptum

@rasptum rasptum commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Refs #1996 (item F).

Today tools/startup/gfx2hlsl.py has no image_store handler, so the instruction is refused in every stage.

Translator

  • In a pixel stage, image_store with dim:SQ_RSRC_IMG_2D and dmask:0xf now becomes w<n>[uint2(x, y)] = asfloat(uint4(data)) on a RWTexture2D<float4> w<n> : register(u<n>).
  • The store runs under the lane's exec bit, like the other per-lane writes. D3D drops UAV writes from helper lanes, as the hardware drops them for inactive lanes.
  • The manifest becomes version 2 and gains uav <index> tex2d table <table> <offset>. Programs without a store keep version 1.
  • Semantics:
    • MIMG opcode 0x08, from LLVM AMDGPU MIMGInstructions.td (IMAGE_STORE, defined through MIMG_Store). VDATA is the source, VADDR the integer texel address (x, y for dim 2D) and SRSRC the image descriptor. The DMASK channels are written in order from consecutive VDATA registers.
    • Mesa ACO's visit_image_store emits the same form, with DMASK taken from the write mask.
    • A typed UAV store writes every channel of the view, so only DMASK 0xf is exact.
  • Accepted: glc, slc, dlc.
  • Refused by name, because none of them is covered:
    • a partial DMASK;
    • 1D, 3D and 2D-array images;
    • d16, a16, tfe, lwe, r128, unorm and the reserved bit;
    • image_store_mip;
    • a store outside a pixel stage;
    • a program that both loads and stores the same image, which would need a read-write view.

Runtime: the translated graphics path does not bind UAVs yet. d3d12_draw.inl now logs and skips a translation whose manifest has a uav line. Before, such a line was rejected as an invalid sampler-heap line. Binding the view, with a UAV range in the translated root signature and a view made from the title's image descriptor, is a separate follow-up.

Fixture: tests/startup_pixel_image_store_check.py, a hand-assembled gfx1013 pixel program with no bytes from any retail software. It loads a descriptor from table 0, stores 1.0, 2.0, 3.0 and 4.0 at texel (1, 2), and exports the same values.

  • The words are decoded back with tools/disasm_rdna2.py. binary <llvm-mc> reassembles the source and compares, but I could not run that here because no llvm-mc is available.
  • Controls check the HLSL, the manifest, the accepted cache bits and every refusal above.
  • Negative control: with op_image_store removed, the program is refused again.
  • The draw (offscreen_check --startup-image-store, new file tests/startup_image_store.cpp) compiles the translation with DXC and draws one pixel. It reads back all 16 texels of a 4x4 R32G32B32A32_FLOAT image that starts at -1.0.
  • Texel (1, 2) must hold the four values and every other texel must still hold -1.0. Two mutants of the translated shader must be detected:
    • with the store deleted, texel (1, 2) stays -1.0;
    • with x and y exchanged, the write lands at (2, 1).

Overlap: #2059 (vertex-stage buffer_store_*) also adds a uav <slot> table <param> <offset> line under x2w-manifest 2, for a RWByteAddressBuffer. This PR's line names its kind (tex2d) so the two forms stay distinguishable. If both land, they need one shared u register numbering; this PR numbers stored images from u0.

Test (Windows 10 19045, NVIDIA GeForce RTX 3060, driver 32.0.15.9636, and WARP; debug layer enabled):

cmake --build --preset dev --target offscreen_check
ctest --preset dev --no-tests=error -R '^(startup_pixel_image_store_.*|startup_image_(3d|load_mip|2d_array)_.*)$' -V
  • dev: 12 passed, 0 failed, 0 skipped. startup_pixel_image_store_{controls,warp,hardware} pass; the draw reports texel (1, 2) written and the other 15 untouched, with both mutants detected and no debug-layer errors.
  • release (the same commands with --preset release): 12 passed, 0 failed, 0 skipped.
  • The existing tests/startup_gfx2hlsl_*_check.py and tests/startup_translator_check.py all pass, together with the new check and the image 3D / mip / 2D-array checks: 41 scripts, 0 failures. tests/docs_links_check.py and tests/bidi_controls_check.py also pass.

🤖 Generated with Claude Code

gfx2hlsl refused image_store in every stage (R0Y00#1996 item F). In a pixel stage,
image_store with dim:SQ_RSRC_IMG_2D and dmask:0xf now becomes
w<n>[uint2(x, y)] = asfloat(uint4(data)) on a RWTexture2D<float4> at its
own u register, under the lane's exec bit, and the manifest becomes version 2 with
"uav <index> tex2d table <table> <offset>".

Semantics: MIMG opcode 0x08 (LLVM AMDGPU MIMGInstructions.td, IMAGE_STORE
defined through MIMG_Store): VDATA is the source, VADDR the integer texel
address (x, y for dim 2D), SRSRC the image descriptor, and the DMASK
channels are written in order from consecutive VDATA registers. Mesa ACO
(visit_image_store) emits the same form with DMASK from the write mask.
A typed UAV store writes every channel, so only DMASK 0xf is exact; a
partial mask, other dimensions, d16, a16, tfe, lwe, r128, unorm,
image_store_mip, a store outside a pixel stage and a load and store of the
same image are refused by name. glc, slc and dlc are accepted.

The translated graphics path does not bind UAVs yet: d3d12_draw.inl logs
and does not use a translation whose manifest has a uav line, instead of
rejecting it as an invalid sampler-heap line.

startup_pixel_image_store_check.py decodes the hand-assembled program with
disasm_rdna2, checks the translation, the refusals, and that the program is
refused again with the lowering removed. The draw stores four values at
texel (1, 2) of a 4x4 image through offscreen_check --startup-image-store,
reads all 16 texels back, and checks that deleting the store or exchanging
x and y is detected.

Refs R0Y00#1996

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

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of head f14d392d3acf065f2f130bc876f17a4b397249b6 (non-blocking comment, no approval).

Scope: pixel-stage image_store lowered to a RWTexture2D<float4> store (gfx2hlsl), manifest v2 uav line, runtime refusal for uav manifests, new Python controls and a desktop draw readback test, docs.

Checked:

  • CI on this head: Windows build and test pass, Linux Python checks pass, gfx1013 fixtures pass.
  • Mergeable, title neutral, no clean-room concerns seen in the diff.
  • The lowering matches the ISA shape: VDATA is four consecutive VGPRs, the address is x and y, and the store runs under exec. Refusing 1D, 3D, array, partial masks, image_store_mip, non-pixel stages, and load+store of the same image is sensible.
  • The runtime logs and skips a translation with a uav line, so nothing is bound wrongly.

Findings:

  • P1: none.
  • P2: the dmask != 0xf guard (tools/startup/gfx2hlsl.py, in op_image_store) is not killed by the tests. I replaced the condition with if False: and tests/startup_pixel_image_store_check.py still passed. The "dmask 0x7" and "dmask 0x1" controls are refused earlier by the "four VGPRs expected" check, because the patched encoding also changes the data register count. Suggest a control that keeps v[4:7] with a partial dmask (call op_image_store directly with ['v[4:7]','v[0:1]','s[16:23]'] and dmask:0x7) so the guard itself is exercised. The refusal text names the wrong reason in the current controls.
  • Nit: stored_images() uses __dict__.setdefault to cover pipelines built without __init__. Giving uavs a class-level default or fixing the test constructors would be clearer.
  • Nit: the docs bullet has a short broken line ("The cache-policy" wraps oddly); cosmetic.

Mutations run (then git checkout -- .):

  • Swapped x and y in the store address: startup_pixel_image_store_check.py exits 1, so the test kills it.
  • Disabled the dmask guard: the test still exits 0, so it survives (the P2 above).

Not run: Win2025 WARP/hardware draw (startup_pixel_image_store_warp/hardware) was not run locally. I rely on the Windows CI job being green. I did not confirm that job includes these ctest names.

Commands executed locally in the worktree:

  • python3 -B tests/startup_pixel_image_store_check.py -> Self-test passed
  • python3 tests/docs_links_check.py -> Checked 18 Markdown files and 398 links
  • python3 tests/bidi_controls_check.py -> no bidirectional controls
  • git diff --check origin/main...HEAD -> clean
  • gh pr checks 2155 -> all pass or skipping

AI-assisted; commands listed were executed locally.

rasptum and others added 3 commits November 24, 2026 21:14
The two encoded partial-mask controls only asserted that image_store was
refused. The decoder sizes VDATA from the mask (v[4:6], v4), so with the
dmask guard disabled the data-register check still refused them and the
controls passed. Each now asserts the dmask reason, and a new control calls
the handler with v[4:7] and dmask 0x7, which only the mask guard can
refuse; another passes dmask 0xf with three data registers and asserts the
data reason. With the guard replaced by `if False:` the check fails.

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

Pipelines that tests assemble without __init__ store to no image. A class
attribute of None now says so; the first store creates the instance's own
map.

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

rasptum commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, the guard finding was right: the two encoded partial-mask controls passed for the wrong reason. The disassembler sizes VDATA from the mask (v[4:6], v4), so with the dmask guard disabled the data-register check still refused them, and the controls only asserted that image_store was refused.

What changed, in three commits on top of f14d392:

  • 733bd13 (test). The encoded dmask 0x7 / dmask 0x1 controls now assert the dmask reason ("a typed UAV store writes all four channels"). A new control calls op_image_store with v[4:7] and dmask:0x7, so only the mask guard can refuse it. Another passes dmask:0xf with three data registers and asserts the data reason ("four VGPRs expected"), so each check is pinned to its own message.
  • 352bae3 (nit). Pipeline.uavs is now a class attribute defaulting to None. The first store creates the instance's own map, and the __dict__.setdefault fallback is gone. Pipelines that the existing checks assemble without __init__ keep working unchanged.
  • 96c1a55 (nit). The docs bullet is rewrapped.

None of these controls is registered with WILL_FAIL. The CTest entries for this PR are plain pass/fail, with 77 kept as the capability skip for the hardware draw.

Mutation: with if int(masks[0], 0) != 0xf: replaced by if False:, tests/startup_pixel_image_store_check.py fails with:

AssertionError: (('dmask 0x7', 'writes all four channels'), 'image_store data v[4:6]: four VGPRs expected')

With the guard restored, the check passes.

Commands and results:

out/pe-env/Scripts/python.exe -B tests/startup_pixel_image_store_check.py
ctest --preset dev --no-tests=error -R '^startup_pixel_image_store_' -V
ctest --preset release --no-tests=error -R '^startup_pixel_image_store_' -V

Windows 10 19045, head 96c1a55:

  • dev: 3 passed, 0 failed, 0 skipped (controls, warp on Microsoft Basic Render Driver, hardware on an NVIDIA GeForce RTX 3060).
  • release: 3 passed, 0 failed, 0 skipped.

All tests/startup_gfx2hlsl_*_check.py, tests/startup_translator_check.py and the image 3D / mip / 2D-array checks pass: 41 scripts, 0 failures. tests/docs_links_check.py passes.

AI-assisted (Claude Code).

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of head 96c1a55b381d3b3f464c857f571b8fdd5106d425 (comment only).

State: mergeable, not draft, title neutral, CI green (Linux checks, gfx1013 fixtures, Windows build and test). Read: tools/startup/gfx2hlsl.py (op_image_store, Pipeline.uav/resource/manifest), src/startup_stubs/d3d12_draw.inl, the new check and docs.

What I checked

  • The refusals match the description: partial DMASK, non-2D dim, bad modifiers, wrong data/address register count, non-pixel stage, and a load plus a store of the same image. The load/store conflict is enforced in both orders (resource and uav).
  • Manifest: version 2 only when a store exists, version 1 otherwise (covered at tests/startup_pixel_image_store_check.py:143). The runtime ignores the version number, but it refuses any uav line, so a translation that stores is never used. That is the safe choice until UAV binding exists.

Findings

  • P1: none.
  • P2: the exec guard is not covered. I replaced self.emit(body if self.exec_known else 'if (exec & 1) ' + body) with self.emit(body) (this also hit the two sibling emits, same line text) and tests/startup_pixel_image_store_check.py still passed. So a store under a partial exec mask could lose its guard without any test failing. Please add one case with a non-constant exec and assert the guard in the output (and, if possible, in the WARP readback).
  • nit: int(masks[0], 0) raises ValueError on a malformed mask text rather than Unsupported. Low risk since the assembler produces it, but a try would give a named refusal.

Commands run locally (worktree on the PR head)

  • python3 tests/startup_pixel_image_store_check.py : pass
  • python3 tests/docs_links_check.py : pass (18 files, 398 links)
  • python3 tests/bidi_controls_check.py : pass (1441 files)
  • git diff --check origin/main...HEAD : clean
  • Mutation 1: DMASK check replaced with if False: : the check failed (killed).
  • Mutation 2: exec guard removed : the check still passed (survived, see P2).
  • gh pr checks 2155 : all required jobs pass.

Windows WARP was not re-run by me. The change adds a test under tests/startup_image_store.cpp and CI Windows is green.

AI-assisted; commands listed were executed locally.

rasptum and others added 2 commits November 24, 2026 22:13
int(masks[0], 0) raised ValueError on mask text that is not an integer;
it is now an Unsupported refusal ("not an integer"), with a control.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two variants put v_cmpx_eq_u32 before the store so exec is not known at
translation time. The controls assert that the emitted store is guarded
by the lane's exec bit, and the draw mode reads the image back: with the
lane on the texel is written, with every lane off it keeps its starting
value, and the exec-off shader with the guard removed must write it.

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

rasptum commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. Both findings were right. Two commits on top of 96c1a55:

  • 2aa673d (nit). Mask text that is not an integer is now a named refusal: image_store with dmask 0xz: not an integer. Before, it was a ValueError from int(masks[0], 0). A control passes dmask:0xz to op_image_store and asserts the exact message.
  • 7ee19fa (P2). The exec guard is now tested. Two variants put v_cmpx_eq_u32_e32 <k>, v0 (VOPC, hand-encoded and decoded back) before the store, so exec is not known at translation time:
    • The controls assert exec = ((0x0000000ku == v0) ? 1u : 0u); and if (exec & 1) w0[uint2(v0, v1)] = ... in the emitted HLSL, with the store line emitted once. They also assert the unguarded form for the original program, whose exec is the entry mask.
    • The draw mode reads the 4x4 image back:
      • With k = 1 the lane stays on, and texel (1, 2) gets the four values.
      • With k = 2 every lane is off, and texel (1, 2) keeps its starting value (bf800000 x4).
      • All other texels stay untouched in both cases.
    • New negative control: the exec-off shader with only the guard removed from the store must write the texel. It fails as expected with texel_mismatch x=1 y=2 expected=bf800000,bf800000,bf800000,bf800000 actual=3f800000,40000000,40400000,40800000.

Mutations (each applied alone, then restored):

  • Your mutation, self.emit(body) at all three sites: tests/startup_pixel_image_store_check.py fails at the guarded-store assertion.
  • The same change at the image_store site only: the check fails.
  • The dmask fix reverted: the check fails with ValueError: invalid literal for int() with base 0: '0xz'.

The two sibling emits already have their own coverage. Each was mutated alone and the full Python set was rerun:

  • op_v_swap_b32: only tests/startup_gfx2hlsl_swap_check.py fails ("unknown exec guards the swap").
  • The 64-bit shift helper (shift64, used by v_lshrrev_b64 and friends): only tests/startup_gfx2hlsl_shift64_check.py fails ("exec-masked v_lshrrev_b64 guards both destination registers").

None of the CTest entries uses WILL_FAIL. 77 is still only the capability skip for the hardware draw.

Commands:

out/pe-env/Scripts/python.exe -B tests/startup_pixel_image_store_check.py
ctest --preset dev --no-tests=error -R '^startup_pixel_image_store_' -V
ctest --preset release --no-tests=error -R '^startup_pixel_image_store_' -V

Results on Windows 10 19045, head 7ee19fa:

  • dev: 3 passed, 0 failed, 0 skipped.
    • controls.
    • warp on Microsoft Basic Render Driver.
    • hardware on an NVIDIA GeForce RTX 3060.
    • Both draw tests ran the exec-on and exec-off draws and the guard-removed control.
  • release: 3 passed, 0 failed, 0 skipped.
  • Python: all tests/startup_gfx2hlsl_*_check.py, tests/startup_translator_check.py, tests/startup_image_*_check.py, this check and tests/docs_links_check.py pass. That is 46 scripts, 0 failures.

AI-assisted (Claude Code).

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted; commands listed were executed locally.

Re-review of head 7ee19fa945ed5c347a54cdb8efa63bfae1403b94 (comment only). Previous review was on 96c1a55b; two commits since (2aa673d5, 7ee19fa9).

State: mergeable, not draft, title neutral, CI green (Linux checks, gfx1013 fixtures, Windows build and test; /O2 and chart skipped).

Previous findings

  • P2 (exec guard untested): fixed. tests/startup_pixel_image_store_check.py now adds two v_cmpx_eq_u32 variants (exec on / exec off), asserts the if (exec & 1) guard on the store line only, asserts no guard when exec is known, and in draw mode reads texels back for exec on, exec off, and an unguarded negative control.
  • nit (malformed dmask): fixed. op_image_store now raises Unsupported('image_store with dmask 0xz: not an integer'), and the check covers it.

Findings

  • P1: none.
  • P2: none.

Commands run locally (worktree on the PR head)

  • python3 tests/startup_pixel_image_store_check.py : pass (includes the new exec-guard and malformed-dmask controls)
  • python3 tests/docs_links_check.py : pass (18 files, 398 links)
  • python3 tests/bidi_controls_check.py : pass (1441 files)
  • git diff --check origin/main...HEAD : clean
  • Mutation A: exec guard removed from the store emit (gfx2hlsl.py:1511) : the check failed (killed; the new assertion fires).
  • Mutation B: DMASK required value changed from 0xf to 0xf0 : the check failed (killed).
  • gh pr checks 2155 : all required jobs pass.

Windows WARP was not re-run by me; the new draw-mode cases run in the PR's Windows CI job, which is green.

AI-assisted; commands listed were executed locally.

@thepatrickworld

Copy link
Copy Markdown
Contributor

Draw run on hardware — RX 9070 XT, driver 32.0.32029.2010:

draw exec on:  texel (1, 2) = 3f800000,40000000,40400000,40800000, all other texels untouched
draw exec off: texel (1, 2) = bf800000,bf800000,bf800000,bf800000, all other texels untouched
control exec guard removed: fails as expected (texel_mismatch x=1 y=2 expected=bf800000,... actual=3f800000,...)

So execution masking and the untouched-texel rule both hold on the card, and removing the guard makes the check fail rather than pass by accident.

Limits: AMD only, no NVIDIA here.

AI-assisted.

@legacy-code-archaeologist

Copy link
Copy Markdown
Contributor

Ran head 7ee19fa9 on three adapters. All pass. Windows 11 build 26100, debug layer unavailable.

Test Adapter Driver Result
startup_pixel_image_store_controls n/a n/a pass
startup_pixel_image_store_warp Microsoft Basic Render Driver 10.0.26100.8972 pass
startup_pixel_image_store_hardware (XBOX2WINDOWS_ADAPTER=Quadro) NVIDIA Quadro M1000M 32.0.15.7371 pass
startup_pixel_image_store_hardware (XBOX2WINDOWS_ADAPTER=Intel) Intel HD Graphics 530 31.0.101.2111 pass

On every adapter texel (1, 2) was written, the other 15 texels were left untouched, and both exec-on and exec-off drew as expected. All three controls failed as intended.

One cosmetic point. On the Intel run, each control printed fails as expected (XBOX2WINDOWS_ADAPTER: skipping NVIDIA Quadro M1000M). The check itself is correct: it requires the texel_mismatch … needle in stderr (tests/startup_pixel_image_store_check.py:224 and :241). The printed reason, however, is run.stderr.strip().splitlines()[0], and when the adapter is filtered, offscreen_check writes its adapter-skip notice first. Printing the line that contains texel_mismatch would keep the log meaningful on multi-GPU machines.

AI-assisted.

rasptum and others added 4 commits November 25, 2026 01:50
Conflicts were additions on both sides, kept in full: main's d16srv
manifest reading and writing next to the uav lines, main's
image_load_d16 operation and declaration next to the image store ones,
and main's Pipeline class attributes next to uavs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ComputePipeline (R0Y00#2182) maps buffer descriptors to u indices in self.uavs
and declares them itself; the inherited common() and manifest() read
stored_images() as pixel-stage image entries, which a compute program
cannot have. startup_gfx2hlsl_compute_check.py fails without this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The controls printed the first stderr line as the reason, which on a
machine with several adapters is an adapter notice. They now print the
texel_mismatch report they already assert on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The one conflict was next to each other in gfx2hlsl.py: main's new
sampler(..., lod_limits=False) signature, kept after this branch's
stored_images() and uav() methods.

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

rasptum commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the three hardware reports: RX 9070 XT, Quadro M1000M and Intel HD 530. They cover adapters I could not test here.

main had moved, so I merged it into the branch instead of rebasing. The reviewed commits stay as they were. Four commits on top of 7ee19fa:

  • 932b4c2 (merge of main). The conflicts in d3d12_draw.inl, tests/desktop_gpu.h, tests/offscreen_check.cpp and tools/startup/gfx2hlsl.py were additions on both sides, and all of them are kept:

    • main's d16srv manifest reading and writing next to the uav lines;
    • its --startup-image-load-d16 operation next to --startup-image-store;
    • its Pipeline class attributes next to uavs.

    git diff origin/main...HEAD removes one line of main's: the fixed x2w-manifest 1, which this PR makes 1 or 2.

  • 6456bbb (fix). main now has startup: add a compute stage to gfx2hlsl with the offen buffer store #2182's ComputePipeline, which uses self.uavs as descriptor key to u index (an int) for its buffer stores. It inherits common() and manifest(), and those read stored_images() as this PR's pixel-stage image entries. So tests/startup_gfx2hlsl_compute_check.py failed with TypeError: 'int' object is not subscriptable. ComputePipeline.stored_images() now returns {}: a compute program has no pixel-stage image stores, and it declares and lists its buffer UAVs itself. The compute check fails without this commit and passes with it.

  • 81ca898 (from the tester's comment). The draw controls printed the first stderr line as the reason, which on a machine with several adapters is an adapter notice. They now print the texel_mismatch line they already assert on, for example texel_mismatch x=1 y=2 expected=bf800000,... actual=3f800000,....

  • 44b1036 (a second merge of main, at 5a3ed6a). main moved again during the checks. The only conflict was in gfx2hlsl.py: startup: lower image_sample_b in gfx2hlsl #2051's new sampler(..., lod_limits=False) signature sits right after this branch's stored_images() and uav(). Both are kept, and again only the x2w-manifest 1 line of main's is replaced.

Results on Windows 10 19045 (WARP; RTX 3060, driver 32.0.15.9636), head 44b1036:

ctest --preset dev --no-tests=error -R '^startup_pixel_image_store_' -V
ctest --preset release --no-tests=error -R '^startup_pixel_image_store_' -V
  • dev: 3 passed, 0 failed, 0 skipped.
  • release: 3 passed, 0 failed, 0 skipped.
  • Python checks: 60 scripts, 0 failures. They are every tests/startup_gfx2hlsl_*_check.py (including startup_gfx2hlsl_compute_check.py), tests/startup_translator_check.py, tests/startup_image_*_check.py, tests/startup_pixel_image_store_check.py and tests/docs_links_check.py.

AI-assisted (Claude Code).

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted; commands listed were executed locally.

Re-review of head 44b103638a0e3b1790ff4e1bf61b1d268935715d (comment only). Previous review was on 7ee19fa9. Since then: 6456bbbc (compute pipelines keep buffer UAVs out of the pixel-stage image list), 81ca8985 (names the texel_mismatch line in the controls), and two merges of main.

State: mergeable, not draft, title neutral. CI at the time of review: Linux checks pass; gfx1013 fixtures and Windows build/test pending; /O2 skipped. I did not re-run Windows WARP; the draw-mode cases run in the PR's Windows job, so please wait for it to go green before Ready.

Previous findings: none open (exec guard and malformed dmask were fixed earlier and still pass).

New in this head

  • ComputePipeline.stored_images() returning {} (tools/startup/gfx2hlsl.py:3527) is correct. ComputePipeline.uavs maps buffer descriptors to u indices, so without the override Pipeline.stored_images() would hand that map to the image paths (common() / manifest()).
  • P2 (test gap): that override is not guarded. Mutation A below removed it and every check I ran still passed.
  • P1: none.

Commands run locally (worktree on the PR head)

  • python3 tests/startup_pixel_image_store_check.py : pass
  • python3 tests/compute_heap_store_check.py : pass
  • python3 tests/compute_entry_layout_check.py : pass
  • python3 tests/docs_links_check.py : pass (18 files, 418 links)
  • python3 tests/bidi_controls_check.py : pass (1522 files)
  • git diff --check origin/main...HEAD : clean
  • Mutation A: delete ComputePipeline.stored_images override : SURVIVED (image-store check, compute_heap_store_check and compute_entry_layout_check all still pass).
  • Mutation B: manifest version always 1 : killed (targets 0 / check fails).
  • Mutation C: drop the read/store conflict test in Pipeline.uav : killed (accepted: ('both read and stored',)).

Suggestion for P2: add one control that builds a compute program with a buffer store and asserts its manifest has no uav line and the manifest header stays version 1 (extend tests/compute_heap_store_check.py).

AI-assisted; commands listed were executed locally.

The compute stage's buffer stores live in self.uavs (descriptor key -> u
index), which the shared common() and manifest() must not read as
R0Y00#2155's image stores. The control asserts stored_images() is empty
before any output is built, then no RWTexture2D declaration, the
`x2w-manifest 2` / `stage cs` header and the single kind-less uav line.
With ComputePipeline.stored_images removed it fails at that assertion.

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

rasptum commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. The override is covered, but by two checks you did not run.

I repeated your mutation on 44b1036 (deleted ComputePipeline.stored_images). tests/startup_pixel_image_store_check.py, tests/compute_heap_store_check.py and tests/compute_entry_layout_check.py still pass, as you saw. Two existing checks fail, both run by CI's platform-independent Python job:

  • tests/startup_gfx2hlsl_compute_check.py
  • tests/startup_compute_translate_check.py

Both fail in the inherited Pipeline.common():

for key, r in sorted(self.stored_images().items(), key=lambda kv: kv[1]['index']):
TypeError: 'int' object is not subscriptable

I took your suggestion anyway, since a TypeError deep in common() does not say what broke. 949497e adds a control in tests/startup_gfx2hlsl_compute_check.py, where the compute manifest is already asserted. It sits ahead of the existing exact-manifest assertion and checks four things on the buffer-store program A:

With the override removed, the check now stops at that first assertion: AssertionError: ({(('table', 1), 16): 0}, {(('table', 1), 16): 0}), so stored_images() returned the compute buffer map. With the override restored, it passes.

63 Python checks pass, 0 failures:

  • every tests/startup_gfx2hlsl_*_check.py;
  • tests/startup_translator_check.py, tests/startup_image_*_check.py, tests/startup_pixel_image_store_check.py, tests/docs_links_check.py;
  • tests/startup_compute_translate_check.py, tests/compute_heap_store_check.py, tests/compute_entry_layout_check.py.

The change is test-only and touches nothing the draw tests use, so I did not rerun CTest. The branch still merges cleanly with main.

AI-assisted (Claude Code).

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted; commands listed were executed locally.

Re-review of head 949497eb4d5521cf6fdbdeeb1f2a52810279585f (comment only). Previous review was on 44b10363. The only new commit is 949497eb, which changes tests/startup_gfx2hlsl_compute_check.py (+7 lines).

State: mergeable, not draft, title neutral. CI at review time: Linux Python checks pass. The Windows build/test and gfx1013 fixtures were still pending. I did not re-run Windows WARP. Please wait for the Windows job to go green before Ready.

Previous P2 (unguarded ComputePipeline.stored_images() override): resolved.
check_controls() now asserts that a.stored_images() == {} while a.uavs is non-empty. It also asserts that the HLSL has no RWTexture2D line, that the manifest starts with x2w-manifest 2 / stage cs, and that the only uav line is uav 0 table 1 16.

Findings: P1 none, P2 none, nit none.

Commands run locally (worktree on the PR head)

  • python3 tests/startup_gfx2hlsl_compute_check.py : pass
  • python3 tests/startup_pixel_image_store_check.py : pass
  • python3 tests/docs_links_check.py : pass (18 files, 418 links)
  • python3 tests/bidi_controls_check.py : pass (1522 files)
  • git diff --check origin/main...HEAD : clean
  • Mutation A, deleting the ComputePipeline.stored_images override in tools/startup/gfx2hlsl.py: now KILLED. startup_gfx2hlsl_compute_check.py fails with AssertionError: ({(('table', 1), 16): 0}, {(('table', 1), 16): 0}). In the previous head this mutation survived. I restored the file with git checkout -- ..

AI-assisted; commands listed were executed locally.

@R0Y00
R0Y00 merged commit fbc8fac into R0Y00:main Nov 25, 2026
5 checks passed
roansystemlabs added a commit to roansystemlabs/Xbox2Windows that referenced this pull request Nov 26, 2026
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.
tedin7 added a commit that referenced this pull request Nov 26, 2026
* startup: bind pixel-stage UAVs from the title's descriptor table

Refs #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 (#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 #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>
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.

5 participants