tests: make the GPU test suite build under HIP on gfx1151 - #1511
huppiflupp wants to merge 1 commit into
Conversation
5fdc39c to
c5fad08
Compare
Rebased on dev with JustVugg#1505 merged; make hip-test now completes green on real gfx1151 hardware (Ryzen AI MAX+ 395 / Radeon 8060S, ROCm 7.1, rocwmma-devel installed). Six blockers, each hit in order: 1. Six test/bench files include <cuda_runtime.h> before any compat mapping is in scope. __HIP_PLATFORM_AMD__ is not defined yet there; __HIPCC__ is. 2. cudaMallocManaged had no mapping in backend_gpu_compat.h (hipMallocManaged exists). Needed by test_router_cuda and test_grouped_g4_cuda. 3. test_mxfp4_cuda.cu and test_alloc_footprint_cuda.cu link against a separately compiled backend_cuda.cu and include only the public ABI header, so those TUs never see the mapping at all; they need backend_gpu_compat.h themselves under HIP. 4. test_mxfp4_cuda.cu's bare isinf() is ambiguous against HIP's __DEVICE__ isinf(float)/isinf(double); qualified as std::isinf. 5. mxfp4_ref.o is compiled without -fPIC while GPUFLAGS builds with -fPIE -> R_X86_64_32S relocation errors at link. 6. GPUFLAGS carries -x hip, which also applies to tests/mxfp4_ref.o on the link line, so hipcc tries to compile the object as source. -x none before it. Result on gfx1151, make hip-test, exit 0: backend_cuda_test, ragged_attention_test, cuda_fmt_trap_test: ok, fp8_warp_test: OK, absorb_determinism_test, fp8_cuda_test: OK, weights_owned_test, mxfp4_cuda_test: ok, alloc_footprint_test: ok Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
c5fad08 to
97cd762
Compare
Updated: rebased on
|
|
Hey! Slightly off-topic, but I came across your Strix Halo work through this PR and ended up looking through your I've also been working on gfx1151 in Colibri, including the native Windows HIP support, and I'm currently digging into more model-independent HIP/XDNA2/heterogeneous execution work. Seems like we're exploring a lot of the same hardware from different angles. If you're interested, I'd love to compare notes and maybe cross-test/tweak some Strix Halo stuff together sometime. π |
|
Thanks for reaching out β glad the Strix Halo work was useful. Happy to compare notes. Let me lead with the measurement that seems most relevant to your #1261, since it is the one datapoint I have that bears directly on whether an XDNA2 lane pays. NPU vs iGPU on this box, 2026-08-16, Gemma4 (~4B active), identical prompts:
About 4.5x in the iGPU's favour for raw decode throughput. Two honest caveats: this was Gemma4, not GLM, and via Lemonade Server rather than Colibri β so it does not transfer directly to your shared-expert lane. And I did not measure power, which is presumably where the NPU actually wins. If your lane's case is efficiency rather than throughput, this number says nothing against it. Where I think we are complementary: your #788 and #1261 are the Windows side, and I run this box on Linux β XRT 2.26.0 and the I have just put that up publicly so the numbers above are checkable rather than merely asserted: https://github.com/huppiflupp/strix-halo-npu-linux β the flavour patch, the memlock/limits config, a setup script, and the benchmark harness the NPU/iGPU figures came from. The README also records the negative result about One thing you may already know, but it cost me a while to establish: AMD's What I can offer concretely: this machine (Ryzen AI MAX+ 395, 128 GB, gfx1151, NPU working under Linux) and a willingness to run controlled A/Bs on it. Tonight's numbers in #1502 and #1513 came off it. If you want the Gemma4 NPU comparison repeated inside Colibri rather than Lemonade, or your #1261 approach sanity-checked against the Linux XRT path, say the word. |
Follow-up to the verification I ran on #1505. That PR gets
make hip-testlinking; these four items get it compiling. Each was hit and fixed on real gfx1151 hardware β Ryzen AI MAX+ 395 / Radeon 8060S, ROCm 7.1 / HIP 7.1.52802,rocwmma-develinstalled, Nobara 44.The four blockers
1.
#include <cuda_runtime.h>before any compat mapping is in scope β six files:__HIP_PLATFORM_AMD__is not defined yet at that point;__HIPCC__is. Guarded on the latter.2.
cudaMallocManagedhas no mapping inbackend_gpu_compat.h.test_router_cudaandtest_grouped_g4_cudause it and both includebackend_cuda.cu, so the header is in scope β the define was simply missing.hipMallocManagedexists in ROCm.3.
test_mxfp4_cuda.cuis a different case and the include guard alone is not enough for it. It links against a separately compiledbackend_cuda.cuand includes only the public ABI headerbackend_cuda.h, which correctly does not pull the compat mapping β so that TU never sees it. It needsbackend_gpu_compat.hitself under HIP. Its bareisinf()calls are additionally ambiguous against HIP's__DEVICE__ isinf(float)/isinf(double); qualified asstd::isinf.4.
mxfp4_ref.ois built without-fPICwhileGPUFLAGSbuilds with-fPIE. Under HIP the link then fails withR_X86_64_32S relocation cannot be used against local symbol. Added-fPICto that one rule; harmless under CUDA.Verified per test on gfx1151
test_fp8_cudaOKβ 0 mismatches on oracle and APItest_router_cudatest_grouped_g4_cudatest_mxfp4_cudatest_mxfp4_cuda: okβ all five exponent cases, worst rel 8.63e-07Worth noting for item 4: the Makefile comment calls MXFP4 "expected to fail" on some hosts. On gfx1151 it passes cleanly once it builds, so that expectation may be worth revisiting.
I did not touch the test link lines β #1505 owns those. Applied on top of each other, the suite gets through every test I could exercise here; I verified these four individually with manual link lines rather than claim a green
make hip-testrun that needs both PRs.The machine stays available if you want anything re-run. Same box as #1502.
π€ Generated with Claude Code
https://claude.ai/code/session_019WbKLB3C3vuXSZWDw5w83j