mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #245] [MERGED] HIP: experimental gfx908 (Instinct MI100, wave64) support #422
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#422
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/245
Author: @nsaxploit
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @mw00
Base:
main← Head:hip-gfx908-wave64📝 Commits (1)
54b7bf3HIP: experimental gfx908 (wave64) support via the hip_compat half-wavefront layer📊 Changes
7 files changed (+94 additions, -11 deletions)
View changed files
📝
cmake/hip_backend.cmake(+17 -2)📝
include/strata/hip_compat/cuda_runtime.h(+25 -1)📝
include/strata/hip_compat/intrinsics.hpp(+32 -1)📝
maya.py(+3 -1)📝
src/core/device.cu(+7 -2)📝
tests/hip/glm_prefill_attention.cpp(+6 -2)📝
tests/hip/intrinsics.cpp(+4 -2)📄 Description
Experimental gfx908 (AMD Instinct MI100, CDNA1, wave64) support for the HIP backend, plus the small >2-GPU
maya.pychange requested in #229 — against v1.1.15.What
Every kernel stays written for a 32-lane warp: on gfx908 a CUDA warp becomes the logical 32-lane half of the 64-lane wavefront (the approach inherited from Strata's experimental gfx906/908 layer), so arithmetic, lane mapping and reduction order match wave32. Nothing in the kernel sources changes — the mapping lives entirely in the force-included
hip_compatlayer, with the gfx908v_dot4_i32_i8branch for__dp4a.Per request 1: wave32 builds compile exactly as today
All wave64 behaviour sits behind one new define,
STRATA_HIP_WAVE64, whichcmake/hip_backend.cmakesets only when a wave64 arch (currentlygfx908) appears inCMAKE_HIP_ARCHITECTURES, and which reaches every CXX+HIP TU through the same INTERFACE definition channel asSTRATA_HIP_ARCHS:HIP_DISABLE_WARP_SYNC_BUILTINS(beforehip_runtime.h)hipHostMallocCoherentonhipHostMallocMapped) — the wave64-onlycudaHostAllocoverloads; the#elserestores the previous#define cudaHostAlloc hipHostMalloc__syncwarpfences (wave32#else= the previousHIP_VERSION_MAJOR < 7+ workgroup-scope code verbatim)__ballot(p) >> (__lane_id() & 32), shift is 0 on wave32 — wave32 keeps the plain cast)__nanosleepscaling (wave32 keepss_sleep(1))So the mapped-host and fence paths that the Strix Halo / RDNA / APU cards lean on are untouched on wave32 — for your Radeon 8065S check, a wave32 build preprocesses to the same code as
main. gfx906 / MI50: it fits the same layer (wave64,v_dot4_i32_i8exists on CDNA1's gfx906 sibling too) but is not in the arch list yet — if the owner in #193 wants it, adding one word to_strata_hip_wave64and adp4abranch is all it takes; happy to do that in a follow-up or here.Per request 2: >2 GPUs kept small
One
maya.pyhunk (separate commit):--gpuson the HIP path accepts1..MAX_GPUSdistinct indices instead of exactly two — the engine's layer split has always supported up to 16 parts. It overlaps #183 (@izabera); whichever lands second rebases.Files (7)
cmake/hip_backend.cmakegfx908wave64 arch list + configure status line,STRATA_HIP_WAVE64detection, the gated INTERFACE defineinclude/strata/hip_compat/cuda_runtime.hcudaHostAlloc, both behind#ifdef STRATA_HIP_WAVE64include/strata/hip_compat/intrinsics.hppsyncwarp, per-half ballot, sleep scaling — gated; CDNAsdot4branch fordp4a(arch-gated as the gfx1030 one is)src/core/device.cuarch_problem()acceptswarpSize 64when the binary was compiled for that exact archtests/hip/intrinsics.cpptests/hip/glm_prefill_attention.cppmaya.pyHIP_ARCHS_WAVE64 = ("gfx908",)tier in the usable list, archs lineHIP_ARCHS + unvalidated + wave64(wave32 setups get the exact same list as today) — commit 1; >2-GPU--gpus— commit 2Note on
tests/hip/glm_prefill_attention.cpp(pre-existing gap, not wave64-specific): the test's rocWMMA f16q phase calledmla_attn_f16qunconditionally, but on any arch outside gfx11/gfx12 that kernel's device pass compiles to a trap (STRATA_ROCWMMA 0— rocWMMA'sconfig.hpponly knows gfx11/gfx12), so the phase hard-failed on gfx908 … and would have on gfx1030 too. The engine itself never takes it:glm_prefill.cu'smla_attn_path()returnsF32there (and that is the kernel measured below). The phase now skips with the same guardmla_attn_path()uses — the sibling wmma2 phase already skipped like this.Hardware & numbers
4× AMD Instinct MI100 32 GB (gfx908), EPYC 7402, 251.6 GB RAM, Debian 13, ROCm 7.2.4; Maya-S24, context 262144,
--kv-streaming on, 100% of routed experts in VRAM (12384/15040), CPU lane off.From
./maya.sh --benchon this branch (v1.1.15 + the PR, gated build):[0,12)/[12,24)/[24,36)/[36,45)across the four cards, one 64 KB host hop per boundary per token,vram hit 100.00%For comparison, the v1.1.12 numbers from #229 (same box, ungated local diff): 58.5 tok/s decode, 455 / 493 prefill — v1.1.15's kernel work picks up the rest.
Parity results
HIP_VISIBLE_DEVICES=0 ctest --test-dir build-hip --output-on-failure --timeout 60with the parity set — rebuilt from this branch's final (gated) code:HIP_VISIBLE_DEVICES=0 build-hip/hip_expert_kernel_bench --parity-only --sweep:621/621 sweep cases PASS, 0 failures, every case
bit_identical=yes(max_abs=0.000e+00) — the gu16/gu22 × down22 expert kernels through the half-wavefront mapping reproduce the reference bit-for-bit.GPU-free checks as well:
tools/check_hip_compat.pyclean,tools.test_maya_hip+tools.test_hip_archsall green (the archs asserts still hold).Build & run (ROCm 7)
With
gfx908accepted,./maya.sh --backend hip --checklists the cards as usable and the normal setup path passes these flags itself.Status: experimental — validated on this 4× MI100 box only (build, parity suite, benchmark, serving at 262144 context). No MI50/other-wave64 coverage yet; gfx906 offered above. Credit: the half-wavefront layer descends from Strata's experimental gfx906/908 work; thanks to @mw00 for the gating review request that made this diff wave32-safe.
Closes #229 (report)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.