[PR #255] [MERGED] HIP: build only detected archs and gate rocWMMA on WMMA-capable targets #429

Closed
opened 2026-10-29 21:25:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/255
Author: @andrewprock
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/20/2026
Merged by: @mw00

Base: main ← Head: hip-rdna2-rocwmma-fix


📝 Commits (3)

  • ded0c7c HIP: build only detected archs and gate rocWMMA on WMMA-capable targets
  • f74a781 AMD docs: first validated gfx1030 run (Radeon PRO V620, Maya-L bench numbers)
  • c6c710e AMD docs: reword the validation note

📊 Changes

4 files changed (+29 additions, -6 deletions)

View changed files

📝 cmake/hip_backend.cmake (+16 -1)
📝 docs/AMD_MAYA.md (+6 -1)
📝 maya.py (+1 -1)
📝 src/kernels/cuda/glm_batch.cu (+6 -3)

📄 Description

Problem

Installing the HIP backend fails on machines where ROCm 7 no longer ships rocWMMA (rocwmma/rocwmma.hpp not found) whenever the installer compiles a WMMA-capable arch alongside the user's card. This hits RDNA 2 users (gfx1030: RX 6800/6900, Radeon PRO V620/W6800) hard, since the installer always compiled gfx1100;gfx1201;gfx1151;gfx1030 regardless of the installed card.

Fix (one logical change, three files)

  1. maya.py — check_hip_pc() now sets CMAKE_HIP_ARCHITECTURES to the archs of the detected cards only, instead of every validated arch plus the unvalidated list.
  2. cmake/hip_backend.cmake — derives STRATA_HAS_WMMA from the target arch list (gfx110x/115x/120x) and exports it as a compile definition.
  3. src/kernels/cuda/glm_batch.cu — the host compile pass includes rocwmma/rocwmma.hpp only when STRATA_HAS_WMMA is set; the device pass keeps its per-arch __gfx*__ checks (rocWMMA's config.hpp static_asserts on RDNA 2, so the device pass already skipped it). A WMMA-less RDNA 2 build now links without rocWMMA present.

First validated gfx1030 run

Hardware: Radeon PRO V620 (30 GB, gfx1030), AMD Ryzen Threadripper PRO 3975WX (32 cores), 208 GB RAM, ROCm 7, Linux. Model: Maya-L (IQ3_S, 156.3 GB), fully resident — 129.5 GB of experts pinned in RAM plus 19.06 GB VRAM expert pool, zero disk reads during decode (STRATA_GLM_RAM_RESIDENT=1, context 131072).

maya.py --bench (greedy, thinking off, warm-up first):

decode (writing the answer): mean 13.0 tokens/s over 3 answers of 256 tokens
    12.4 tokens/s  Write a Python function that parses a CSV file into a list of dictionaries, with type hints and a docstring.
    13.8 tokens/s  Explain how photosynthesis works, step by step, for a high-school student.
    13.0 tokens/s  Write a complete HTML page with a canvas that draws a bouncing ball animation in JavaScript.
prefill (reading the prompt): 224 tokens/s, 2048 tokens
prefill (reading the prompt): 216 tokens/s, 8192 tokens

Engine notes: model loaded in 72 s, warm tiers in 31 s; decode ~67–81 ms/token with 28–42 RAM fetches/token (CPU lane 21 threads, 0.205 ms/expert vs 0.470 ms over PCIe, ~99–126 experts/token through the lane); VRAM hit rate 50–61%. The full maya-bench.txt / maya-report.txt are available on request.

docs/AMD_MAYA.md is updated to reflect that gfx1030 is now validated, with these numbers.

Measurements (before / after)

Per CONTRIBUTING.md, before/after on the same harness — with the caveat that there is no "before" performance number, because before this fix the build fails outright on a RDNA 2 machine with ROCm 7 (rocwmma/rocwmma.hpp not found at src/kernels/cuda/glm_batch.cu:28). Before/after for the build itself:

  • before: HIP install on gfx1030 with ROCm 7 fails at glm_batch.cu (rocwmma missing; rocWMMA not in ROCm 7 packages, not installable)
  • after: HIP install on gfx1030 builds and runs; full validation numbers in "First validated gfx1030 run" above (maya.py --bench, three 256-token greedy questions, prefill at 2048/8192 — the documented harness)

NVIDIA code path is unchanged. On WMMA-capable archs (gfx110x/115x/120x) STRATA_HAS_WMMA is 1, so the host pass compiles byte-identical code to before; the only functional change outside RDNA 2 is that CMAKE_HIP_ARCHITECTURES now contains the archs of the cards actually present instead of every validated arch, which only trims build time/output binaries.

Relation to v1.1.13: that fix already removed rocWMMA from the device pass (its config.hpp static_asserts on RDNA 2, so the f16q kernel compiles empty there) — but the host pass still includes rocwmma/rocwmma.hpp unconditionally, so a gfx1030 build still required the headers, which ROCm 7 no longer ships. This PR closes that remaining gap, and trims the arch list to the detected cards.

The diff is build-system + one #if gate; no CUDA calls were added, so nothing new needed mapping in include/strata/hip_compat/ (verified by tools/check_hip_compat.py).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mw00/project-maya/pull/255 **Author:** [@andrewprock](https://github.com/andrewprock) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/20/2026 **Merged by:** [@mw00](https://github.com/mw00) **Base:** `main` ← **Head:** `hip-rdna2-rocwmma-fix` --- ### 📝 Commits (3) - [`ded0c7c`](https://github.com/mw00/project-maya/commit/ded0c7c4ae982270f2e070feb37561c025485a02) HIP: build only detected archs and gate rocWMMA on WMMA-capable targets - [`f74a781`](https://github.com/mw00/project-maya/commit/f74a781b70f96753a8bfa85cb2cf77d95470dc54) AMD docs: first validated gfx1030 run (Radeon PRO V620, Maya-L bench numbers) - [`c6c710e`](https://github.com/mw00/project-maya/commit/c6c710ebf1755956772da4df03d69b7d2de31086) AMD docs: reword the validation note ### 📊 Changes **4 files changed** (+29 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `cmake/hip_backend.cmake` (+16 -1) 📝 `docs/AMD_MAYA.md` (+6 -1) 📝 `maya.py` (+1 -1) 📝 `src/kernels/cuda/glm_batch.cu` (+6 -3) </details> ### 📄 Description ## Problem Installing the HIP backend fails on machines where ROCm 7 no longer ships rocWMMA (`rocwmma/rocwmma.hpp` not found) whenever the installer compiles a WMMA-capable arch alongside the user's card. This hits RDNA 2 users (gfx1030: RX 6800/6900, Radeon PRO V620/W6800) hard, since the installer always compiled `gfx1100;gfx1201;gfx1151;gfx1030` regardless of the installed card. ## Fix (one logical change, three files) 1. **`maya.py`** — `check_hip_pc()` now sets `CMAKE_HIP_ARCHITECTURES` to the archs of the *detected* cards only, instead of every validated arch plus the unvalidated list. 2. **`cmake/hip_backend.cmake`** — derives `STRATA_HAS_WMMA` from the target arch list (gfx110x/115x/120x) and exports it as a compile definition. 3. **`src/kernels/cuda/glm_batch.cu`** — the host compile pass includes `rocwmma/rocwmma.hpp` only when `STRATA_HAS_WMMA` is set; the device pass keeps its per-arch `__gfx*__` checks (rocWMMA's `config.hpp` static_asserts on RDNA 2, so the device pass already skipped it). A WMMA-less RDNA 2 build now links without rocWMMA present. ## First validated gfx1030 run Hardware: **Radeon PRO V620** (30 GB, gfx1030), **AMD Ryzen Threadripper PRO 3975WX** (32 cores), **208 GB RAM**, ROCm 7, Linux. Model: **Maya-L** (IQ3_S, 156.3 GB), fully resident — 129.5 GB of experts pinned in RAM plus 19.06 GB VRAM expert pool, **zero disk reads** during decode (`STRATA_GLM_RAM_RESIDENT=1`, context 131072). `maya.py --bench` (greedy, thinking off, warm-up first): ``` decode (writing the answer): mean 13.0 tokens/s over 3 answers of 256 tokens 12.4 tokens/s Write a Python function that parses a CSV file into a list of dictionaries, with type hints and a docstring. 13.8 tokens/s Explain how photosynthesis works, step by step, for a high-school student. 13.0 tokens/s Write a complete HTML page with a canvas that draws a bouncing ball animation in JavaScript. prefill (reading the prompt): 224 tokens/s, 2048 tokens prefill (reading the prompt): 216 tokens/s, 8192 tokens ``` Engine notes: model loaded in 72 s, warm tiers in 31 s; decode ~67–81 ms/token with 28–42 RAM fetches/token (CPU lane 21 threads, 0.205 ms/expert vs 0.470 ms over PCIe, ~99–126 experts/token through the lane); VRAM hit rate 50–61%. The full `maya-bench.txt` / `maya-report.txt` are available on request. `docs/AMD_MAYA.md` is updated to reflect that gfx1030 is now validated, with these numbers. ## Measurements (before / after) Per CONTRIBUTING.md, before/after on the same harness — with the caveat that **there is no "before" performance number, because before this fix the build fails outright** on a RDNA 2 machine with ROCm 7 (`rocwmma/rocwmma.hpp` not found at `src/kernels/cuda/glm_batch.cu:28`). Before/after for the build itself: - before: HIP install on gfx1030 with ROCm 7 fails at `glm_batch.cu` (rocwmma missing; rocWMMA not in ROCm 7 packages, not installable) - after: HIP install on gfx1030 builds and runs; full validation numbers in "First validated gfx1030 run" above (`maya.py --bench`, three 256-token greedy questions, prefill at 2048/8192 — the documented harness) **NVIDIA code path is unchanged.** On WMMA-capable archs (gfx110x/115x/120x) `STRATA_HAS_WMMA` is `1`, so the host pass compiles byte-identical code to before; the only functional change outside RDNA 2 is that `CMAKE_HIP_ARCHITECTURES` now contains the archs of the cards actually present instead of every validated arch, which only trims build time/output binaries. **Relation to v1.1.13:** that fix already removed rocWMMA from the *device* pass (its `config.hpp` static_asserts on RDNA 2, so the f16q kernel compiles empty there) — but the *host* pass still includes `rocwmma/rocwmma.hpp` unconditionally, so a gfx1030 build still required the headers, which ROCm 7 no longer ships. This PR closes that remaining gap, and trims the arch list to the detected cards. The diff is build-system + one `#if` gate; no CUDA calls were added, so nothing new needed mapping in `include/strata/hip_compat/` (verified by `tools/check_hip_compat.py`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:25:19 +07:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mw00/project-maya#429
No description provided.