Repository navigation
Conversation
…at branches image_read_typed picks the SINT, UINT or float view from the T# FORMAT at run time, and each of the three branches extracted the components and did the EXEC-masked register writes itself. Without d16 those writes are the same for every class, so the branches now only produce their %v4uint_st, two OpPhis at the merges pick one, and one set of extracts and writes follows. With d16 the packing depends on the class and stays in the branches. test_image_load_typed follows each fetch's bits through the phis and checks that the three fetches are extracted once per dmask component. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested 41f8317 on NVIDIA GeForce RTX 4090 and AMD Radeon(TM) Graphics on Windows 11: pass.
I ran For the synthetic 2D load in the test file, the emitted assembly shrinks from 514 to 504 lines for mask 0x1, from 532 to 510 for 0x9, and from 568 to 522 for 0xf. These counts measure assembly size. GPU execution time was outside this check. AI-assisted. |
|
I tested the merged translator from With a synthetic 3D I also preloaded lane 0’s destination VGPR with a different sentinel for each numeric class, made only lane 1 active for the load, then restored lane 0 to store its VGPR. All three sentinels survived in GPU readback, including on the combined tree with nested bounds guards. That checks the inactive-lane behavior of the write after the merge. AI-assisted (OpenAI Codex). |
|
Tested Full
So the AI-assisted: runs were done with Claude Code. |
Kam471
left a comment
There was a problem hiding this comment.
Head 41f831769000 · Verdict: LGTM
python -I -m pytest tests/test_image_load_typed.py -q → 23 passed, 53 subtests, including spirv-val for every dimension (spirv-as/val 1.4.363 on PATH). git diff --check clean.
Non-d16 now emits one OpPhi pair per merge (%s/%e3 and %u/%f) and one write after %e2; the d16 path still writes per class. spirv-val accepts it. No blockers.
New SHADER item. Claim: #5361 (comment)
Gen.image_read_typed(the typed fetch, sample and gather paths ofimage_load*,image_sample*andimage_gather4*) picks the image view from the T#'s FORMAT at run time: SINT, UINT or float, in two nested selections. Each of the three branches extracted the result's components and did the EXEC-masked register writes itself. That is 20 instructions per branch for a dmask-0xf result (4OpCompositeExtract, then a load of the old value, a load of%active, a select and a store per VGPR), and the same 20 in all three branches.Change
Without
d16, the result is written the same way whatever the class, so:%v4uint_st;OpPhis at the merges pick one (the inner merge for UINT/float, the outer for SINT/the rest);The predecessor labels come from
current_label_placeholder(), as in the other phis of the translator, so areadcallback that opens blocks of its own still gets the right one.With
d16the packing depends on the class (saturated integer halves or RTE f16), so those writes stay in their branches, as before.Tests
tests/test_image_load_typed.py:test_only_the_dmask_components_are_writtenfollows each fetch's bits through the phis. It now also checks that the three fetches meet in one value and that no branch extracts its own bits. Onmainit fails, since every branch extracts and writes; here all 23 pass, and they also pass merged with fix(translator): image_load outside the image returns zeros (EGEN-IMGLOAD-OOB) #5307. The d16 tests, including the odd-dmask high-half one, pass unchanged.pytest tests/semantic -n 10andpytest tests --ignore=tests/semantic -n 10: the same failures asmain3faac557(semantic: 6,243 passed, 5 failed, the knowntest_loop_ballot_barriersubtests).scripts/run_gpu_tests.pyon Intel UHD Graphics 750 (Windows 11,LEONIDA_VK_DEVICE=Intel,LEONIDA_W64_EMULATE=1; the test programs are built from98fa503f, since this PR changes no C++): 180/217 passed, 37 skipped, every test with the same result asmain3faac557on the same setup. The image tests among them all pass:cs_imgload,cs_imgload_d16,ps_sample_implicit_sint(the SINT branch),ps_gather_*,ps_sample_c*,ps_texture_*andcs_sample_lz_int_d16.Measured on my own 1.0.2.1 corpus (shard 0/40, counts only)
main3faac557spirv-val.spvbytesOther PRs
main, with the open image PRs rdna2spirv: image_load_pck, image_load_pck_sgn, image_load_mip_pck(_sgn): raw texel dwords, measured on RDNA2 #3152, rdna2spirv: extend image_load_mip to 1D, 2D, 2D_ARRAY, CUBE, and 3D with a16 and d16 #4206, rdna2spirv: implement 14 image_gather4_{c_l,cl,c_cl,b,b_cl,c_b,c_b_cl}[_o] variants #5206 and rdna2spirv: implement image_msaa_load (MIMG 0x80) #5225, and with my rdna2spirv: the legacy multiply tests |x|, |y| < FLT_MIN instead of flushing both operands, 11% smaller modules (SHADER-771) #4345, rdna2spirv: f32 constants are module-scope OpConstants, not a bitcast at each use (-2.4% SPIR-V) #4391, rdna2spirv: a multi-dword MUBUF access builds each bounds check once #4477, rdna2spirv: a bitcast back to a value's original type is the original id (-1.4% SPIR-V) #4510, rdna2spirv: the heap base is built once in the entry block, not at every memory access (SHADER-822, -1.9% SPIR-V) #4633, rdna2spirv: a constant operand of a denormal-flushing op is flushed at translation, not at run time (-0.9% SPIR-V) #5263 and rdna2spirv: the f32 denormal flush tests the exponent bits, not |x| < FLT_MIN on the float (-2.9% SPIR-V) #5347.image_loadreturns zeros) conflicts on one line oftests/test_image_load_typed.py: both change thebits = …lookup intest_only_the_dmask_components_are_written. The combined line ism.through_phis(...)around fix(translator): image_load outside the image returns zeros (EGEN-IMGLOAD-OOB) #5307'sm.texel(rid)lookup. I'll rebase if fix(translator): image_load outside the image returns zeros (EGEN-IMGLOAD-OOB) #5307 lands first.AI-assisted (Claude Code). No game files.
🤖 Generated with Claude Code