Commit Graph

71 Commits

Author SHA1 Message Date
182746f038 Merge pull request #2189 from vinceychu/hw-image-load-pck
image_fuzz: image_load_pck / image_load_pck_sgn on the hardware oracle, measured on RDNA2 (HW-IMAGE-LOAD-PCK)
2026-12-01 15:53:45 +01:00
f385b263bb Merge pull request #342 from kotekompotek/work/test-hw-oracle-runner
test: unit tests for tools/hw_oracle/runner.py
2026-11-28 15:47:44 +01:00
edec4db60e Merge pull request #1332 from fin-github/takeover/old-9928-wint-diff-gfx12
wint_diff: GFX12 has no always-true/false VALU compare; skip those programs by name (OLD-9928)
2026-11-28 15:30:40 +01:00
9b455677f4 Merge pull request #2326 from kirigayakazima/fix/hw-oracle-asm-gfx12-wave
hw_oracle/asm: fix GFX12 scalar load, per-kernel wave metadata, and validation
2026-11-28 11:58:40 +01:00
6455daffee hw_oracle/drm: harden ELF64 bounds, subprocess timeouts, and temp cleanup 2026-11-26 21:50:53 +08:00
556f625a94 hw_oracle/asm: fix GFX12 scalar load, per-kernel wave metadata, and validation 2026-11-26 21:48:13 +08:00
790b4f4364 image_fuzz: image_load_pck / image_load_pck_sgn on the hardware oracle, measured on RDNA2 (HW-IMAGE-LOAD-PCK)
design.md had no measured rule for the no-format-conversion image loads.
Measured natively on an RDNA2 iGPU (gfx1036) through tools/hw_oracle: the
texel's bytes form little-endian dwords selected by dmask (0 past the last),
a texel under 4 bytes is zero-extended (pck) or sign-extended from its top
bit (pck_sgn), and the FORMAT's numeric type does not matter.

image_fuzz.py gets --op image_load_pck|image_load_pck_sgn for the hw oracle,
the pck_oracle CPU model, sub-4-byte texel formats, a pck_sgn_zero_extend
perturbation and a wrong-FORMAT control that changes the texel size;
tests/test_image_fuzz_hw.py pins the measured words. The translator does not
translate these ops yet; this is the measured model it needs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RAL8MMXUuNpQAVa1iiyAMP
2026-11-25 22:55:38 -05:00
c9e1bffe54 hw_oracle: recognize cl.exe behind a Windows path separator on any host
Oliwettoo's Linux check of #342 caught test_is_msvc_recognizes_cl_variants
failing off Windows: os.path.basename does not split on backslash there.
Normalize separators in _is_msvc so a Windows-style path is recognized on
every host.
2026-11-25 12:51:19 +05:00
ddd1923cb2 wint_diff: GFX12 has no always-true/false VALU compare; skip those programs by name
GFX12 dropped v_cmp_{t,f}_{i32,u32,i64,u64} and their v_cmpx_ forms: AMD LLVM 23
(rocm-sdk-core 10.0.0) assembles all sixteen for gfx1036, gfx1100 and gfx1150 and rejects
every one for gfx1201. wint_diff emits v_cmp_t_u32 and v_cmp_f_i32 (and the v_cmpx_ forms),
so on an RX 9070 XT those programs were counted as "assembler rejected", and the whole batch
carried the first error's text: on main all 69 skips of seed 1 read "... v_cmp_t_u32",
including the programs that only use v_cmp_f_i32.

- tools/hw_oracle/asm.py: GFX12_VALU_REMOVED lists the sixteen. valu_skip_reason() names
  them on gfx12xx (and ignores an _e32/_e64 suffix); program_skip_reason() returns the
  first such reason of a program's lines. The GFX10.1-only mads are unchanged.
- tools/wint_diff.py: hw_results() sends only the programs the GPU can run; the others get
  their reason and are never assembled. The run and the shrinker both use it.
- Tests: the sixteen, the suffixes, gfx1013/1036/1100/1150 unchanged, and hw_results with a
  fake oracle (gfx1201 assembles only the program it can run; gfx1036/1150 run all four).

RX 9070 XT, `wint_diff.py --oracle hw --programs 500 --wave both`: seeds 1 and 2 give the
same 431 / 426 passes and 69 / 74 skips as main, 0 mismatch; the skips now read v_cmp_f_i32
29, v_cmp_t_u32 25, v_cmpx_f_i32 8, v_cmpx_t_u32 7 (seed 1) and 25 / 25 / 12 / 12 (seed 2).
gfx1036: 500/500 on both seeds, as on main.

AI-assisted (Claude Code).

(cherry picked from commit 32a9427ba4)
2026-11-24 16:57:31 -05:00
b68ce6cccd hw_oracle: remove the temp workdir when the constructor fails (HW-ORACLE-WORKDIR-LEAK)
DrmOracle.__init__ and Oracle.__init__ create a temporary workdir and then
can raise Unavailable (a skipped probe, exit 77). close() is never reached
for an object whose constructor raised, so every skipped run left a
leonida-hw-oracle-* directory in the temp dir.

Remove the directory when the constructor made it and then fails. A
caller-supplied workdir is left alone. tests/test_hw_oracle_workdir_leak.py
covers the early, late and caller-supplied cases with no GPU or libdrm.
2026-11-24 10:53:58 +01:00
3fd9a89e20 Merge pull request #479 from kotekompotek/work/hw-oracle-asm-strip-lines
Why merged: indented SALU lines are now parsed for literals and removed opcodes.
Why it's good: security-reviewed; tested on Windows 11 merged onto main c023a36: the new regression test fails on main and passes here; test_hw_oracle's 59 tests still pass.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 01:59:30 -05:00
0b2d8399d1 hw_oracle/asm: strip leading whitespace in literals() and skip_reason() 2026-11-24 09:13:59 +05:00
d14b22fe00 fuzz: the gfx1170+ hardware gate is per family, not per tool
asm.rdna23_skip_reason refused every family of valu_fuzz.py and lds_fuzz.py
on gfx1170+ with "the kernels here do not assemble for it" (fef61b247), which
is false for most of what they emit. Checked by assembling what the
generators produce with AMD clang 23 (300 programs per wave size each):

- lds_fuzz assembles clean for gfx1150, gfx1170 and gfx1201 and runs there:
  on an RX 9070 (gfx1201, RADV/Mesa 26.2.6, the Linux DRM launcher) the
  default --oracle hw run gives wave32 500/500 match, wave64 250 match plus
  250 skipped for the committed wave64 bpermute reason, 0 mismatch,
  0 rejected. The blanket gate is gone; the per-program hw_skip_reason is
  the mechanism.
- valu_fuzz --family f16 assembles clean for gfx1150, gfx1170 and gfx1201
  (its op_sel lines are respelled by the runner's asm.opsel16_spelling
  there, which the assemble test now applies as well): 500 programs (1,000
  kernels, both wave sizes) 1,000/1,000 match, 0 rejected, and the negative
  control catches all six wrong models.
- valu_fuzz --family mem assembles clean for gfx1150 AND gfx1170 (every op
  kind, 0 of 600 kernels rejected per arch) but genuinely cannot on gfx12xx:
  GFX12 has no s_waitcnt_vscnt ("instruction not supported on this GPU")
  and rejects every buffer_load/store_b32/b64/b96/b128 form the generator
  writes ("operands are not valid for this GPU or mode"). The new
  hw_family_skip_reason refuses exactly that, naming both rejects, and
  --family mem --oracle hw exits 77 with them on gfx1201.

Running the lds hardware suite un-skipped on gfx1201 found one more
difference: a wave64 ds_permute_b32 reaches all 64 lanes on GFX12, like
ds_bpermute_b32. Measured on the RX 9070: every lane sending to lane
(l + 32) & 63 delivers its value to lane l ^ 32, all 64 lanes, with
lane-to-itself sending as the control; a masked wave64 ds_swizzle keeps
its halves there (0 mismatches in a 40-program --swizzle-exec run). Those
programs are skipped on gfx12xx now too, and the new perturbation
permute_wave64_cross models the crossing: under it every wave64 program
that runs in the --extended seed-1 run matches (23 of 40, 0 mismatch). The
lds negative control on gfx1201 reports the two wave64_cross perturbations
as not detected -- on GFX12 they are the measured behaviour, so the canary
cannot trip there; every other perturbation is caught.

