[PR #4] [CLOSED] Extend Linux HIP setup to R9700 with multi-architecture builds #275

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

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/4
Author: @boxwrench
Created: 10/8/2026
Status: ❌ Closed

Base: main ← Head: amd/gfx1201-shared-hip


📝 Commits (4)

  • fa3e4fe Add experimental Linux gfx1100 setup and GLM HIP compatibility
  • 5467bf7 Port Strata multi-architecture HIP checks and RDNA4 intrinsics
  • b779100 Check HIP architecture list normalization and rejection cases
  • 12fc591 Document multi-architecture R9700 validation and compile-only gfx1151

📊 Changes

28 files changed (+1069 additions, -69 deletions)

View changed files

📝 .gitignore (+4 -0)
📝 CMakeLists.txt (+8 -0)
📝 README.md (+3 -0)
📝 cmake/hip_backend.cmake (+47 -8)
📝 docs/AMD_HIP.md (+5 -0)
➕ docs/AMD_MAYA.md (+102 -0)
➕ docs/AMD_RDNA4.md (+77 -0)
➕ docs/AMD_UPSTREAM.md (+72 -0)
📝 include/strata/core/device.hpp (+3 -0)
📝 include/strata/hip_compat/cublas_v2.h (+4 -0)
➕ include/strata/hip_compat/cuda_profiler_api.h (+4 -0)
📝 include/strata/hip_compat/cuda_runtime.h (+10 -0)
📝 include/strata/hip_compat/intrinsics.hpp (+71 -33)
📝 maya.py (+125 -10)
📝 setup.py (+7 -6)
📝 src/core/device.cu (+51 -5)
📝 src/core/device_main.cpp (+1 -1)
📝 src/core/glm_fast_path.cu (+6 -0)
📝 src/core/glm_model.cu (+1 -1)
📝 src/kernels/cuda/glm_batch.cu (+20 -4)

...and 8 more files

📄 Description

The HIP runtime previously rejected every device except gfx1100, and its signed-byte dot instruction guard excluded RDNA4. Port upstream Strata's shared HIP architecture checks and intrinsics so one Maya binary can run on RX 7900 XT/XTX and RX 9070 / Radeon AI PRO R9700.

Stacked on #3: branch amd/gfx1201-shared-hip starts from amd/glm-gfx1100-setup (fa3e4fe). Review only this PR's new changes. Upstream currently has only main, so GitHub's base is main until #3 merges. This stays draft while the underlying HIP setup/full-model validation remains draft.

Validation additionally uses the companion publication/KDA fixes from #2, kept out of this PR's new commits. The merged trees match the exact validation worktree. Original Maya build-hip/ and its download/trial worker were left untouched.

Changes

  • Port Strata d5ea713's CMake architecture categories and multi-architecture parsing. Normalize semicolon/space lists, retain feature suffixes for compilation, remove empty/duplicate entries, and supply a base-architecture list to runtime checks.
  • Replace the gfx1100 prefix check with arch_problem(): exact compiled-list membership after stripping feature suffixes, followed by the existing wave32 check. Update startup/device diagnostics to show actual and compiled architectures.
  • Port the sudot4 guard for gfx1100/1101/1102/1150/1151/1200/1201, v_perm_b32 byte permutation, SWAR __vsub4 / __vsubss4 / __vcmpne4, and the upstream older-HIP warp synchronization fallback. Keep Maya's GLM runtime/BLAS mappings from #3.
  • Add upstream gfx1201 hipBLASLt tables for versions 100202 / 100500. Table availability does not redirect GLM's existing hipBLAS/MMQ calls or establish a speedup.
  • Add gfx1201 to shared setup eligibility and use that list in Maya. Maya builds one engine for gfx1100;gfx1201;gfx1151, selects one supported discrete GPU, and reuses the same compiled architecture list on either card.
  • Keep gfx1151 labelled builds, untested. Its code is included, but setup does not enable Strix Halo in this PR; unified-memory accounting and Nimo hardware validation are separate work.
  • Extend intrinsics parity to all 65,536 byte-value pairs with varying neighboring lanes/permutation selectors. Add five parser tests, including suffixes, duplicate/empty entries, unsupported targets and false prefix matches.

Validation

Native Ubuntu Linux, Ryzen 7 9800X3D, 192 GB DDR5, ROCm 7.2.1 / Clang 22; RX 7900 XT gfx1100 20 GiB and AI PRO R9700 gfx1201 32 GiB. Maya base 70e0746 (1.3.0), #3 base fa3e4fe, plus this PR and #2 for validation.

One engine and all test targets were compiled with:

cmake -S . -B build-multi -G Ninja -DCMAKE_BUILD_TYPE=Release \
  -DSTRATA_ENABLE_HIP=ON -DSTRATA_ENABLE_CUDA=OFF \
  -DSTRATA_PREFILL_MMQ=ON -DSTRATA_NATIVE_EXPERTS=ON -DSTRATA_BUILD_TESTS=OFF \
  '-DCMAKE_HIP_ARCHITECTURES=gfx1100;gfx1201;gfx1151' \
  -DCMAKE_HIP_COMPILER=/opt/rocm-7.2.1/llvm/bin/clang++ \
  -DCMAKE_HIP_COMPILER_ROCM_ROOT=/opt/rocm-7.2.1 \
  -DCMAKE_PREFIX_PATH=/opt/rocm-7.2.1 \
  -DSTRATA_GGML_DIR=/ai/github/project-maya/third_party/llama.cpp
cmake --build build-multi --target strata strata-device hip_expert_cache_staging \
  hip_intrinsics hip_handoff hip_glm_handoff hip_glm_prefill_attention iq1_s_parity \
  glm_hc_parity glm_kda_parity glm_ffn_parity glm_dsa_parity glm_layer_parity \
  glm_model_test hip_prefill_mmq_parity -j 3

Engine SHA-256: 16664cfcb1cf34d9f6786a11de9a912e40149e839a5da3b9fbeea52050b8fd48. Inspection of its ELF .hip_fatbin section finds 64 bundled entries for each of gfx1100, gfx1201 and gfx1151. No gfx1151 hardware test was performed.

R9700, with HIP_VISIBLE_DEVICES=1:

env -u ROCR_VISIBLE_DEVICES LD_LIBRARY_PATH=/opt/rocm/lib HIP_VISIBLE_DEVICES=1 \
  ctest --test-dir build-multi --output-on-failure --timeout 60 \
  -R '^(glm_(hc|kda|ffn|dsa|layer)_parity|glm_model_test|hip_intrinsics|hip_(glm_handoff|glm_prefill_attention|handoff|device_selftest|prefill_mmq_parity|expert_cache_staging)|iq1_s_parity)$'
env -u ROCR_VISIBLE_DEVICES LD_LIBRARY_PATH=/opt/rocm/lib HIP_VISIBLE_DEVICES=1 \
  STRATA_GLM_HC1=1 build-multi/glm_hc_parity --selftest
env -u ROCR_VISIBLE_DEVICES LD_LIBRARY_PATH=/opt/rocm/lib HIP_VISIBLE_DEVICES=1 \
  STRATA_GLM_HC2=1 build-multi/glm_hc_parity --selftest
Internal ctest changing into directory: /ai/github/maya-gfx1201-test/build-multi
Test project /ai/github/maya-gfx1201-test/build-multi
      Start  2: hip_expert_cache_staging
 1/14 Test  #2: hip_expert_cache_staging .........   Passed    0.46 sec
      Start  3: hip_intrinsics
 2/14 Test  #3: hip_intrinsics ...................   Passed    0.06 sec
      Start  4: hip_handoff
 3/14 Test  #4: hip_handoff ......................   Passed    0.09 sec
      Start  5: hip_glm_handoff
 4/14 Test  #5: hip_glm_handoff ..................   Passed    0.08 sec
      Start  6: hip_glm_prefill_attention
 5/14 Test  #6: hip_glm_prefill_attention ........   Passed    0.07 sec
      Start 12: iq1_s_parity
 6/14 Test #12: iq1_s_parity .....................   Passed    0.07 sec
      Start 15: glm_hc_parity
 7/14 Test #15: glm_hc_parity ....................   Passed    0.08 sec
      Start 17: glm_kda_parity
 8/14 Test #17: glm_kda_parity ...................   Passed    0.07 sec
      Start 18: glm_ffn_parity
 9/14 Test #18: glm_ffn_parity ...................   Passed    0.06 sec
      Start 19: glm_dsa_parity
10/14 Test #19: glm_dsa_parity ...................   Passed    0.05 sec
      Start 20: glm_layer_parity
11/14 Test #20: glm_layer_parity .................   Passed    0.07 sec
      Start 21: glm_model_test
12/14 Test #21: glm_model_test ...................   Passed    0.37 sec
      Start 43: hip_device_selftest
13/14 Test #43: hip_device_selftest ..............   Passed    0.06 sec
      Start 44: hip_prefill_mmq_parity
14/14 Test #44: hip_prefill_mmq_parity ...........   Passed    0.42 sec

100% tests passed, 0 tests failed out of 14

Total Test time (real) =   2.01 sec

HC1:
glm_hc_parity: fast 4096-wide HC agrees over 8 fused steps
glm_hc_parity: PASS
HC2:
glm_hc_parity: fast 4096-wide HC agrees over 8 fused steps
glm_hc_parity: PASS

HIP intrinsic device: AMD Radeon AI PRO R9700 (gfx1201)
HIP intrinsics parity OK: signed dot4/overflow, 65536 packed-byte pairs/permutations, wave32 shuffles, ballot and sleep

The same 14-check suite with HIP_VISIBLE_DEVICES=0 passes 14/14 on the 7900 XT. Five installer tests and five actual CMake-parser tests pass:

python3 tools/test_maya_hip.py
python3 tools/test_hip_archs.py

The device selftest reports gfx1201 wave32 / gfx1100,gfx1201,gfx1151. Selecting the uncompiled iGPU (HIP_VISIBLE_DEVICES=2) exits 1 with:

strata-device: GPU 0 (AMD Radeon Graphics, gfx1036) is not an architecture this Maya engine was compiled for (gfx1100,gfx1201,gfx1151); compile it for this card (./maya.sh --backend hip, or -DCMAKE_HIP_ARCHITECTURES=gfx1036, docs/AMD_HIP.md) or choose another GPU with HIP_VISIBLE_DEVICES

CUDA was not compile-checked: this host has no nvcc; the author should build CUDA before merging the stack. Synthetic checks do not establish full-model quantized-expert/verification correctness or throughput. Full-model R9700 inference remains unverified. gfx11 WMMA prompt porting and setup-helper consolidation remain separate follow-ups after the first end-to-end run.


🔄 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/4 **Author:** [@boxwrench](https://github.com/boxwrench) **Created:** 10/8/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `amd/gfx1201-shared-hip` --- ### 📝 Commits (4) - [`fa3e4fe`](https://github.com/mw00/project-maya/commit/fa3e4feac078a72b715cbf36183304dd3fdfb958) Add experimental Linux gfx1100 setup and GLM HIP compatibility - [`5467bf7`](https://github.com/mw00/project-maya/commit/5467bf746371ce3026c16dcf1307fae974dc24d6) Port Strata multi-architecture HIP checks and RDNA4 intrinsics - [`b779100`](https://github.com/mw00/project-maya/commit/b779100ec0b15889a8730a3d4273ab17be09428f) Check HIP architecture list normalization and rejection cases - [`12fc591`](https://github.com/mw00/project-maya/commit/12fc5911f41fd8b5a93955039155e14031f4a7b5) Document multi-architecture R9700 validation and compile-only gfx1151 ### 📊 Changes **28 files changed** (+1069 additions, -69 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+4 -0) 📝 `CMakeLists.txt` (+8 -0) 📝 `README.md` (+3 -0) 📝 `cmake/hip_backend.cmake` (+47 -8) 📝 `docs/AMD_HIP.md` (+5 -0) ➕ `docs/AMD_MAYA.md` (+102 -0) ➕ `docs/AMD_RDNA4.md` (+77 -0) ➕ `docs/AMD_UPSTREAM.md` (+72 -0) 📝 `include/strata/core/device.hpp` (+3 -0) 📝 `include/strata/hip_compat/cublas_v2.h` (+4 -0) ➕ `include/strata/hip_compat/cuda_profiler_api.h` (+4 -0) 📝 `include/strata/hip_compat/cuda_runtime.h` (+10 -0) 📝 `include/strata/hip_compat/intrinsics.hpp` (+71 -33) 📝 `maya.py` (+125 -10) 📝 `setup.py` (+7 -6) 📝 `src/core/device.cu` (+51 -5) 📝 `src/core/device_main.cpp` (+1 -1) 📝 `src/core/glm_fast_path.cu` (+6 -0) 📝 `src/core/glm_model.cu` (+1 -1) 📝 `src/kernels/cuda/glm_batch.cu` (+20 -4) _...and 8 more files_ </details> ### 📄 Description The HIP runtime previously rejected every device except gfx1100, and its signed-byte dot instruction guard excluded RDNA4. Port upstream Strata's shared HIP architecture checks and intrinsics so one Maya binary can run on RX 7900 XT/XTX and RX 9070 / Radeon AI PRO R9700. **Stacked on #3:** branch `amd/gfx1201-shared-hip` starts from `amd/glm-gfx1100-setup` (`fa3e4fe`). [Review only this PR's new changes](https://github.com/boxwrench/project-maya/compare/fa3e4fe...amd/gfx1201-shared-hip). Upstream currently has only `main`, so GitHub's base is `main` until #3 merges. This stays draft while the underlying HIP setup/full-model validation remains draft. Validation additionally uses the companion publication/KDA fixes from #2, kept out of this PR's new commits. The merged trees match the exact validation worktree. Original Maya `build-hip/` and its download/trial worker were left untouched. ## Changes - Port [Strata `d5ea713`](https://github.com/Niko1221/Strata/tree/d5ea7133741e67743c0e886bb426c0ce8d69cf6c)'s CMake architecture categories and multi-architecture parsing. Normalize semicolon/space lists, retain feature suffixes for compilation, remove empty/duplicate entries, and supply a base-architecture list to runtime checks. - Replace the gfx1100 prefix check with `arch_problem()`: exact compiled-list membership after stripping feature suffixes, followed by the existing wave32 check. Update startup/device diagnostics to show actual and compiled architectures. - Port the sudot4 guard for gfx1100/1101/1102/1150/1151/1200/1201, `v_perm_b32` byte permutation, SWAR `__vsub4` / `__vsubss4` / `__vcmpne4`, and the upstream older-HIP warp synchronization fallback. Keep Maya's GLM runtime/BLAS mappings from #3. - Add upstream gfx1201 hipBLASLt tables for versions `100202` / `100500`. Table availability does not redirect GLM's existing hipBLAS/MMQ calls or establish a speedup. - Add gfx1201 to shared setup eligibility and use that list in Maya. Maya builds **one engine for `gfx1100;gfx1201;gfx1151`**, selects one supported discrete GPU, and reuses the same compiled architecture list on either card. - Keep gfx1151 labelled **builds, untested**. Its code is included, but setup does not enable Strix Halo in this PR; unified-memory accounting and Nimo hardware validation are separate work. - Extend intrinsics parity to all 65,536 byte-value pairs with varying neighboring lanes/permutation selectors. Add five parser tests, including suffixes, duplicate/empty entries, unsupported targets and false prefix matches. ## Validation Native Ubuntu Linux, Ryzen 7 9800X3D, 192 GB DDR5, ROCm 7.2.1 / Clang 22; RX 7900 XT gfx1100 20 GiB and AI PRO R9700 gfx1201 32 GiB. Maya base `70e0746` (1.3.0), #3 base `fa3e4fe`, plus this PR and #2 for validation. One engine and all test targets were compiled with: ```sh cmake -S . -B build-multi -G Ninja -DCMAKE_BUILD_TYPE=Release \ -DSTRATA_ENABLE_HIP=ON -DSTRATA_ENABLE_CUDA=OFF \ -DSTRATA_PREFILL_MMQ=ON -DSTRATA_NATIVE_EXPERTS=ON -DSTRATA_BUILD_TESTS=OFF \ '-DCMAKE_HIP_ARCHITECTURES=gfx1100;gfx1201;gfx1151' \ -DCMAKE_HIP_COMPILER=/opt/rocm-7.2.1/llvm/bin/clang++ \ -DCMAKE_HIP_COMPILER_ROCM_ROOT=/opt/rocm-7.2.1 \ -DCMAKE_PREFIX_PATH=/opt/rocm-7.2.1 \ -DSTRATA_GGML_DIR=/ai/github/project-maya/third_party/llama.cpp cmake --build build-multi --target strata strata-device hip_expert_cache_staging \ hip_intrinsics hip_handoff hip_glm_handoff hip_glm_prefill_attention iq1_s_parity \ glm_hc_parity glm_kda_parity glm_ffn_parity glm_dsa_parity glm_layer_parity \ glm_model_test hip_prefill_mmq_parity -j 3 ``` Engine SHA-256: `16664cfcb1cf34d9f6786a11de9a912e40149e839a5da3b9fbeea52050b8fd48`. Inspection of its ELF `.hip_fatbin` section finds 64 bundled entries for each of gfx1100, gfx1201 and gfx1151. No gfx1151 hardware test was performed. R9700, with **`HIP_VISIBLE_DEVICES=1`**: ```sh env -u ROCR_VISIBLE_DEVICES LD_LIBRARY_PATH=/opt/rocm/lib HIP_VISIBLE_DEVICES=1 \ ctest --test-dir build-multi --output-on-failure --timeout 60 \ -R '^(glm_(hc|kda|ffn|dsa|layer)_parity|glm_model_test|hip_intrinsics|hip_(glm_handoff|glm_prefill_attention|handoff|device_selftest|prefill_mmq_parity|expert_cache_staging)|iq1_s_parity)$' env -u ROCR_VISIBLE_DEVICES LD_LIBRARY_PATH=/opt/rocm/lib HIP_VISIBLE_DEVICES=1 \ STRATA_GLM_HC1=1 build-multi/glm_hc_parity --selftest env -u ROCR_VISIBLE_DEVICES LD_LIBRARY_PATH=/opt/rocm/lib HIP_VISIBLE_DEVICES=1 \ STRATA_GLM_HC2=1 build-multi/glm_hc_parity --selftest ``` ```text Internal ctest changing into directory: /ai/github/maya-gfx1201-test/build-multi Test project /ai/github/maya-gfx1201-test/build-multi Start 2: hip_expert_cache_staging 1/14 Test #2: hip_expert_cache_staging ......... Passed 0.46 sec Start 3: hip_intrinsics 2/14 Test #3: hip_intrinsics ................... Passed 0.06 sec Start 4: hip_handoff 3/14 Test #4: hip_handoff ...................... Passed 0.09 sec Start 5: hip_glm_handoff 4/14 Test #5: hip_glm_handoff .................. Passed 0.08 sec Start 6: hip_glm_prefill_attention 5/14 Test #6: hip_glm_prefill_attention ........ Passed 0.07 sec Start 12: iq1_s_parity 6/14 Test #12: iq1_s_parity ..................... Passed 0.07 sec Start 15: glm_hc_parity 7/14 Test #15: glm_hc_parity .................... Passed 0.08 sec Start 17: glm_kda_parity 8/14 Test #17: glm_kda_parity ................... Passed 0.07 sec Start 18: glm_ffn_parity 9/14 Test #18: glm_ffn_parity ................... Passed 0.06 sec Start 19: glm_dsa_parity 10/14 Test #19: glm_dsa_parity ................... Passed 0.05 sec Start 20: glm_layer_parity 11/14 Test #20: glm_layer_parity ................. Passed 0.07 sec Start 21: glm_model_test 12/14 Test #21: glm_model_test ................... Passed 0.37 sec Start 43: hip_device_selftest 13/14 Test #43: hip_device_selftest .............. Passed 0.06 sec Start 44: hip_prefill_mmq_parity 14/14 Test #44: hip_prefill_mmq_parity ........... Passed 0.42 sec 100% tests passed, 0 tests failed out of 14 Total Test time (real) = 2.01 sec HC1: glm_hc_parity: fast 4096-wide HC agrees over 8 fused steps glm_hc_parity: PASS HC2: glm_hc_parity: fast 4096-wide HC agrees over 8 fused steps glm_hc_parity: PASS HIP intrinsic device: AMD Radeon AI PRO R9700 (gfx1201) HIP intrinsics parity OK: signed dot4/overflow, 65536 packed-byte pairs/permutations, wave32 shuffles, ballot and sleep ``` The same 14-check suite with `HIP_VISIBLE_DEVICES=0` passes **14/14 on the 7900 XT**. Five installer tests and five actual CMake-parser tests pass: ```sh python3 tools/test_maya_hip.py python3 tools/test_hip_archs.py ``` The device selftest reports `gfx1201 wave32 / gfx1100,gfx1201,gfx1151`. Selecting the uncompiled iGPU (`HIP_VISIBLE_DEVICES=2`) exits 1 with: ```text strata-device: GPU 0 (AMD Radeon Graphics, gfx1036) is not an architecture this Maya engine was compiled for (gfx1100,gfx1201,gfx1151); compile it for this card (./maya.sh --backend hip, or -DCMAKE_HIP_ARCHITECTURES=gfx1036, docs/AMD_HIP.md) or choose another GPU with HIP_VISIBLE_DEVICES ``` CUDA was **not compile-checked**: this host has no `nvcc`; the author should build CUDA before merging the stack. Synthetic checks do not establish full-model quantized-expert/verification correctness or throughput. Full-model R9700 inference remains unverified. gfx11 WMMA prompt porting and setup-helper consolidation remain separate follow-ups after the first end-to-end run. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:23:41 +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#275
No description provided.