hw_oracle/asm: fix GFX12 scalar load, per-kernel wave metadata, and validation #2326
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2326"
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?
Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-26T13:48:22Z.
Claimed in the coordination issue as: HW-ORACLE-ASM-GFX12-RAW-LOAD-AND-KERNEL-WAVE-METADATA (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193821284)
What and why
raw_kernel_text()intools/hw_oracle/asm.pyto emits_load_b64on GFX12 (as on GFX11) rather than GFX10'ss_load_dwordx2, and reuseis_gfx1170_or_later(arch).metadata()andmodule_text()intools/hw_oracle/asm.pyso mixed-wave batches emit per-kernel.wavefront_sizematching each kernel's.amdhsa_wavefront_size32instead of repeating the batch default wave size.wave(32or64),threads(>= 1),words(>= 1), and rejectboolvalues for integerKernelarguments inKernel.__init__().tests/test_hw_oracle_asm_gfx12.py.Tested
python -I tests/test_hw_oracle_asm_gfx12.py -v: 3 passed, 0 failed (detachedupstream/mainbaseline with only the new test file fails with 9 subtest/test failures).python -I tests/test_hw_oracle.py -v: 59 tests (OK, 3 skipped without AMD clang / libdrm gcc on host).python -I tests/test_hw_oracle_asm_strip.py -v: 1 passed, 0 failed.python -I tests/test_ci_registration.py: 16 passed.python -I tests/test_text_write_line_endings.py: 3 passed.python -I scripts/check_no_game_data.py,python -I -m compileall -q tools/hw_oracle/asm.py tests/test_hw_oracle_asm_gfx12.py, andgit diff --cached --check: passed.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-11-26T21:43:39Z.
Locally verified
556f625a9againstmainatfac8b4bb9on macOS 27.3 arm64 (Python 3.14.3, LLVM 21.1.8). Claim confirmed in #1608; patch applies cleanly; no conflicting overlap with #1332.tests/test_hw_oracle_asm_gfx12.py: 3 tests / 9 failures (incl. subtests) on plainmain; 3/3 passed with the patch.tests/test_hw_oracle*.py: 68 passed, 4 skipped viaunittest; 70 passed, 11 skipped, 18 subtests viapytest.gfx1200andgfx1201.check_no_game_data.py,compileall,test_text_write_line_endings.py(3/3), andtest_ci_registration.py(16/16) all passed.Non-blocking test note:
tests/test_hw_oracle_asm_gfx12.py:29checks that both metadata values appear in the output, so swapping them betweenk0andk1would still pass (the implementation itself emits them in kernel order).Synthetic inputs only; no game data. GPUs tested: none (CPU/assembler verification only). AI-assisted verification.
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-27T04:41:38Z.
Review: APPROVED
Approving
556f625a9.The GFX12 fix is real:
raw_kernel_textpickeds_load_dwordx2for every family but gfx11, so gfx12 kernels got the GFX10 mnemonic; now only gfx10 uses it. Per-kernel wavefront sizes go into the metadata instead of one module-wide value, andKernelvalidates its fields.Merged onto
maind1dff7949in one batch with 15 other tool PRs of this series (no conflicts), on Linux with Python 3.13.tests/test_hw_oracle_asm_gfx12.py: 3 passed, 12 subtests (new). AI-assisted (Claude Code, Claude Opus 5.5).Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T10:03:44Z.
#2326 | head
556f625a94(merged cleanly with main33db04a70) |python -I tests/test_hw_oracle_asm_gfx12.py| red on main:FAILED (failures=9)(s_load_dwordx2emitted ongfx1200/gfx1201instead ofs_load_b64, per-kernel.wavefront_size: 64missing, and boolean/zeroKernelcounts accepted) | green on PR+main:3 tests OK(-k test_raw_kernel_uses_s_load_b64_on_gfx11_and_gfx12:1 test OK) | Windows 11, Python 3.12.10 | AI-assisted: yesAudited
Kernel.__init__,raw_kernel_text,metadata, andmodule_textintools/hw_oracle/asm.py, and verified bothPR + main(33db04a70) and a combinedmain + #2328 + #2326merge (0conflicts;3 OK+3 OK). Also passedtests/test_ci_registration.py(18 OK),tests/test_text_write_line_endings.py(3 OK),tests/test_runner_calls_all_tests.py(3 OK), andscripts/check_no_game_data.py.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T10:58:42Z.
Merged, thank you @kirigayakazima! This PR (hw_oracle/asm: fix GFX12 scalar load, per-kernel wave metadata, and validation) was checked by zmasi or sodove and then by our own local run of its tests with main merged in, and it passed cleanly, so it went in with its reviewed batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.