asm.rdna23_skip_reason stays for the OnHardware guards of f32_fuzz and
f16_trans_sweep, whose MODE probes set IEEE and DX10_CLAMP, which gfx1170+
cannot encode (FUZZ-43); its docstring now says that instead of claiming
the fuzzers use it.

CPU: tests/test_valu_fuzz.py 88 OK, tests/test_lds_fuzz.py 37 OK,
tests/test_lds_fuzz_hw.py 44 OK (its OnHardware class runs on the RX 9070:
44 OK), tests/test_lds_fuzz_cli.py 8 OK, tests/test_hw_oracle.py 59 OK
(3 skips), tests/test_f32_fuzz.py 28 OK (1 skip), compileall clean,
scripts/check_no_game_data.py clean. The AMD-clang tests ran with
LEONIDA_AMD_CLANG=/opt/rocm/llvm/bin/clang. The semantic suite is
unchanged: its 47 failures (test_image_atomics_guard,
test_image_store_d16) are on the base commit too; nothing here touches
the translator.

AI-assisted (GLM-5.3).
2026-11-23 19:48:52 +01:00
634370e59a hw_oracle: run the Linux DRM launcher on GFX11 and GFX12
hw_oracle_drm.c refused every compute engine but version 10, so on an
RX 9070 (gfx1201, engine 12.0) `f32_fuzz.py --oracle hw` could not run
at all: 'hardware oracle unavailable: compute engine 12.0: only version
10 (GFX10, RDNA1 and RDNA2) is supported'.

The registers the launcher writes sit at the same SH offsets on GFX10,
GFX11 and GFX12 — Mesa's register JSON and AMD's PAL offset headers
(gfx9_plus_merged_offset.h, gfx12_merged_offset.h) agree on them, and
PAL's gfx12CmdUtil.cpp still builds plain SET_SH_REG — so only the
preamble and the cu-mask writes branch:

- Engines 11 and 12 take the gfx11 init of libdrm's own dispatch test
  (tests/amdgpu/shader_test_util.c, 2.4.115): REQ_CTRL on its own, the
  four COMPUTE_USER_ACCUM registers, no CP_COHER_START_DELAY. The
  checksum stays in the SH space, as PAL writes it on GFX11
  (gfx9PipelineChunkCs.cpp): libdrm's gfx11 path sends it as UCONFIG
  0x22a, which does not reach the register.
- The indexed COMPUTE_STATIC_THREAD_MGMT_SE0..3 writes stop at engine 11:
  GFX12's SE masks reset to 0xffffffff (AMD's gfx12_merged_default.h) and
  neither PAL nor RADV touches them there.
- arch_name covers the GC 11 and GC 12 families with Mesa's
  ac_identify_chip and amdgpu_asic_addr.h ranges (NV4 also needs the IP
  minor, for gfx1210; amd_family.c names GFX1156 gfx1153 too); a chip
  only labelable by generation gets a representative, which drm.py maps
  the way it already mapped gfx10xx. The engine-version check takes 10,
  11 and 12; the gfx10 stream itself is unchanged.

drm.py's ELF and descriptor parsing needed nothing: the code-object-v5
layout it reads is generation-independent, and COMPUTE_PGM_RSRC2's
LDS_SIZE is bits 15..23 in 512-byte units on all three generations
(Mesa ac_binary.c). asm.py already documents GFX12 (b94733a04).

tests/test_hw_oracle.py: the device-line-to-arch mapping with the new
fallbacks, and a launcher build test that compiles hw_oracle_drm.c
exactly as drm.py does, wherever gcc and the libdrm_amdgpu headers are
installed and without a GPU.

