Repository navigation
feat(tools): add a hardware oracle for RDNA instruction semantics - #871
Merged
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
Author
|
boykopovar agreed on #843 (Discord): merging. Based on current main, CI green. |
9 tasks done
9 tasks done
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
The hardware oracle proposed in #843:
tools/hw-oracle/runs a body of RDNA assembly on a local AMD GPU, one input row per lane, and prints the 16 output dwords of each lane. It is meant for measuring instruction semantics before implementing them and for pinning measured rows intests/execution/. Usage, kernel ABI and limits are indocs/dev/HW_ORACLE.md.oracle.cloads a code object through the ROCm HSA runtime and dispatches it on/dev/kfd.oracle --targetprints the GPU's gfx name.template.sis the kernel wrapper:v4-v7hold the inputs andv10-v25are stored. It works in wave32 and wave64, gives 4 KiB of LDS, and takes the FLOAT_MODE (IEEE, f32/f16 denormals) per run.hw_oracle.pybuilds the oracle once, assembles the body for the detected target withclang+ld.lld, and runs it. It works from the command line or asrun(body, rows, ...)from Python.It isn't tied to a distribution. The runtime comes from
ROCM_PATH,/opt/rocmor the system paths (libhsa-runtime-dev,rocm-runtime-devel,hsa-rocr), and the target is read from the GPU. Nothing is registered in CMake or CI: CI has no AMD GPU.Draft until @boykopovar decides on #843. If he'd rather not have the tool in the repository, I'll close this.
Tested
Linux (CachyOS), Radeon 660M (RDNA2, gfx1035), HSA runtime from the Arch packages under
ROCM_PATH. Checked wave32 and wave64, IEEE=0 (the f16 example in the doc keeps the NaN payload),coarse(LDS and float atomics kernel),extra(SGPR load past the rows), and 2500 rows split over 3 dispatches. Five of the kernels I measured with for the shader PRs (division, f16, relative moves, LDS atomics) give bit-identical results with this version and with the one I have used since 2026-10-03 (#264, #318, #320), on 1160 rows each (64 for the LDS one, which only addresses 64 lanes). Not tested on RDNA3 or on other distributions.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)