Skip to content

hw_oracle: work with 2024 HIP runtimes (code object v5) and LLVM 23's true16 - #1373

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
StebanSchrader:fix/hw-oracle-old-hip-true16
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
StebanSchrader:fix/hw-oracle-old-hip-true16

Conversation

@StebanSchrader

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #1218 (comment)

What and why

tools/hw_oracle didn't work on a Windows PC with a 2024 AMD driver and LLVM 23:

  • Error 209. LLVM 23 writes code object v6, which amdhip64_6.dll refuses at hipModuleLoadData, so the oracle reported itself unavailable. On a 209 the probe now retries as v5 (-mcode-object-version=5) and keeps that version for the run. A 209 that stays, or any other error, is still reported.
  • true16. LLVM 23 wants v8.l for 16-bit operands on GFX11, so f32_fuzz --oracle hw exited 2 with 81-87 rejected programs per seed. The oracle now asks the assembler once and uses that spelling only if it's needed. This covers the two f16/f32 conversions from the claim, plus the seven ops of f16_trans_sweep.py, which failed the same way once the oracle could start.

Runtimes that take v6 and assemblers that take a bare v8 get the same command and text as before. The Linux launcher is unchanged.

Tested

Radeon 780M (gfx1103), driver 32.0.11020.1002 (amdhip64_6.dll), Windows 11 26200, clang and lld 23.1.6 from conda-forge, MSVC 19.44. On conda-forge's ld.lld I used a local stub for libxml2.dll, which that linker only calls for COFF manifests; the stub aborts if called, and it never was.

run match mismatch other
salu_diff --oracle hw, 5000 programs, seeds 1-3 (seed 2 with --bfe-any --inline64) 13,619 0 1,381 skipped (GFX11)
f32_fuzz --oracle hw, seeds 1-3 3,835 0 4 known deviations, 0 rejected, the rest skipped or not judged
crosslane_fuzz --oracle hw, 2000 programs, seeds 1-2, both wave sizes 4,000 0 1,064 permlane hypotheses confirmed
  • tests/test_hw_oracle.py: 34 tests OK on the GPU (1 Linux-only skip). Without the AMD tools: 28 OK. The new tests against main's code: 2 failures and 7 errors.
  • tests/test_f32_fuzz.py (25) and tests/test_crosslane_fuzz.py (29): OK.
  • f32_fuzz --negative-control: 6 of 6 wrong models caught on each seed.

Still failing on this driver, and not changed here: f16_trans_sweep.py stops with HIP error 719, because it launches 1024 threads while the metadata says max_flat_workgroup_size: 256. #1345 already changes that line to 1024. With that one value patched in memory, the sweep runs (all 7 ops within 1 ulp of its reference) and its 11 tests pass. This branch merges cleanly with #1345.

Not tested: AMD's own clang, a driver that takes v6, RDNA2.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No translator change; the oracle's setup notes in docs/shader_validation.md are updated.)

AI-assisted (Claude Code).

🤖 Generated with Claude Code

LLVM 23 writes code object v6, which amdhip64_6.dll refuses with error
209: retry the probe as v5 and keep that version for the run.

LLVM 23 also wants v8.l for 16-bit operands on GFX11: ask the assembler
once, and use that spelling for the f16 ops the oracle's tools run.

Tested on a Radeon 780M (gfx1103), driver 32.0.11020.1002.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bobcatchris

Copy link
Copy Markdown
Contributor

Independent CPU/static verification only (no GPU or AMD hardware claim), against main f85582e2 at PR head 244f1510 (main is an ancestor):

  • tests/test_hw_oracle.py: 28 passed, 6 skipped with pytest; compileall -q tools tests clean.
  • Negative control: the PR test file copied onto untouched main with main's hw_oracle gives 9 failed, 19 passed, 6 skipped. The failures are exactly the new contracts: asm.true16_spelling is absent, Oracle.code_object / _needs_true16() are absent, and the assembler command lacks -mcode-object-version=5. So the new tests pin the v5 probe and true16 fallback.
  • Sandbox limitation: a tool-discovery path invoked the blacklisted reg.exe; the suite still passed through its Unavailable branch. I did not retry or bypass it.
  • Not verified here: a real 2024 HIP runtime, LLVM 23 true16 assembly, or any hardware oracle numbers; those paths remain skipped on this machine.

The CPU side looks consistent with the stated fallback ordering.

@freemanovec

Copy link
Copy Markdown
Contributor

Tested 244f1510 on Arch Linux, Python 3.14.10, llvm-mc 23.1.5 (CPU only, no AMD DRM render node): pass. AI-only run.

  • python3 -m compileall -q tools/hw_oracle tests/test_hw_oracle.py: clean.
  • python3 -I tests/test_hw_oracle.py -v: 28 tests, 27 OK (including all ToolchainFallbacks and True16 tests), 1 skipped (OnHardware).

No game files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants