Repository navigation
Tools: hardware oracle for lds_fuzz — 60,000 LDS programs on real AMD hardware, 0 mismatches; answers SHADER-105 - #1345
Conversation
…* respelling, wider op mix, perturbations hw_oracle: kernels carry their LDS size and VGPR count; ds_* mnemonics and the ds_cmpstore operand order are respelled for GFX11/GFX12; launcher accepts up to 16384 words. lds_fuzz: --oracle hw|translator,hw, --permute/--swizzle-exec/--threads/--extended, --only, --minimize, --keep, --perturb, --negative-control. Default programs unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…only cmpstore swap, perturb scoping, docs wording Merges ItsNotRexed#1265 (libdrm backend, gfx10_spelling) keeping both raw_kernel_text changes. The kernel metadata's .max_flat_workgroup_size is now 1024 (was 256) so 256-thread groups launch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent CPU/static verification only (no GPU or hardware-number claim), at head
Coordination note: this PR and #1365 both edit |
|
Tried 8a52cbc on an AMD Radeon RX 9070 (RDNA4, gfx1201), AMD 26.11.2, 1. GFX12 has no
Replacing 2. On RDNA4, wave64
For example, with K = 32, lanes 0..3 read lanes 32..35 and lanes 30..33 read 62, 63, 0, 1.
AI-assisted (Claude Code). |
This continues the hardware oracle from #1160, #1202 and #1248. It answers SHADER-105 (@edupode).
What and why
tools/lds_fuzz.py(FUZZ-6) gains--oracle hwand--oracle translator,hw. The same seeded LDS programs run natively on an AMD GPU, and every stored word is compared with the model. A run uses wave32 and wave64, real group sizes, EXEC masks ands_barrier, with the LDS size in the kernel descriptor. Until now the LDS model had only been checked against the translator.tools/hw_oracle/asm.py:ldssize andvgprscount.ds_*:ds_load_*,ds_store_*,ds_load_2addr*,ds_storexchg_rtn_b32.ds_cmpstore_rtn_b32takes its operands in swapped order (below)..max_flat_workgroup_sizeis now 1024 for every kernel; it was 256.tools/hw_oracle/hw_oracle.c: the word limit goes from 4096 to 16384.lds_fuzz.pyoptions:--only,--minimize,--keep,--perturb NAME,--negative-controland--hw-arch. Opt-in op-mix switches are--permute(ds_permute_b32),--swizzle-exec(ds_swizzle_b32under EXEC masks),--threads 32|64|128|256|mix, and--extendedfor all three.asm(),model()and the op list againstmain, so default translator-mode runs and CI are unchanged.Results: Radeon 880M (gfx1150, RDNA3.5), driver 26.11.2
--extended, 6 seeds × 2000--emulateSHADER-105: the model matches gfx1150 for every family Intel flagged, under EXEC masks, in both wave sizes and in multi-wave groups. Those families are:
max_i32/max_u32, with and without return;ds_cmpst;u8,i8,u16,i16, and the d16/d16_hi forms;wrxchg,read2/write2(plain andst64), and the wide reads and writes;ds_swizzle,ds_bpermuteandds_permute.The Intel mismatches went away with #820's constant-EXEC fix. gfx1150 is not RDNA2.
Findings (gfx1150 only; RDNA2 not measured):
ds_cmpstore_rtn_b32takes the store value before the compare value, the reverse of GFX10'sds_cmpst_rtn_b32. llvm-mc encodes both spellings of the same text identically, so only hardware shows it. Without the swap, every program with acmpstfailed, and each minimised to that one op.ds_swizzle_b32whose source lane is off returns 0, likeds_bpermute. The model is corrected accordingly.--extendedprograms on AMD Vulkan, native and emulated. RDNA2 is unverified and the translator is not changed here.ds_permute_b32andds_bpermutebehave as modelled in both wave sizes. Only active lanes send, an unwritten lane gets 0, and the two 32-lane halves stay separate.Overlap: #789 makes
ds_permute_b32part of the default op mix, while this PR keeps it opt-in with--permute. Whichever lands second reconciles them.Tested
py -I tests/test_lds_fuzz_hw.py: 38 tests.tests/test_hw_oracle.py: 24 tests.test_lds_fuzz,test_lds_fuzz_cliandtest_crosslane_fuzzpass too.ds_cmpstare tested.--oracle hw --extendedover 300 programs gave 600/600 matches.An independent review checked several points:
Its findings are fixed: the Linux-backend crash, a merge with #1265, the SHADER-105 and swizzle wording, gfx12 scoping, and
--perturbhandling.AI-assisted (Claude Code).
Checklist
docs/design.md, with how it was confirmed. (No translator change.)🤖 Generated with Claude Code