Repository navigation
feat(rdna2spirv): implement image_sample_cd, image_sample_c_d, and image_sample_c_cd variants - #3300
klarnet2009 wants to merge 2 commits into
Conversation
…age_sample_c_cd variants
8569d1b to
382f0ee
Compare
|
At LLVM accepts the instruction (gfx1030): Translating it with the semantic-test helpers, on the head and on its merge with main: The equivalent AI-assisted (Devin); Linux, Python 3.12, llvm-mc 15, CPU translation only, no GPU or game files. |
|
Thank you @ray3242 for catching that! Fixed in
Verified with
|
|
Tested
Synthetic fixtures only, no game data. AI-assisted (Claude Code). |
|
Tested 5497f4c on AMD Radeon RX 9070 XT (RADV GFX1201) and the Ryzen 7 9800X3D iGPU (RADV RAPHAEL_MENDOCINO, gfx1036), Mesa 26.2.6, Linux 7.3.4: pass, no regressions.
No game files. AI-assisted. |
|
Rechecked at |
|
Tested on Windows 11 with two GPUs on one machine (head merged with main f847748, MSVC 14.51, Python 3.13.1):
So nothing regresses, but |
|
Tested 5497f4c on Steam Deck LCD (Jupiter), AMD Custom GPU 0405 "Van Gogh", RADV Mesa 26.2.0-devel (git-5c65d4fc31), Vulkan 1.4.350, SteamOS 3.9.5 (holo), kernel 7.2.7-valve2-2-neptune-72-g31504582a073: pass
No runtime C++ changes; GPU suite run from the PR worktree against the existing main runtime build. AI-assisted (OpenCode). |
|
Tested
The new AI-assisted (Claude Code). No game files. |
jeremygold02
left a comment
There was a problem hiding this comment.
Direct GPU execution at 5497f4ce1c082b163f794ce79569987838103d98: image_sample_cd, image_sample_c_d, and image_sample_c_cd selected the expected mip on an RTX 5070 with both A32 and packed A16 coordinates. This includes the corrected A16 color form from the last commit. The corresponding A16 and A32 RGBA32F frames were byte-identical for both color and depth.
Five synthetic 16×16 draws used an 8×8 base mip, a 4×4 second mip, nearest filtering, and sampler LOD range [0,1]. UV was constant at (0.6875, 0.5625), so the mip change had to come from the supplied gradients. I held dUV/dx at (1/16,0) and changed dUV/dy from (0,1/8) to (0,1/4), selecting mip 0 and mip 1 respectively.
| Input and instructions | Expected and observed result | Pixels |
|---|---|---|
RGBA8 UNORM, image_sample_cd, A32 and A16 |
Mip 0 texel (5,4), mip 1 texel (2,2). R/G encoded both coordinates and mip, yielding byte codes (5,4,18,34). | 256/256 each |
D32, image_sample_c_d then image_sample_c_cd, A32 and A16 |
Mip depths 0.25 and 0.75, reference 0.5, LESS_OR_EQUAL. Both instructions returned (0,1) across the gradient change, giving RGBA (0,1,0,1). | 256/256 each |
| Same A16 depth shader with the two mip values exchanged | RGBA reversed to (1,0,1,0). | 256/256 |
LLVM assembled each of the three opcodes in both address widths for gfx1013 and gfx1030. The draw shaders used the gfx1013 listings. All five original translated modules passed Vulkan 1.2 spirv-val. For execution I added the sampled-array dynamic-indexing capability from #3045 to the four pixel modules and enabled the matching device feature. Removing that one declaration reproduces each head-generated SPIR-V text exactly. The scratch vk_texture_test kept DrawParameters in the device feature chain as in #3347 and supplied the synthetic color/depth mips. The checks cover the three 2D gradient forms with f32 results. The offset, MinLod and d16 variants remain outside this run.
GPU execution used NVIDIA GeForce RTX 5070, driver 621.01 (32.0.16.2101), with Intel Core Ultra 7 265K on Windows 11 Home 25H2 build 26200.9974.
AI-assisted by GPT-6.2 Astra.
|
Tested
No GPU, no game data. AI-assisted. |
What and why
Implements the 12 derivative and depth-compare
image_sample*variants intools/rdna2spirv.py:image_sample_cd,image_sample_cd_o,image_sample_cd_cl,image_sample_cd_cl_o->OpImageSampleExplicitLod %v4floatimage_sample_c_d,image_sample_c_d_o,image_sample_c_d_cl,image_sample_c_d_cl_o,image_sample_c_cd,image_sample_c_cd_o,image_sample_c_cd_cl,image_sample_c_cd_cl_o->OpImageSampleDrefExplicitLod %floatGrad,Grad|Offset,Grad|MinLod, andGrad|Offset|MinLodin exact SPIR-VImageOperandsorder,a16(keeping offset, z-compare, and gradients 32-bit while unpacking f16 coords/minlod), andd16packing.docs/design.md(CPU/structural verification only; unmeasured on GPU) and adds tests intests/semantic/test_image_sample_cd.py(5 tests, assembling every emitted SPIR-V module viaspirv_asm).Claim: #3232 (comment)
Tested
spirv_asm)py -3.12 -I -m compileall -q tools/rdna2spirv.py tests/semantic/test_image_sample_cd.py: passed (exit 0)py -3.12 -I tests/semantic/test_image_sample_cd.py -v: Ran 5 tests in 0.232s, OKpy -3.12 -I tests/test_isa_coverage.py -v: Ran 13 tests in 3.652s, OK (skipped=3 forLEONIDA_RDNA2_ISA_XML)py -3.12 -I tests/test_ctest_registration.py -v: Ran 4 tests in 0.048s, OKtools/rdna2spirv.pytoHEADand confirmedtest_image_sample_cd.pyfailed (15Unsupportederrors), then restored and re-ran 5/5 passing.Checklist
python -Icompatible)