Verified on hardware: the author's RX 9070 (gfx1201, engine 12.0,
Linux/RADV) ran --oracle hw over the five min/max/med3 ops, 583 f32
programs: 451 match, 0 mismatch, 2 known deviation, 0 assembler
rejections; a curated 39-program run before it matched on all 14 judged.
No RDNA3 hardware was dispatched — the gfx11 stream mirrors libdrm's
hw-proven gfx11 test. CPU: tests/test_hw_oracle.py 59 OK (3 skips),
tests/test_f32_fuzz.py 29 OK (1 skip), tests/test_f32_fuzz_gfx12.py
7 OK, compileall clean.

AI-assisted (GLM-5.3).
2026-11-23 19:30:59 +01:00
4e42451d55 hw_oracle: select AMDGPU ELF emulation for HIP code objects (#6289)
Squash-merged after diff review of PR #6289 - Windows hardware oracle: select AMDGPU ELF when linking HIP code objects
2026-11-23 08:25:06 -06:00
d7f08f4dd2 Merge pull request #4549 from mohamedsaad.lahlou
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:15:49 -05:00
a90289cbb4 Merge pull request #4519 from Størm
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:15:30 -05:00
41aa4c8f1a Merge pull request #4422 from Størm
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:14:35 -05:00
c33196304f Merge pull request #4075 from 0xTehuti
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:11:02 -05:00
830cd6c71a Merge pull request #3978 from tedin7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:10:07 -05:00
a8a59bd647 Merge pull request #3972 from tedin7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:10:03 -05:00
bdf45c6030 Merge pull request #3954 from errusso
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:09:52 -05:00
7db1e35da1 Merge pull request #3949 from PeterGrieffindor
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:09:50 -05:00
e3a855ea81 TEST-982: handle LLVM true16 spelling in VALU kernels 2026-11-23 03:21:45 +01:00
dbe5070d18 lds_fuzz: run the hardware oracle on GFX12 (RDNA4); wave64 ds_bpermute reaches all 64 lanes there
On an RX 9070 XT (gfx1201) `lds_fuzz.py --oracle hw` stopped with "the assembler rejected
every program in a chunk: ... s_barrier", and programs with a ds_cmpst were skipped because
ds_cmpstore's operand order was only measured on gfx1150.

- asm.sync_lines: GFX12 has no s_barrier, so a barrier is `s_barrier_signal -1` then
  `s_barrier_wait -1`, and the LDS wait is `s_wait_dscnt 0` instead of the legacy
  `s_waitcnt lgkmcnt(0)` encoding. lds_fuzz's hardware kernels go through it.
- asm.ds_line swaps ds_cmpstore[_rtn]_b32's data operands on GFX12 as on GFX11. Measured on
  gfx1201: with 7 in the dword, data v1 = 9, v2 = 7 stores 9 and v1 = 7, v2 = 9 keeps 7, for
  the rtn and the non-returning form (gfx1036's ds_cmpst does the opposite).
- Measured on the way: a wave64 ds_bpermute_b32 reaches all 64 lanes on GFX12, where RDNA2
  and gfx1150 keep each 32-lane half separate (every lane asking for lane (l + 32) mod 64:
  gfx1201 returns lane l ^ 32, gfx1036 lane l). The model describes RDNA2, so on gfx12xx a
  wave64 program with a ds_bpermute is skipped with that reason; under
  --perturb bpermute_wave64_cross all of them match.

RX 9070 XT, AMD 26.11.2, --programs 1000, seeds 1 and 2: wave32 1000/1000; wave64 537 and 506
match, 0 mismatch, the rest skipped for the bpermute reason. --perturb bpermute_wave64_cross:
wave64 1000/1000. --perturb cmpst_swap: 275 of 1000 wave32 programs mismatch. gfx1036
unchanged: 1000/1000 in both wave sizes and both seeds.

AI-assisted (Claude Code).
2026-11-22 20:58:48 -05:00
fbdc638aed hw_oracle: name op_sel halves on the VGPRs of 16-bit integer VOP3 ops for GFX11+
AMD LLVM 23 (rocm-sdk-core 10.0.0) rejects `v_max_u16_e64 v14, s12, v5 op_sel:[1,0,0]`
on gfx1100, gfx1150 and gfx1201 ("operands are not valid for this GPU or mode") and takes
`v_max_u16_e64 v14.l, s12, v5.l op_sel:[1,0,0]`. So `pk16_diff --oracle hw` skipped every
op_sel form of v_lshlrev/lshrrev/ashrrev_b16/i16, v_min/max_u16/i16 and v_mul_lo_u16 there:
80 of 200 programs on an RX 9070 XT.

asm.opsel16_spelling() writes each VGPR operand of those lines as the half its op_sel bit
picks and keeps the op_sel list for SGPR and constant sources. The runner applies it on
every non-gfx10 architecture, apart from the true16 probe: this assembler takes a bare
`v_cvt_f16_f32 v8, v1` on GFX11/12, so that probe says no.

All 2,551 distinct op_sel lines pk16_diff generates for the eight ops now assemble for
gfx1100, gfx1150 and gfx1201, with the same op_sel bits and operands as gfx1036's bare form.
RX 9070 XT: pk16_diff --oracle hw 200 programs 120 pass / 80 skipped -> 200 pass, 0 skipped;
2000 programs 2000 pass, 0 mismatch. gfx1036 unchanged (200/200, 2000/2000).

AI-assisted (Claude Code).
2026-11-22 20:21:02 -05:00
a96cf503b1 hw_oracle: retry probe as code object v5 on hip error 303 as well as 209 2026-11-23 00:16:43 +01:00
fef61b247c tools: the RDNA2/3 hardware fuzzers and tests skip on gfx1170+ instead of failing (TEST-873) 2026-11-22 23:45:21 +01:00
bf7fc223fb hw_oracle: a launcher quarantined by Windows Defender (WinError 225) is Unavailable with an exclusion hint, plus a Known problems row (BUILD-1127) 2026-11-22 23:44:24 +01:00
f23b69060c hw_oracle (Linux): run the LDS fuzzers through libdrm
The libdrm launcher refused a kernel whose descriptor has a group segment
and capped its output at 4096 words, so lds_fuzz --oracle hw was exit 77
on Linux and no LDS program ran on RDNA2 outside Windows. Both are now
gone; docs/shader_validation.md records the gfx1036 counts.

- drm.py: program COMPUTE_PGM_RSRC2.LDS_SIZE (bits 15..23, 512-byte
  units) from the descriptor's group segment instead of refusing it. The
  assembler leaves that field 0 (measured: 4096 bytes of LDS give group
  4096 and rsrc2 0x84), so the launcher fills it as the HIP runtime does.
  Only scratch memory (private) and COMPUTE_PGM_RSRC3 stay unsupported.
- hw_oracle_drm.c: the output buffer takes 1..16384 words, matching the
  Windows launcher, so a 64x64 image_fuzz case (16384 words) fits.
- asm.py: a wrapped (non-raw) kernel's LDS goes into its descriptor too,
  so the Linux launcher has a group segment to read.
- lds_fuzz.py: the "more than 4096 words" wording no longer applies.

Tests: test_hw_oracle.py gains a descriptor unit test (group segment to
LDS_SIZE, 65536 ceiling) and two OnHardware tests (a kernel that writes,
barriers and reads back LDS; 8192 words from 1024 threads), plus a check
that LDS reaches the descriptor and metadata of a wrapped kernel. Verified
on the integrated Radeon of a Ryzen 7 7700X (gfx1036, RDNA2, Linux
7.3.5-zen1-1-zen, libdrm 2.4.134, AMD clang 23.1.5): lds_fuzz --oracle hw
--programs 500 --seed 1 matches 0 of 1000 (wave32+wave64) mismatches,
image_fuzz --oracle hw --programs 120 --seed 1 0 of 120.

AI-assisted (OpenCode).
2026-11-22 23:40:40 +01:00
8c799453fb hw_oracle: an amdclang launcher on PATH is followed to the clang it is installed as
The rocm-sdk wheels put `amdclang` in the Python environment's Scripts (bin)
folder. find_clang() takes it first, because it is on PATH and lists the amdgcn
target, but ld.lld and amdgpu-arch sit beside the real clang, in the folder the
launcher reports as InstalledDir. With the wheels in a Python outside the
checkout the oracle then stopped with "no ld.lld next to the AMD clang", also
when HIP_PATH named a complete toolchain, and LEONIDA_AMD_CLANG was the only
way around it.

find_clang() now returns the clang in InstalledDir when the one it found has no
ld.lld beside it. A clang that has its linker is used where it was found, and a
launcher that names a folder without a clang is kept, so every setup that
worked resolves to the same compiler as before.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
2026-11-23 00:37:22 +02:00
02700eb4a2 Merge pull request #3603 from ezbyDev 2026-11-22 17:02:57 -05:00
e3eba20b85 Merge pull request #3110 from eyyun 2026-11-22 17:00:38 -05:00
8599cfccd3 hw_oracle: start build_hw_oracle.cmd as .\ from the work folder
build_command() returned `cmd.exe /d /c <full path of build_hw_oracle.cmd>`
for the vcvars toolchain. cmd.exe loses a full path's quotes when it holds
& or ^ (and list2cmdline adds none when there is no space), so from a work
folder such as `a & b`, `a&b` or `x^y` the script never ran and the oracle
reported that hw_oracle.c did not build. The only caller already runs the
command with cwd=self.workdir, the folder the script is written to, so it
now starts `.\build_hw_oracle.cmd`, which NoDefaultCurrentDirectoryInExePath
does not block either.

tests/test_hw_oracle.py runs the returned command on a stub vcvars from
plain, `sp (x)`, `a & b`, `a&b`, `x^y` and Turkish-named work folders with
that variable set, and the tests that read the script open it from the work
folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:04:17 +01:00
9550413bfd f32_fuzz: mark v_madmk_f32 GFX10.1-only in hw_oracle VALU_REMOVED 2026-11-22 23:36:54 +03:00
8a62436cf5 Merge pull request #3113 from kapitche 2026-11-22 15:14:53 -05:00
98b2c829c2 Merge pull request #2961 from Vonsek 2026-11-22 15:13:36 -05:00
bf2908429c hw_oracle: respell ds_cmpst_b32 for GFX11 with the store operand first
ds_line already converts ds_cmpst_rtn_b32 to ds_cmpstore_rtn_b32 and swaps the two data
operands, but the non-returning ds_cmpst_b32 was left as-is, and GFX11 has no such mnemonic.
Measured on gfx1100 that ds_cmpstore_b32 takes the value to store before the compare value.
2026-11-22 14:06:51 -06:00
844b2cd24c hw_oracle: drop target features from the amdgpu-arch name
amdgpu-arch prints 'gfx1010:xnack-' on some GPUs; detect_arch handed that to
asm.family(), which rejects it, so the oracle was skipped unless
LEONIDA_HW_ARCH was set.
2026-11-22 14:26:15 -05:00
ac68c81023 hw_oracle: wrapped kernels take their wave size and register counts
kernel_text() wrote a fixed descriptor: 16 VGPRs, 32 SGPRs, wave32. On
gfx1036 v16 and up read back 0, and Kernel(wave=64) ran as wave32 (lane
40 of a full EXEC's lane ids read 8), so wave64 results of wrapped
kernels were wave32 runs.

The descriptor now follows the Kernel's wave, vgprs and sgprs, and every
descriptor is raised to the highest register its lines name. Callers and
defaults are unchanged. Tests in tests/test_hw_oracle.py, including one on
hardware for the wave size and v16 / v200.

AI-assisted.
2026-11-22 19:56:31 +01:00
1a859d9e24 Merge pull request #2667 from AAyberkU 2026-11-22 13:16:55 -05:00
58b0cf94b1 hw_oracle: the comment no longer cites build_runtime.ps1 as writing UTF-8
That script has the chcp 65001 line but writes its .cmd as ASCII, so it is not a precedent for the encoding
(review of #2667). Comment only.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ABh36DZ2sZNq3ChN6EZJs
2026-11-22 21:06:20 +03:00
978d1f0a9f hw_oracle: the vcvars build script survives paths outside ASCII
Without gcc or cl on PATH, the host launcher is built through a .cmd that calls vcvars64.bat. It was written as
ASCII, and it holds the checkout, %TEMP% and Visual Studio paths, so a character outside ASCII in any of them
(a Windows user name, the Turkish default folder name "Yeni klasör") raised UnicodeEncodeError: a traceback
instead of a build, and not the Unavailable that callers turn into exit code 77. The script is now UTF-8 with
`chcp 65001`, as scripts/build_runtime.ps1 writes its own, and the compiler's output is decoded leniently.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ABh36DZ2sZNq3ChN6EZJs
2026-11-22 20:44:25 +03:00
14f7cce13f SHADER-337: texel-offset y and z fields measured on RDNA2 (signed 6-bit, upper bits ignored)
tools/texoff_probe.py samples a linear R32_SFLOAT texture whose texel holds its index (2D 64x64 for y, 3D 64x1x64
for z) with image_sample_lz_o through tools/hw_oracle on gfx1036, wave32 and wave64. All 15 rows fit the
translator's rule. tests/test_texoff_probe.py checks that each row with a negative field tells signed from unsigned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:30:13 +01:00
ec9b6cf22b tools: text reports are written with LF line ends on every platform (BUILD-468)
open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly
listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/,
make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source
with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention.

AI-assisted (Claude), on behalf of dev-ewann.
2026-11-22 14:20:30 +00:00
e1ac59e7a0 Merge pull request #1620 from Luiz Neves 2026-11-22 08:08:13 -05:00
0d4f80ea58 Merge pull request #1617 from bobcatchris 2026-11-22 08:08:12 -05:00
53064a29fa hw_oracle: a MODE that gfx1170+ cannot set is reported, not assembled (FUZZ-43)
AMD clang rejects .amdhsa_ieee_mode and .amdhsa_dx10_clamp on gfx1170+
(GFX11.7 and GFX12, where the behaviour is fixed). A kernel asking for
either reached the assembler, and when a chunk held only such kernels the
run died with 'the assembler rejected every program in a chunk'.

asm.mode_skip_reason names the field and the architecture; Oracle.run
returns that reason for those kernels and never assembles them, so the
others still run and the MODE probes fail with a clear message. The
denormal and rounding fields are unaffected.

tests/test_hw_oracle.py covers the reason per architecture, a mixed run
and a run where every kernel is skipped. docs/shader_validation.md notes
it.
2026-11-22 09:41:01 -03:00
34cff2a47c hw_oracle: report unsupported float MODE fields on gfx1170+
AMD clang rejects .amdhsa_ieee_mode and .amdhsa_dx10_clamp on gfx1170 and later, but the oracle emitted both whenever a fuzz run asked for them. The assembler then rejected every kernel in a chunk and the caller only saw a generic rejection.

Raise ModeUnavailable before emitting those directives, and have Oracle.run turn it into Unavailable so the existing exit-77 path reports the requested fields as unavailable. The denormal and rounding fields are still emitted. Add text tests for gfx1170/gfx1200/gfx1201, a gfx1150 control and the runner's skip conversion.

The focused tests pass (33 tests, one hardware skip). No RDNA4 GPU was available to confirm the hardware side; this is the directive-level fix. No game files.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-22 06:40:00 -06:00
719565bbc7 image_fuzz: --oracle hw, the image_load fetches as native kernels with a per-family T#
Runs the same texel fetches as raw compute kernels on the AMD GPU through tools/hw_oracle/: a linear texture the
kernel carries in its own code (256-byte aligned, found with s_getpc_b64), a T# built in s[8:15] for the GPU's family
(hw_oracle/tsharp.py: GFX11 on gfx11xx, GFX10 on gfx103x/gfx10xx), image_load with every dmask for one texel per lane,
all four result registers stored and compared word for word with the CPU model. --oracle translator,hw runs both on
the same textures; --negative-control checks seven wrong models and a wrong T# FORMAT are caught. Exit 77 without the
tools. gfx1150 is RDNA3.5, not RDNA2: the docs say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:16:24 +01:00