Repository navigation
feat(hw-oracle): assemble and run the template on gfx12 - #25979
Conversation
The gfx12 kernel descriptor has no IEEE mode or DX10 clamp field and the template's s_waitcnt waits are not the gfx12 counter waits, so the stock template failed to assemble on RDNA4. The template now takes the waits and both mode directives from the assembly target, ieee and dx10_clamp are None on gfx12 and required integers elsewhere, and compare_results.py accepts null for those two modes.
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the optional point below is to extend the probe catalog in a follow-up if gfx12 catalog runs are needed.
What I ran
Reviewed head 2640fbc65a8037534427fc5311736312eeb4d466 from the prepared diff and read the changed files listed below. No commands or tests were run; repo_read.py was unavailable as a command in this review interface.
Results
| Check | Result | Note |
|---|---|---|
| Change and targeted call paths | passed | Reviewed all six changed files |
| Automated tests | not run | Author-reported results were not independently verified |
| Runtime behavior | not run | No GPU or assembler run |
Findings
Blocking
None.
Non-blocking
- The PR documents that
probe_catalog.pydoes not run on gfx12 because its stored modes are integers. Supporting gfx12 catalog runs could be considered separately; this limitation is explicitly called out indocs/dev/HW_ORACLE.md.
Not verified
- Automated test results, assembler output and GPU behavior were not independently verified.
- All six changed files listed as reviewed in
manifest.jsonwere read. No changed files were excluded byfiles.json; that file was not present in the review bundle.
To get this to a good state
Nothing is required. The probe catalog limitation is optional follow-up work.
mihiii1337
left a comment
There was a problem hiding this comment.
I ran the exact head on Windows with Python 3.15.2: test_hw_oracle.py passed 84 tests with 6 skips (no AMD comgr/clang here), test_compare_results.py passed 19, test_probe_catalog.py passed 40, and tools/check_conventions.py --base origin/main passed. I did not run a native AMD kernel. The GFX12 template split and older-target rendering look consistent, but there is one report-validation issue below.
AI-assisted: yes.
| modes = report["floating_point_modes"] | ||
| if not isinstance(modes, dict) or modes.keys() != MODES.keys() or any( | ||
| not integer(modes[name], 0, limit - 1) for name, limit in MODES.items()): | ||
| not integer(modes[name], 0, limit - 1) and not (name in GFX12_REMOVED_MODES and modes[name] is None) |
There was a problem hiding this comment.
[P2] Tie nullable modes to the GFX12 assembly target
This currently accepts null for ieee and dx10_clamp in every report, not only GFX12 reports. I reproduced it by changing both modes to null in two otherwise valid gfx1030 fixtures: the CLI exits 0 and prints 0 differing words, although hw_oracle.py correctly refuses to generate that combination. Since this function is the report validator and the documented invariant is None only on gfx12* (integers on older targets), please cross-check assembly_target against the two mode values and add both invalid-direction cases. Otherwise a hand-edited or externally produced impossible older-target report is accepted as oracle evidence.
There was a problem hiding this comment.
Fixed in 2bc007a. read_report now checks the two modes against assembly_target after the existing type checks. On gfx12* both must be null (ieee must be null on gfx1201, whose kernel descriptor has no ieee field). On every other target both must be integers (ieee must be an integer from 0 to 1 on gfx1030). Both errors match what hw_oracle.assemble raises.
New test_removed_kernel_modes_are_null_only_on_gfx12 covers both directions:
nullfor each mode on gfx1030, gfx1100 and gfx1151;0and1for each mode, with the other modenull, on gfx1200, gfx1201 and gfx12-generic.
test_removed_kernel_modes_differ_from_explicit_modes now compares a valid gfx1201 report (both modes null) with the gfx1030 fixture. The old version left one integer mode on gfx1201, which is now rejected as invalid input.
HW_ORACLE.md describes the check.
Results:
test_compare_results.py: 20 OK. With only thecompare_results.pychange reverted, 18 subtests fail.test_hw_oracle.py: 84 OK, 5 skipped.test_probe_catalog.py: 40 OK.check_conventions.py --base origin/main: passed.
AI-assisted: yes
mihiii1337
left a comment
There was a problem hiding this comment.
Re-reviewed exact head 2bc007a9e04641ca7fab5c1ae420241e6c5bc339. The follow-up ties both nullable modes to gfx12* targets in the report validator and covers invalid values in both directions. My original gfx1030 reproducer now exits 2 with ieee must be an integer from 0 to 1 on gfx1030.
On Windows with Python 3.15.2, test_hw_oracle.py passed 84 tests with 6 expected skips on this non-AMD machine, test_compare_results.py passed 20, test_probe_catalog.py passed 40, and tools/check_conventions.py --base origin/main passed. Hosted checks on this head are green. I did not run a native AMD kernel; the author's R9700 run covers that separately.
AI-assisted: yes.
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The inspected implementation is internally consistent; I did not run the reported checks, so a formal approval is not justified.
What I ran
Read the prepared diff and all six changed files at head 2bc007a9e04641ca7fab5c1ae420241e6c5bc339 using repo_read.py. No commands or tests were run. The manifest lists six files under reviewed; all six were read. No files were excluded.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | Six changed files read |
| Tests and runtime checks | not run | Results in the description are author reported |
Negative control
Not run; no tests were run during this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
The test suites, comgr assembly, and native GPU runs described by the author were not run or independently confirmed.
To get this to a good state
Nothing is required.
What
The stock
tools/hw-oracletemplate does not assemble for RDNA4. The gfx12 kernel descriptor has no IEEE mode or DX10 clamp field, so comgr rejects.amdhsa_ieee_modeand.amdhsa_dx10_clamp(directive unsupported on gfx12+). The template'ss_waitcnt lgkmcnt(0)/s_waitcnt vmcnt(0)still assemble for gfx12, but as SOPP opcode 9 (bf89fc07), not as the gfx12 counter waits (s_wait_kmcnt 0=bfc70000,s_wait_loadcnt 0=bfc00000).template.stakes the two waits and the two mode directives from placeholders.hw_oracle.assemblefills them for the assembly target: the gfx12 counter waits and no IEEE/DX10 clamp directives ongfx12*, and the same lines as before everywhere else.ieeeanddx10_clampareNoneon gfx12 (--ieee none --dx10-clamp none) and stay required 0/1 integers on older targets. A mismatch is aValueError(a usage error in the CLI) before anything is assembled. The other modes are unchanged, and every mode is still required.--jsonreports recordnullfor the two modes.compare_results.pyacceptsnullfor those two modes only and only ingfx12*reports, requires integers for them on every other target, and treatsnulland an integer as different settings.HW_ORACLE.mdgets an "RDNA4 (gfx12) differences" section. It notes thatprobe_catalog.pystill passes integers for both modes, so the catalog does not run on gfx12; that is left for a follow-up.This follows up the gfx1201 measurement in #25964 (#25964 (comment)), which needed a patched copy of the template.
Tested
Windows 11 Pro build 26300, AMD Radeon AI PRO R9700 (gfx1201), AMD driver 32.0.31044.16,
amdhip64_7.dll,amd_comgr_3.dll, Python 3.15.python3 tools/hw-oracle/test_hw_oracle.py: 84 tests OK, 5 skipped (Linux HSA runner, POSIX compiler fixtures, noclang). The comgr test now also assembles the gfx1201 template in wave32 and wave64. New tests cover template rendering on gfx1013/gfx1036/gfx1100/gfx1151 and gfx1200/gfx1201/gfx12-generic, the target and mode mismatch errors,Nonerejected for the other modes, and the CLI'snoneforwarding, JSON output and invalid values.python3 tools/hw-oracle/test_compare_results.py: 20 tests OK, including gfx12 reports withnullmodes,nullagainst an integer,nullin other modes,nullon gfx1030/gfx1100/gfx1151 and integers on gfx1200/gfx1201/gfx12-generic.python3 tools/hw-oracle/test_probe_catalog.py: OK.v_add_nc_u32,v_lshl_add_u32andv_max_num_f32rows in wave32 and wave64, fine and coarse memory, with the expected results. For example,0xffffffff << 1 + 0x7fc00000gives7fbffffe, andv_max_num_f32(qNaN, 1.0)gives3f800000. Integer--ieeeon gfx1201 fails withieee must be None on gfx1201, .... Two--jsonruns compare as0 differing wordswithcompare_results.py.mainand this branch produce byte-identical code objects for gfx1013, gfx1030, gfx1100 and gfx1151 in wave32 and wave64, with non-default modes (ieee=1 dx10_clamp=0 denorm32=2 round32=1 round16=2 fp16_overflow=1). No RDNA2 or RDNA3 GPU was available here to run them, so those targets are checked by assembly only.python3 tools/check_conventions.py --base origin/mainandpython3 tools/pr_overlap.py --branch feat/hw-oracle-gfx12(no overlap) passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)