Repository navigation
feat(hw-oracle): run on Windows through the AMD driver's HIP runtime and comgr - #9209
Merged
Merged
Conversation
…and comgr tools/hw-oracle needed Linux with ROCm, so Windows measurements went through private runners. oracle_hip.py assembles and links template.s kernels with the driver's amd_comgr and dispatches them with its HIP runtime, with the same rows, padding, dispatch splitting and report as oracle.c. hw_oracle.py selects it with HW_ORACLE_RUNTIME, by default on Windows, and loads it in-process so the DLLs are loaded once per run. The driver's comgr 2.9 numbers its assemble and link actions 0x8 and 0x7, not 0xA and 0x9, so each step tries both and keeps the one that returns exactly one output of the expected kind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
tools/hw-oracleruns only on Linux with ROCm. Many measurements in issues and PRs come from AMD GPUs on Windows anyway (#8299, #8282, #5492, #1281 and #5782 among them), each through a private runner that assembles with the driver'samd_comgrand launches with its HIP runtime. This PR makes that path part of the tool, so a Windows measurement runs the sametemplate.s, validation, padding, dispatch splitting and JSON report as a Linux one.oracle_hip.py, the Windows counterpart oforacle.c. It reads the target from the HIP device, assembles and links throughamd_comgr_*.dll, and dispatches throughamdhip64_*.dll, so noclang,ld.lldor C compiler is needed. Wave64 bodies are assembled with-mwavefrontsize64, asclangis called on Linux.hw_oracle.pyloads it in-process, so the driver DLLs are loaded once per run, not once per dispatch. Run in a separate process for each dispatch, the run below took 9 min 48 s instead of 1 min 4 s. It also works on its own, with theoraclecommand line (--target, andCODE THREADS IN OUT OUT_DWORDSwithCOARSE) plus--assemble SOURCE OUTPUT TARGET [--wave64].hw_oracle.pypicks the runtime withHW_ORACLE_RUNTIME, which defaults tohipon Windows andhsaelsewhere. The Linux path is unchanged.ROCR_VISIBLE_DEVICESselects the HIP device throughHIP_VISIBLE_DEVICES, unless that variable is set.HW_ORACLE_HIPandHW_ORACLE_COMGRname other DLLs.HW_ORACLE.md: a Windows requirements section.Tested
Windows 11, AMD Radeon RX 5700 XT (gfx1010), AMD driver 26.8.1 (comgr 2.9,
amdhip64_6.dll), Python 3.12.test_hw_oracle.py: 44 tests, all passing, 3 skipped. The skipped ones are the existing Linux andclangfixtures. Onmainthe same machine gives 36 tests, all passing, 3 skipped. The existing tests pinHW_ORACLE_RUNTIME=hsa, because on Windows they would otherwise select the new default. The new tests cover:runmakes into the HIP runtime, in wave32 and wave64, fine and coarse;HW_ORACLE.mdgives00004000/00007e01. A wave64 body usings_and_saveexec_b64andv_mbcnt_hi_u32_b32runs.--coarseand--jsonwork.oob_select_stride0.pyfrom AGC: zero-stride vertex fetches with OOB_SELECT 0, 1 and 3 do not follow RDNA 2's range checks #8299, throughhw_oracle.run. It does 480 dispatches of 64 lanes, with buffer descriptors built fromextra, and took 1 min 4 s. All 84480 dwords are identical to the results of the private runner posted in AGC: zero-stride vertex fetches with OOB_SELECT 0, 1 and 3 do not follow RDNA 2's range checks #8299, which matched gfx1031.in.bin, and the existing tests cover it.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)🤖 Generated with Claude Code