image_fuzz: image_load_pck / image_load_pck_sgn on the hardware oracle, measured on RDNA2 (HW-IMAGE-LOAD-PCK) #2189
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2189"
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?
Imported from ubiquitarianism/leonida. Originally posted by vinceychu on 2026-11-26T03:56:10Z.
Claimed in the coordination issue as: HW-IMAGE-LOAD-PCK (#1608)
What and why
image_load_pck/image_load_pck_sgn("image load with no format conversion") had no measured rule, and thetranslator does not translate them. I measured them natively on an RDNA2 GPU and put the result into the hardware
oracle, so the rule is pinned before anyone implements the op.
Measured rule (gfx1036): the texel's S bytes (S = bytes per texel from the T# FORMAT) form ceil(S/4)
little-endian dwords; a texel under 4 bytes is one dword, zero-extended for
pckand sign-extended from bit 8·S−1for
pck_sgn(the whole texel's sign, not per component).dmaskbit i selects dword i (0 past the last), packedinto consecutive VGPRs. The FORMAT's numeric type (UINT/SINT/UNORM/FLOAT) does not matter.
image_load(dmask 0xf)image_load_pckimage_load_pck_sgnR8G8B8A8_UINT81 7f ff 0281 7f ff 02per component02ff7f81 0 0 0R8G8B8A8_UNORMsame bytes02ff7f81 0 0 0R16G16B16A16_SFLOAT01 80 ff fb 34 12 00 80fbff8001 80001234 0 0R32G32B32A32_SFLOATf0..ffR32_SFLOAT81 7f ff 0202ff7f81 0 0 3f80000002ff7f81 0 0 0R8_UINT/R8_SINT8181/ffffff8100000081ffffff81R16_UINT/R16_SINT01 808001/ffff800100008001ffff8001R8G8_UINT/R8G8_SINT81 f20000f281fffff281R16G16_SINT01 80 fe 7f7ffe80017ffe8001dmask:
R8G8B8A8dmask 2 →0, dmask 5 →02ff7f81 0;R16G16B16A16dmask 2 →80001234, dmask e →80001234 0 0.Changes:
tools/image_fuzz.py:--op image_load|image_load_pck|image_load_pck_sgnfor the hardware oracle (the opcode in thekernel, without
unorm), thepck_oracleCPU model, the sub-4-byte formats R8/R16/R8G8 UINT/SINT and R16G16_SINT forthe pck ops, a
pck_sgn_zero_extendperturbation, and a wrong-FORMAT control that changes the texel size for thepck ops (a same-size FORMAT of another type gives the same words, as measured, so it could not be caught).
--oracle translatorskips the pck ops (the translator does not handle them yet).tools/hw_oracle/tsharp.py: the FORMAT codes of those formats.tests/test_image_fuzz_hw.py:pck_oracleagainst the measured words.docs/shader_validation.md: the rule, the measurements and the commands;docs/design.md: the op is measured, nottranslated.
Tested
Natively on the RDNA2 iGPU (gfx1036) of a Ryzen 9 9950X, Linux amdgpu DRM through
tools/hw_oracle/drm.py, clang 21:image_fuzz.py --oracle hw --op image_load_pck --programs 60 --seed 1: 60/60 match (wave32 34, wave64 26).--op image_load_pck_sgn --programs 200 --seed 9: 200/200 match.--op image_load_pck[_sgn] --negative-control --programs 60 --seed 2: unperturbed 0 mismatches; every perturbationand every wrong FORMAT caught; exit 0.
pck_sgn_zero_extendcaught by 20 of 60 (the sub-4-byte cases).--op image_load(default path): 60/60 match and its negative control unchanged (exit 0): no regression.pytest tests/test_image_fuzz_hw.py tests/test_image_fuzz.py: 99 passed, 1 skipped;image_fuzz.py --self-test,tests/test_ci_registration.py,compileall: clean.GPUs tested: AMD Radeon iGPU of the Ryzen 9 9950X (gfx1036, RDNA2), natively via tools/hw_oracle on Linux amdgpu
AI-assisted: yes (measured by hand with Claude Code; the fuzzer change drafted by Devin, reviewed, fixed and run on the GPU)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md(n/a: measured, not translated yet)🤖 Generated with Claude Code
https://claude.ai/code/session_01RAL8MMXUuNpQAVa1iiyAMP
Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T09:14:51Z.
#2189 | head
790b4f4364a22388e6af311c892349eb4b9abd9e|python3 -m pytest -q -rA tests/test_image_fuzz_hw.py| red: 36 tests, 14 pytest failures, 1 skipped | green: 35 passed, 1 skipped | Red → greenAll four assembly parameterizations ran with Ubuntu clang 21.1.8. The live AMD hardware-oracle case skipped on both sides because the WSL test environment has no dedicated AMD DRM render node.
Pinned main
4938673668d807bf365b61284bf22b1ff8d02cc4, merged into the PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T13:23:12Z.
Review: APPROVED
Independently verified
790b4f436merged cleanly ontomain(d48a957bb) on Windows 11 with a live native RDNA2 HIP hardware oracle (AMD Radeon(TM) Graphics,gfx1036,gfx10T# layout, driver32.0.21030.2001, AMD LLVM 23clang/llvm-mc) plus dual-GPU Vulkan (NVIDIA GeForce RTX 508032.0.16.1664&AMD Radeon(TM) Graphicsgfx1036; zero game files):Red on
main(d48a957bb) control:pytest tests/test_image_fuzz_hw.pyfails (14 failed, 17 passed, 5 skipped).Green on
#2189(790b4f436):pytest tests/test_image_fuzz_hw.py(withLEONIDA_AMD_CLANGset): 36/36 passed, 0 skipped (including all 4test_kernels_assemble_for_both_familiesgfx1030/gfx1150wave32/wave64 assembly tests).gfx1036) HIP hardware oracle (--seed 20261128):tools/image_fuzz.py --oracle hw --op image_load_pck --programs 160: 160/160 exact match (wave3282/82, wave6478/78,0mismatch,0rejected).tools/image_fuzz.py --oracle hw --op image_load_pck --programs 160 --negative-control: unperturbed0/160mismatch;dmask_in_place(108/160),no_sentinels(147/160),transpose(100/160), and all 13 wrong-T#-format perturbations caught.tools/image_fuzz.py --oracle hw --op image_load_pck_sgn --programs 160: 160/160 exact match (wave3282/82, wave6478/78,0mismatch,0rejected).tools/image_fuzz.py --oracle hw --op image_load_pck_sgn --programs 160 --negative-control: unperturbed0/160mismatch;dmask_in_place(108/160),no_sentinels(147/160),transpose(100/160),pck_sgn_zero_extend(42/160), and all 13 wrong-T#-format perturbations caught.--oracle translator,hw --op image_load --programs 80 --seed 20261128):gfx1036HIP: translator80/80match, hw wave3242/42+ wave6438/38match (0mismatch,0rejected).gfx1036Vulkan vsgfx1036HIP: translator80/80match, hw wave3242/42+ wave6438/38match (0mismatch,0rejected).LGTM.
Imported from ubiquitarianism/leonida. Originally posted by vinceychu on 2026-11-28T16:35:18Z.
Discord:
.fountainhead.(for the Contributor role check).Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:20:19Z.
Native Windows 11 Verification (
790b4f4364)Verified
790b4f4364a22388e6af311c892349eb4b9abd9emerged cleanly ontoorigin/main(c7753ed98a56677f10e34078b37eab0540e190ec,git merge-tree --write-treerc=0) on native Windows 11 (26200):origin/mainc7753ed98a):python -m pytest tests/test_image_fuzz_hw.pyfailed (14 failed, 17 passed, 5 skipped), andpython -I tools/image_fuzz.py --oracle translator --op image_load_pckfailed withrc=2(unrecognized arguments: --op image_load_pck).origin/main + 790b4f4364):python -m pytest tests/test_image_fuzz_hw.py(pytest 9.1.1):31 passed, 5 skipped(rc=0) (GFX10/GFX11 T# format tables,pck_oraclemeasured word fixtures acrossR8/R16/R8G8/R16G16/R8G8B8A8/R16G16B16A16/R32G32B32A32/R32_SFLOAT, negative-controlpck_sgn_zero_extendand wrong-sizeFORMATdetection,pck-only format guard onimage_load, andtranslatorskiprc=77).python -I tools/image_fuzz.py --self-test(rc=0) andpython -I tools/image_fuzz.py --oracle translator --op image_load_pck(rc=77).test_docs_design_rows.py5/5,test_docs_table_rows.py2/2,test_docs_links.py17/17,test_docs_cli_flags.py4/4,test_docs_repo_paths.py5/5,test_docs_encoding.py1/1,check_no_game_data.pyrc=0) all passed.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T19:18:44Z.
Tested
790b4f436merged (no commit) withmain7c330c76d: Python 3.12, Windows 11 10.0.26300, CPU only. Ran the PR's tests plus every test file that imports the changed tools, with the PR and with its tools back tomain.test_image_fuzz_hw.py31 passed (5 skipped), plustest_image_fuzz.py,test_image_fuzz_work_isolation.pyandtest_build_runtime_fallback.pyall OK.main:test_image_fuzz_hw.py14 failed; the other 3 files unchanged.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:36:53Z.
Review: APPROVED
LGTM. Measured RDNA2 (
gfx1036) hardware oracle support and tests forimage_load_pck/image_load_pck_sgnacrosstools/hw_oracle/tsharp.py,tools/image_fuzz.py,tests/test_image_fuzz_hw.py, and docs are clean-room verified,MERGEABLE, and independently verified on both native RDNA2 HIP hardware and CPU tests. Holding merge until a fresh green CI pass completes on currentmain.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T13:05:29Z.
Closing and reopening this so that CI runs again on the current
main. Nothing else changes, the head stays790b4f436. MoonEyes's agent.