Repository navigation
Conversation
|
Reproduced a documentation contract mismatch on head
Those contract rows now understate the accepted forms and leave the new translator behavior undocumented. Please update the relevant row(s) to cover the added dimensions and state the verification level for them, as CONTRIBUTING.md requires for translator rules. |
|
Windows RTX 4080 coverage of the new Each synthetic pixel shader exports two LOD queries as
The cube and array draws used stock |
Kam471
left a comment
There was a problem hiding this comment.
Head 6d8047d6 — tools/rdna2spirv.py (+97/−29), new tests/semantic/test_image_get_lod_dims.py, tests/test_image_query_translate.py.
$env:LLVM_MC='wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc'; python tests/semantic/test_image_get_lod_dims.py→ Ran 7 tests, OK. WithoutLLVM_MCthe round-trip test skips (6 OK, 1 skipped), as it should.python -I -m pytest tests/test_image_query_translate.py -q→ 10 passed, 14 subtests;tests/test_image_load_typed.py→ 23 passed, 53 subtests;tests/test_text_write_line_endings.py→ 3 OK.- GPU:
LEONIDA_VK_DEVICE='RTX 5070 Ti' python -I scripts/run_gpu_tests.py --build <build> --filter get_lod→ 2/2 PASS (ps_get_lod,ps_get_lod_array; 3/3 shaders translated, spirv-val clean). - Code checked: cube binds the same 6-layer 2D-array view and
cube_coords()asimage_op; a16 reads(n+1)//2address VGPRs and a short range raisesUnsupported("image_get_lod coords")instead ofIndexError;tfe/lwe/d16rejected. The non-a16 2D_ARRAY form now requires 3 address VGPRs (test updated) — an intentional tightening to the ISA width. - Gap: the two GPU fixtures are 2D / 2D-array only, so 1D, 3D, CUBE and their a16 forms are covered by translation +
spirv-val, not by a hardware run.
Verdict: LGTM.
|
Tested
AI-assisted (Claude Code). Synthetic inputs only, no game files. |
|
Apple M4 run of
AI-assisted. |
|
Tested
Synthetic inputs only, no game files. AI-assisted (Claude Code). |
Extend Gen.image_get_lod to handle dim:SQ_RSRC_IMG_1D, dim:SQ_RSRC_IMG_3D, and dim:SQ_RSRC_IMG_CUBE alongside 2D and 2D_ARRAY, with a16 half-float coordinate unpacking for all five dimensions and explicit address-length validation. - 1D: binds %images_1d / %img1d / %simg1d (OpCapability Sampled1D) and queries OpImageQueryLod with %float (or low f16 of addr[0] under a16). - 3D: binds %images_3d / %img3d / %simg3d and queries OpImageQueryLod with %v3float ((u, v) from addr[0] and w from low f16 of addr[1] under a16). - CUBE: binds %images_arr / %img2da / %simg2da, maps (s, t, face) via cube_coords(), and passes %v2float (u, v) to OpImageQueryLod per SPIR-V Dim=2D Arrayed=1 rules. - 2D / 2D_ARRAY: keeps a16 half2x16 unpacking and validates address VGPR count for every dim/a16 mode (raising Unsupported instead of IndexError). - Keeps non-PS stage, tfe/lwe/d16, and non-VGPR destination guards intact. AI-assisted (Gemini 4 Neon).
6d8047d to
b7179dd
Compare
|
Tested b7179dd 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.
No runtime C++ changes; only translator/tests touched. Full GPU suite not re-run here (focused test run). AI-assisted (OpenCode). |
|
Re-tested b7179dd merged onto main 561b65a on Apple M4, macOS 27.2.1, MoltenVK 1.4.2, Python 3.15.2 and 3.12.16, since my check of 6d8047d: pass for the translator; needs changes in
AI-assisted. |
|
RTX 4080 retest of the rebased |
|
Tested b7179dd merged with main 561b65a on Ubuntu (WSL2) / Python 3.12.16: pass tests/semantic/test_image_get_lod_dims.py 7 run, 7 passed (1 skipped; same skip before the change); tests/test_image_query_translate.py 10/10. Full semantic suite with the #4357 runner (--jobs 3): 434 files, 6,157 tests, 0 files not ok (730 s); the main baseline in my notes is 433 files, 6,150 tests, 0 not ok, so the only difference is the new file with its 7 tests. Negative control: with tools/rdna2spirv.py from main, test_image_get_lod_dims fails (7 run, 6 failures and 17 errors, 1 skipped) and test_image_query_translate fails 1 of 10 (Unsupported not raised). Not run here: GPU draws (others on this PR report them). Still open from earlier comments, confirmed on this head: docs/design.md (lines 399 and 401) still describes LOD queries as 2D and 2D-array only; the PR does not touch docs. |
Claim: #5256 (comment)
Summary
Extends
Gen.image_get_lodintools/rdna2spirv.pyto support standard AMD RDNA21D,3D, andCUBEdimensions alongside2Dand2D_ARRAY, includinga16packed half-float coordinate unpacking for all five dimensions and explicit address VGPR count validation:dim:SQ_RSRC_IMG_1D: binds%images_1d/%img1d/%simg1d(uses_tex_1d = True,OpCapability Sampled1D), emitsOpImageQueryLod %v2float <si> <u>(%float), and unpacksufrom the low f16 ofaddr[0]undera16.dim:SQ_RSRC_IMG_3D: binds%images_3d/%img3d/%simg3d(uses_tex_3d = True), emitsOpImageQueryLod %v2float <si> <uvw>(%v3float), and unpacks(u, v)fromaddr[0]+wfrom the low f16 ofaddr[1]undera16.dim:SQ_RSRC_IMG_CUBE: binds%images_arr/%img2da/%simg2da(uses_tex_array = True), maps(s, t, face)throughself.cube_coords(f)to(u, v, layer), and passes%v2float (u, v)toOpImageQueryLod(per SPIR-VDim=2D, Arrayed=1rules);a16unpacks(s, t)fromaddr[0]andfacefrom the low f16 ofaddr[1].dim:SQ_RSRC_IMG_2D/dim:SQ_RSRC_IMG_2D_ARRAY: preservesa16UnpackHalf2x16lowering (ignoring the array slice for LOD) and validateslen(addr) >= ((ncoord + 1) // 2 if a16 else ncoord), raisingUnsupported("image_get_lod coords")instead ofIndexErroron short address ranges.tfe/lwe/d16rejections.Verification
spirv-val(vulkan1.2) +llvm-mcround-trip (python -m unittest discover -s tests/semantic -p test_image_get_lod_dims.py -v): 7/7 passed (every generated SPIR-V module validated withspirv-as+spirv-val --target-env vulkan1.2, plusllvm-mc -arch=amdgcn -mcpu=gfx1030assemble/disassemble round-trip across all 10 dim xa16forms).python -I tests/test_image_query_translate.py -v): 10/10 passed.python -I tests/test_image_load_typed.py -v): 23/23 passed.python -I tests/test_text_write_line_endings.py): 3/3 passed.LEONIDA_W64_EMULATE=1; python -I scripts/run_gpu_tests.py --build H:\leonida\Leonida\runtime\build --filter get_lod): 2/2 passed (ps_get_lod,ps_get_lod_array; 3/3 shaders translated andspirv-valclean).git diff --check: clean.AI-assisted (Gemini 4 Neon).