feat(tools): add a hardware oracle for RDNA instruction semantics #871
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/871"
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 boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-06T11:54:43Z.
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)Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-06T20:11:22Z.
boykopovar agreed on #843 (Discord): merging. Based on current main, CI green.