rdna2/mimg: add 4 texture formats and 14 _mip/_l/_o 2D ops #152
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!152
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/152/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Lewandox on GitHub · 2026-11-24 15:42 UTC · original
Lewandox:feat/rdna2-mimg-formats-offsets-lod→main· +597 −108 · 6 files · 3 commits · merged 2026-11-25 15:25 UTCPart of #21.
Summary
Extends the RDNA 2 MIMG 2D image subsystem (CPU reference interpreter + HLSL/DXIL translator) with 4 additional GFX10 texture formats and 14 additional MIMG opcodes (explicit mip-checked load/store, explicit LOD
_l, and signed 6-bit texel offset_osampling/gather4 variants), raisingrdna2_exec.coverage()from 599/1,487 to 613/1,487.What's included
rdna2_image.py,rdna2_exec_image.py,rdna2_hlsl_image.py):FORMAT_8_UNORM(1, 1 byte/texel,(R, 0, 0, 1.0))FORMAT_8_8_UNORM(14, 2 bytes/texel,(R, G, 0, 1.0))FORMAT_32_FLOAT(22, 4 bytes/texel,(R, 0, 0, 1.0))FORMAT_32_32_FLOAT(64, 8 bytes/texel,(R, G, 0, 1.0))8_UNORM,8_8_UNORM) in HLSL use 4-byte-alignedg_memory.InterlockedAnd+InterlockedOrso concurrent lanes writing adjacent texels within the same dword never race.image_load_mip(1),image_store_mip(9) — mip 0 supported; non-zero mip levels are guarded cleanly._l) & signed 6-bit texel offset (_o, AMD RDNA 2 Table 8.9 address order[offset], [z_ref], s, t, [lod]):image_sample_l(36),image_sample_o(48),image_sample_lz_o(55),image_sample_l_o(52)image_sample_c_l(44),image_sample_c_o(56),image_sample_c_lz_o(63),image_sample_c_l_o(60)image_gather4_l(68),image_gather4_o(80),image_gather4_lz_o(87),image_gather4_l_o(84)_lselectsmin_filterwhenlod > 0.0andmag_filterwhenlod <= 0.0(single mip level 0)._ounpacks signed 6-bit(off_x, off_y)frombits[5:0]andbits[13:8]and applies the texel offset before address-mode wrapping/clamping, with safe int32 clamp bounds so+ offsetcannot overflow.tests/test_rdna2_image_formats_lod.py(+24 tests: 8 CPU unit tests + 16@gpuparity tests covering all 4 new formats, sub-word intra-dword store safety,image_load_mip/image_store_mip, signed_ooffsets,_lmin/mag filter selection, and_c/gather4combinations).tests/test_rdna2_exec.py(image_load_mip->image_atomic_swap) andtests/test_rdna2_image.py(FORMAT_32_FLOAT->GFX10_FORMAT_16_16_16_16_FLOAT).647 -> 671tests,599 -> 613encodings).Verification
ruff check --select W605,F,E9 PrototypeScarlett tests tools: All checks passed!pytest -q: 454 passed, 217 skipped (0 failed, 671 collected), includingtest_readme_sync.py.@gputest cases verified locally on the CPU interpreter and HLSL translator (waiting for CI D3D12/WARP runner to execute the@gpuparity tests).@akimfomin on GitHub · 2026-11-24 16:25 UTC · original
Independent synthetic verification at
fd2a5b36db7770fc663b979ad98baf438ca89aa1I ran the new tests on Windows 11 build 28000 with DXC 1.9.2609.5. All 24 added tests (16 GPU dispatch and byte-for-byte comparisons, 8 CPU) and 10 existing image tests passed on each backend. RTX 4070 Ti SUPER driver 32.0.16.1714 and Microsoft WARP 10.0.28000.3365 both reported 34 passed, zero skips.
I also reran the 12 bilinear/clamp controls from #145 against this head and its exact base
49c605a67e682ee3420457c5f3e9215eb733e366. On RTX both trees passed all 12. On WARP both gave the same 8 passes and the same 4 failures, with identical first differing bytes.PortBridge linked the pending GPU check to our earlier WARP rounding baseline, so the older result could be checked separately against both revisions. The runs used synthetic inputs. Codex assisted the test and report.
@Lewandox on GitHub · 2026-11-24 17:09 UTC · original
Thanks for the review!
ISA reference for the 6-bit signed
offsetlayout ([5:0]/[13:8]):In the AMD "RDNA 2" Instruction Set Architecture Reference Guide (
rdna2-shader-instruction-set-architecture.pdf, Nov 2020), Chapter 8 — Section 8.2 (Vector Memory (VM) Image Instructions, Table 8.8 / 8.9 for MIMG address components):image_sample*_oandimage_gather4*_o, theoffsetis the first VGPR address dword (vaddr[0], preceding[z_ref], s, t, [lod]), not a field in the 64-bit MIMG instruction word itself.-32..+31):Xoffset:bits[5:0]Yoffset:bits[13:8]Zoffset:bits[21:16]aco_instruction_selection.cpp/ac_nir_to_llvm.c:(x & 0x3f) | ((y & 0x3f) << 8) | ((z & 0x3f) << 16)).LLVM tables /
tools/rdna2_mnemonics.py --verifier:rdna2.py) orrdna2_ops.py.1, 9, 36, 44, 48, 52, 55, 56, 60, 63, 68, 80, 84, 87) resolves directly from the existing LLVM-generatedrdna2_ops.MNEMONICStable (1-to-1 match on all 23SUPPORTED_OPS).tools/rdna2_mnemonics.py <llvm_dir> --verifierlocally since I don't have the LLVMgfx10_asm_*.stest folder checked out here, and neitherrdna2.pynorrdna2_ops.pywas touched.@KainanP on GitHub · 2026-11-24 18:02 UTC · original
Testé
3eaf7c9sur RTX 4060 Laptop (pilote 32.0.16.1047), WARP et Intel UHD (8086:a78b, vagues de 16 lignes), Windows 11 26200, runtime compilé :Rien à signaler sur ces trois adaptateurs.
Essai fait avec l'aide d'une IA (Claude Code).
@minecraftafk072 on GitHub · 2026-11-24 18:39 UTC · original
Usage d'IA : essais lancés et résumés avec Claude Code (Claude Opus 5.5) sur ma machine.
Essai de la tête rebasée
36fbdcd(base38cc0fa), avec en plus un GPU AMD RDNA 2 : iGPU du Ryzen 9 7900X3D (1002:164e, pilote 31.0.24027.1012), Windows 26300,anyxboxx_gpu_run.execompilé (VS Build Tools 2026, MSVC 14.52).test_rdna2_hlsl.py+test_rdna2_image.py+test_rdna2_image_formats_lod.py+test_rdna2_image_ops.py(3 essais)660 + 12 = 672 tests collectés, comme dans les 8 README.
ruff check --select W605,F,E9propre. Les 12 ignorés : Rust et TomBox non compilés dans ce checkout, la PR n'y touche pas.Les filtres bilinéaires, les décalages
_oet les écritures sous-mot (InterlockedAnd/InterlockedOr) donnent donc les mêmes octets que l'interpréteur sur RDNA 2 aussi. Ces tests comparent le HLSL traduit à l'interpréteur ; ils n'exécutent pas les instructions MIMG natives de la carte.@Cai-piroska on GitHub · 2026-11-24 21:42 UTC · original
Usage d'IA : essais lancés et résumés avec Claude Code (Claude Opus 5.5) sur ma machine.
Essai à
97e619a(runtime demain8b466b1, VS 2022 Build Tools, Windows 26300),tests/test_rdna2*.py, y compristest_rdna2_image_formats_lod.py, 2 essais par carte :Seul échec :
test_extended_alu_matches_interpreter_on_gpusur la 3080 Ti (v_rndne_f322.5 → 3.0, traité par #160), sans rapport avec cette PR. Les nouveaux formats et les opérations mip/LOD/offset donnent les mêmes octets que l'interpréteur sur les deux constructeurs.@Lewandox on GitHub · 2026-11-24 21:42 UTC · original
Rebased onto latest \main\ (\547bb2) and synced all 9 READMEs including \docs/i18n/README.ru.md\ (679 tests, 613 encodings; \ est_readme_sync.py\ +
uff\ passing).
@minecraftafk072 on GitHub · 2026-11-24 22:31 UTC · original
Usage d'IA : essais lancés et résumés avec Claude Code (Claude Opus 5.5) sur ma machine.
Tête
1f1d6ce(base608cd4b), Windows 26300, dxc 1.9.2602.17, runtime demaincompilé (la PR ne touche pasruntime/).test_rdna2_image_formats_lod.py1002:164e, pilote 31.0.24027.1012)97e619a(664 passent, 12 ignorés) etdce962b, rebasée surb547bb2(666 passent, 13 ignorés).@LooperSalty on GitHub · 2026-11-24 16:56 UTC · original · reviewed
Revue : tests verts, une question avant approbation.
Vérifié sur
fd2a5b3(base49c605a) :ruff check --select W605,F,E9 PrototypeScarlett tests tools: OKpytestavec le lanceur GPU : 511 passed, 160 skipped (671 collectés, compteurs des 8 README synchronisés)tests/test_rdna2_image_formats_lod.py: 24 passed (16 parité GPU/WARP octet par octet)Question (bloquante seulement si la réponse est négative) : pour
image_sample_oet variantes, la PR décode le décalage signé de 6 bits depuis les bits [5:0] et [13:8]. Pouvez-vous citer la page de la doc ISA RDNA 2 qui donne ces positions de bits pour le champ d'offset MIMG (tableau du format MIMG), et indiquer si le décodeur est confronté aux tables LLVM (tools/rdna2_mnemonics.py --verifier) ? L'oracle actuel (interpréteur contre HLSL) vérifie la cohérence, pas que le décodage des bits correspond au matériel.Le reste (formats 8 et 32 bits, écritures sous-mot via InterlockedAnd/InterlockedOr,
_lmin/mag selon le signe du LOD) est clair et couvert par les tests.@LooperSalty on GitHub · 2026-11-24 18:16 UTC · original · review (dismissed)
Revue (tête 3eaf7c9) :
_unpack_offsetdansrdna2_exec_image.py) lit off_x dans bits [5:0] avec extension de signe via 0x20, et off_y dans bits [13:8] via 0x2000. Cela correspond à la référence citée (table 8.9) et à la forme de Mesa.@LooperSalty on GitHub · 2026-11-24 20:54 UTC · original · reviewed
Après la fusion de #162 (main
292079d),docs/i18n/README.ru.mdfait partie des traductions contrôlées partests/test_readme_sync.py. Une fois la branche rebasée sur main, ce test échoue (compteur de tests, vérifié en fusionnant main localement). Il faut reporter les mêmes changements dansREADME.ru.md(compteur à la valeur de cette PR) puis relancer pytest.