upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tools/lds_fuzz.py
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:15:30 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:15:30 -0500
commita90289cbb4dd9761edbf0c44553aa5a4eead2c8d (patch)
tree619ff2119689dfeab6a440a9240fd3a29f0c8a0b /tools/lds_fuzz.py
parent4c4cb16bbf2dc642e74e4496bfb8f227adae7465 (diff)
parentdbe5070d185d1c216e21e1f23b80156e7f2b3ad8 (diff)
Merge pull request #4519 from Størm
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/lds_fuzz.py')
-rw-r--r--tools/lds_fuzz.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/tools/lds_fuzz.py b/tools/lds_fuzz.py
index 44a7df23a..ed9bccc6b 100644
--- a/tools/lds_fuzz.py
+++ b/tools/lds_fuzz.py
@@ -424,11 +424,11 @@ class Program:
424 def hw_lines(self, arch, ops=None): 424 def hw_lines(self, arch, ops=None):
425 """The program as a native kernel body for tools/hw_oracle: the entry EXEC is saved and restored (a partial 425 """The program as a native kernel body for tools/hw_oracle: the entry EXEC is saved and restored (a partial
426 wave has fewer lanes than -1), the stores go through the output pointer in s[2:3], and the ds_* mnemonics are 426 wave has fewer lanes than -1), the stores go through the output pointer in s[2:3], and the ds_* mnemonics are
427 the ones the architecture names them.""" 427 the ones the architecture names them, and so are the barrier and the LDS waits (GFX12, asm.sync_lines)."""
428 from hw_oracle import asm 428 from hw_oracle import asm
429 ops = self.ops if ops is None else ops 429 ops = self.ops if ops is None else ops
430 lines = self.body(ops, hw=True, arch=arch) 430 lines = self.body(ops, hw=True, arch=arch)
431 return [asm.ds_line(ln, arch) for ln in lines] 431 return [out for ln in lines for out in asm.sync_lines(asm.ds_line(ln, arch), arch)]
432 432
433 def body(self, ops, hw=False, arch="gfx1150"): 433 def body(self, ops, hw=False, arch="gfx1150"):
434 w64 = self.wave == 64 434 w64 = self.wave == 64
@@ -922,13 +922,20 @@ def run_translator(progs, a, work, tally):
922 922
923def hw_skip_reason(p, arch): 923def hw_skip_reason(p, arch):
924 """Why a program cannot run natively on this GPU, or None. GFX11 renamed the ds_* loads and stores, which 924 """Why a program cannot run natively on this GPU, or None. GFX11 renamed the ds_* loads and stores, which
925 asm.ds_line respells, and swaps ds_cmpstore's data operands (measured on gfx1150). The swap is not measured on 925 asm.ds_line respells, and swaps ds_cmpstore's data operands (measured on gfx1150 and on gfx1201); GFX12 also
926 GFX12, so a program with a ds_cmpst is skipped there; everything else the generator emits is spelled the same 926 spells the barrier and the LDS wait differently, which asm.sync_lines respells. Everything else the generator
927 on GFX10, GFX11 and GFX12 (assembled for gfx1030, gfx1100, gfx1150 and gfx1201), so the other skips are the 927 emits is spelled the same on GFX10, GFX11 and GFX12 (assembled for gfx1030, gfx1100, gfx1150 and gfx1201), so
928 assembler's own rejections, which the runner reports.""" 928 the other skips are the assembler's own rejections, which the runner reports.
929
930 One behaviour differs on GFX12: a wave64 ds_bpermute_b32 reaches all 64 lanes there, while RDNA2 (the console's
931 generation, and what this model describes) keeps each 32-lane half separate. Measured with every lane asking for
932 lane (l + 32) mod 64: an RX 9070 XT (gfx1201) returns lane l ^ 32, a gfx1036 iGPU returns lane l, and on gfx1201
933 300 of 300 wave64 programs match --perturb bpermute_wave64_cross. So those programs can't check the RDNA2 model on
934 GFX12 and are skipped there; wave32 and every other wave64 program still run."""
929 from hw_oracle import asm 935 from hw_oracle import asm
930 if asm.family(arch) == "gfx12" and any(op["kind"] == "cmpst" for op in p.ops): 936 if asm.family(arch) == "gfx12" and p.wave == 64 and "bpermute_wave64_cross" not in PERTURB \
931 return "ds_cmpstore_rtn_b32 operand order is only measured on GFX11 (gfx1150)" 937 and any(op["kind"] == "bpermute" for op in p.ops):
938 return "a wave64 ds_bpermute_b32 reaches all 64 lanes on GFX12 (measured on gfx1201), not each 32-lane half"
932 return None 939 return None
933 940
934 941