[PR #2326] hw_oracle/asm: fix GFX12 scalar load, per-kernel wave metadata, and validation #2330

Open
opened 2026-11-26 21:20:51 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2326
Author: @kirigayakazima
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: fix/hw-oracle-asm-gfx12-wave


📝 Commits (1)

  • 556f625 hw_oracle/asm: fix GFX12 scalar load, per-kernel wave metadata, and validation

📊 Changes

2 files changed (+77 additions, -5 deletions)

View changed files

➕ tests/test_hw_oracle_asm_gfx12.py (+59 -0)
📝 tools/hw_oracle/asm.py (+18 -5)

📄 Description

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

  • Fix raw_kernel_text() in tools/hw_oracle/asm.py to emit s_load_b64 on GFX12 (as on GFX11) rather than GFX10's s_load_dwordx2, and reuse is_gfx1170_or_later(arch).
  • Update metadata() and module_text() in tools/hw_oracle/asm.py so mixed-wave batches emit per-kernel .wavefront_size matching each kernel's .amdhsa_wavefront_size32 instead of repeating the batch default wave size.
  • Validate wave (32 or 64), threads (>= 1), words (>= 1), and reject bool values for integer Kernel arguments in Kernel.__init__().
  • Add standard-library unit tests in tests/test_hw_oracle_asm_gfx12.py.

Tested

  • python -I tests/test_hw_oracle_asm_gfx12.py -v: 3 passed, 0 failed (detached upstream/main baseline 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, and git diff --cached --check: passed.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • 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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2326 **Author:** [@kirigayakazima](https://github.com/kirigayakazima) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/hw-oracle-asm-gfx12-wave` --- ### 📝 Commits (1) - [`556f625`](https://github.com/ubiquitarianism/leonida/commit/556f625a9422c36015cfde385df97ea33bbde623) hw_oracle/asm: fix GFX12 scalar load, per-kernel wave metadata, and validation ### 📊 Changes **2 files changed** (+77 additions, -5 deletions) <details> <summary>View changed files</summary> ➕ `tests/test_hw_oracle_asm_gfx12.py` (+59 -0) 📝 `tools/hw_oracle/asm.py` (+18 -5) </details> ### 📄 Description 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 - Fix `raw_kernel_text()` in `tools/hw_oracle/asm.py` to emit `s_load_b64` on GFX12 (as on GFX11) rather than GFX10's `s_load_dwordx2`, and reuse `is_gfx1170_or_later(arch)`. - Update `metadata()` and `module_text()` in `tools/hw_oracle/asm.py` so mixed-wave batches emit per-kernel `.wavefront_size` matching each kernel's `.amdhsa_wavefront_size32` instead of repeating the batch default wave size. - Validate `wave` (`32` or `64`), `threads` (`>= 1`), `words` (`>= 1`), and reject `bool` values for integer `Kernel` arguments in `Kernel.__init__()`. - Add standard-library unit tests in `tests/test_hw_oracle_asm_gfx12.py`. ### Tested - `python -I tests/test_hw_oracle_asm_gfx12.py -v`: 3 passed, 0 failed (detached `upstream/main` baseline 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`, and `git diff --cached --check`: passed. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2330
No description provided.