mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:05:53 +01:00
[PR #2189] image_fuzz: image_load_pck / image_load_pck_sgn on the hardware oracle, measured on RDNA2 (HW-IMAGE-LOAD-PCK) #2193
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2193
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2189
Author: @vinceychu
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:hw-image-load-pck📝 Commits (1)
790b4f4image_fuzz: image_load_pck / image_load_pck_sgn on the hardware oracle, measured on RDNA2 (HW-IMAGE-LOAD-PCK)📊 Changes
5 files changed (+311 additions, -45 deletions)
View changed files
📝
docs/design.md(+1 -0)📝
docs/shader_validation.md(+36 -0)📝
tests/test_image_fuzz_hw.py(+125 -17)📝
tools/hw_oracle/tsharp.py(+6 -2)📝
tools/image_fuzz.py(+143 -26)📄 Description
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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.