Repository navigation
feat(shader): implement MIMG PCK2/PCK4 stores as measured on hardware - #24142
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The reviewed head is 6555dca6d03b3046fdc674cae7ab9186f8f2c685; inspected the translation, SPIR-V emitter, tests, and debt note. I did not run checks, and all files listed for review were read.
What I ran
No commands or tests were run; repository context was read with repo_read.py at the pinned head.
Results
| Check | Result | Note |
|---|---|---|
| Source review | passed | All six changed files read |
| Tests | not run | Author reports Linux/Vulkan and hardware runs |
| Negative control | not run | Author reports a gate-removal check |
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not independently verify the hardware measurements, author-reported test results, or behavior outside the measured 2D subset. The excluded-file list was not available through the reader; the manifest lists six changed files, all included and read.
To get this to a good state
Nothing is required.
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
AMD Windows driver run for this (the description has the same GPU under RADV): Setup: Windows 10 22H2, AMD Radeon RX 9070 XT (RDNA4, AI-assisted: yes (Claude Code) |
|
Independent re-measurement on a discrete gfx1030: 75 of 75 store cases write exactly the bytes this PR's semantics predict, in wave32 and wave64 alike. Setup: AMD Radeon RX 6800 ( Instructions: Image: the test's descriptor (words 1 to 7 Expected values: 71 cases from a Python port of the diff's
All 75 match, and wave32 and wave64 give identical bytes. In every run no byte outside the predicted texels changed anywhere in the 4 KiB buffer. Layout, from 17 plain Not measured: UNORM, SINT and FLOAT formats; dmask other than 0x1; R32, RGBA8, RG16; coordinates AI-assisted: yes (Claude Code) |
|
Windows run of head
Unlike the RX 9070 XT run in the description, GPUs tested: NVIDIA GeForce RTX 5090, driver 617.42, Windows 11; AMD Radeon(TM) Graphics (gfx1036 iGPU), driver 32.0.21045.29003, Windows 11 AI-assisted: yes |
What
Implements
image_store[_mip]_pck2/pck4(MIMG 0x76, 0x77, 0x79, 0x7a), the store side of the PCK2/PCK4 loads from #1809, as measured on RDNA2 hardware.Measured with the hardware oracle on an AMD Radeon 610M (gfx1036, RDNA2). Lane 0 stores one dword into a linear 2D image built over random bytes, then all lanes read back 2 KiB of it. Plain
image_storeandimage_store_mipat the same coordinates are the reference for addressing. The harness was first checked against a plainimage_store(exactly one byte changed) and against the load rule of #1809 (50 rows, same results).x + N - 1 >= width(unaligned x, unsigned) ory >= heightx + kgets bitsk * texel bitsof the dword, for k from 0 whilex + kstays in the aligned group of4 / texel bytestexels that holds x: at most N texels, never across a 4-byte boundary. x is not aligned down as in the loads (R8 PCK2: x = 5 writes 5 and 6, x = 3 writes only 3)_mipformsimage_store_mipimageByemitsImageWritefor the four opcodes, with the packed flag,imageByElementsand the mip flag.EmitPackedByStoreOpchecks the bounds above, then writes each texel throughPackedStoreTexelandEmitStorageImageWriteunder the 4-byte group gate. Dynamic mips are gated byEmitStorageImageWrite.image_pck_nchecks that each store translates to oneImageWrite.agc_driver_image_pck_nstores from 32 lanes at non-overlapping in-range, edge, out-of-range and mip positions and compares the whole texture with the model (PCK2 R8, R16 and RG8, PCK4 R8, plain and mip).agc_driver_image_table_packed_unmeasurednow expects a PCK store through an image table to be poisoned with no texel written.The measured store is not the inverse of the load. The open #16321 assumes that inversion, without a measurement, for the BY2/BY4 stores; the same harness can check it.
Overlaps: #16321 changes the same lines in
imageBy,EmitWriteOpand theunmeasuredmode ofImageTablePacked.cpp, and #22675 changes the PCK store refusal line intests/execution/ImagePckN.cpp. The changes are independent; whichever lands second needs a small rebase.Tested
Fedora 45 (Linux 7.3.4), AMD Radeon RX 9070 XT (RADV GFX1201, Mesa 26.2.7), Vulkan validation layer 1.4.350. The same tests ran on
mainand on this branch withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer:image_pck_nandagc_driver_image_*forpck_n,by,load_packed,store_packed,table_packed*,packed16_load,packed_horizontal_gather,repacked_floatandstore_unorm_rounding): 21 of 22 pass on both.agc_driver_image_table_packed_guardsalso fails onmainon this GPU ("unrecoverable packed table format was not poisoned") and passes inside theallmode.Insert instance layer "VK_LAYER_KHRONOS_validation", neither showswas not found but was requested by env var VK_INSTANCE_LAYERS, and neither has aVUID-line.ctest -R "image|shader|recompil|spirv|mimg|pck|agc": 2001 of 2001 pass.agc_driver_image_pck_nfail.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)