[PR #3] [CLOSED] Add experimental Linux gfx1100 setup for Maya GLM #273

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/3
Author: @boxwrench
Created: 10/7/2026
Status: ❌ Closed

Base: main ← Head: amd/glm-gfx1100-setup


📝 Commits (2)

  • fa3e4fe Add experimental Linux gfx1100 setup and GLM HIP compatibility
  • b3c89bf Let HIP choose the GLM prefill chunk

📊 Changes

18 files changed (+653 additions, -16 deletions)

View changed files

📝 .gitignore (+4 -0)
📝 CMakeLists.txt (+8 -0)
📝 README.md (+3 -0)
📝 docs/AMD_HIP.md (+5 -0)
➕ docs/AMD_MAYA.md (+95 -0)
➕ docs/AMD_UPSTREAM.md (+72 -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)
📝 maya.py (+126 -10)
📝 setup.py (+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)
📝 src/kernels/cuda/glm_fast.cu (+11 -0)
📝 src/kernels/glm_hc_parity.cpp (+97 -0)
➕ tests/hip/glm_prefill_attention.cpp (+89 -0)
➕ tools/test_maya_hip.py (+97 -0)

📄 Description

Maya's installer assumes NVIDIA/CUDA, and the inherited HIP layer lacks several mappings required by Maya's GLM rewrite. Add an opt-in, experimental Linux HIP setup for RX 7900 XT/XTX (gfx1100), with one GPU and text input.

Draft: full-model startup and inference are still pending. The model weights are downloading; the draft can be reviewed now, and will remain draft until an end-to-end run and the follow-ups below are complete. The publication/KDA fixes are in companion #2; this branch keeps those changes separate.

Changes

  • Add --backend hip, KFD GPU selection restricted to gfx1100, system ROCm 7 prerequisite checks, a separate build-hip stamp, rebuild handling, and HIP serving configs. Preserve explicit memory-tuning overrides and skip vision.
  • Complete the GLM runtime/BLAS/profiler compatibility mappings, guard NVTX and CUDA BF16 headers, and link HIP MMQ and BLAS into the GLM engine.
  • Use agent-scope acquire loads for the fused HC kernel's FP32 partials on HIP; test eight consecutive fused steps against an independent CPU reference, including aliased gates, in HC3/HC2/HC1 modes.
  • Accommodate Maya 1.3.0: guard the CUDA WMMA attention implementation and use the existing FP32 path on HIP with a 16-row tile. The CUDA tile requires 66 KiB dynamic shared memory before static storage, exceeding RDNA's 64 KiB workgroup limit. Mask unused softmax lanes for the smaller tile. Compare the real batched attention kernel against a double-precision CPU reference.
  • Document the setup, tested scope, and upstream Strata integration requirements. Generated local configs/scripts remain ignored; no trial workers, download credentials or session logs are committed.

Adding cmake to setup.py's ENGINE_SOURCES changes the source hash: existing CUDA installs will rebuild once after updating. CUDA execution retains its WMMA path, but CUDA was not compile-checked because this machine has no nvcc. Please build CUDA and run its HC parity test before merging.

Validation

Host: RX 7900 XT (gfx1100, 20 GiB), Ryzen 7 9800X3D, 192 GB DDR5, native Ubuntu Linux, system ROCm 7.2.1 / Clang 22.

Initially developed from c53ae2b; rebased and retested on Maya 1.3.0, 70e0746. Results below use this draft plus the companion handoff/KDA fixes together. The independent PR branches combine without conflicts into the exact tested source tree.

python3 tools/test_maya_hip.py
LD_LIBRARY_PATH=/opt/rocm/lib HIP_VISIBLE_DEVICES=0 ROCR_VISIBLE_DEVICES=0 \
  ctest --test-dir build-hip --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)$'
STRATA_GLM_HC2=1 LD_LIBRARY_PATH=/opt/rocm/lib HIP_VISIBLE_DEVICES=0 ROCR_VISIBLE_DEVICES=0 \
  build-hip/glm_hc_parity --selftest
STRATA_GLM_HC1=1 LD_LIBRARY_PATH=/opt/rocm/lib HIP_VISIBLE_DEVICES=0 ROCR_VISIBLE_DEVICES=0 \
  build-hip/glm_hc_parity --selftest
Internal ctest changing into directory: /ai/github/project-maya/build-hip
Test project /ai/github/project-maya/build-hip
      Start  2: hip_expert_cache_staging
 1/14 Test  #2: hip_expert_cache_staging .........   Passed    0.45 sec
      Start  3: hip_intrinsics
 2/14 Test  #3: hip_intrinsics ...................   Passed    0.05 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.05 sec
      Start 12: iq1_s_parity
 6/14 Test #12: iq1_s_parity .....................   Passed    0.06 sec
      Start 15: glm_hc_parity
 7/14 Test #15: glm_hc_parity ....................   Passed    0.06 sec
      Start 17: glm_kda_parity
 8/14 Test #17: glm_kda_parity ...................   Passed    0.06 sec
      Start 18: glm_ffn_parity
 9/14 Test #18: glm_ffn_parity ...................   Passed    0.05 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.06 sec
      Start 21: glm_model_test
12/14 Test #21: glm_model_test ...................   Passed    0.44 sec
      Start 43: hip_device_selftest
13/14 Test #43: hip_device_selftest ..............   Passed    0.05 sec
      Start 44: hip_prefill_mmq_parity
14/14 Test #44: hip_prefill_mmq_parity ...........   Passed    0.38 sec

100% tests passed, 0 tests failed out of 14

Total Test time (real) =   1.94 sec

Installer: 5 tests passed.
HC2/HC1: fast 4096-wide HC agrees over 8 fused steps; PASS in both modes.
GLM prefill attention: max absolute error 3.923e-08 (tolerance 5e-5)
PASS: empty/masked cells, partial tiles, multiple tiles and head groups

The full engine and parity suite were tested on gfx1100 only. Isolated shared/GLM handoff tests also pass on gfx1201; that does not establish full-model support. R9700 enablement and a wider upstream HIP-layer refresh belong in a later PR. Credit Strata #697 for the companion publication fix.

Before leaving draft

  • Complete weight verification, model packing, startup, and real 7900 XT requests; report correctness and measured behavior. Synthetic tests do not prove quantized-expert/draft verification correctness.
  • Consolidate the HIP setup with setup.py helpers (rocm_root, amd_problem, build_engine_hip) where appropriate. The current path duplicates parts of those helpers to select an existing system ROCm installation and Maya's GLM/MMQ build/configuration; this is a known follow-up, not a claim that the duplication is final.
  • Confirm CUDA builds with the author. CUDA is not available on this test host.

hipBLASLt tables are not installed by this path: GLM's dense prompt products currently call hipBLAS directly, and its expert products use GGML MMQ. The inherited hipBLASLt table loader is in the separate Qwen prefill path. Copying a table alone would not tune these GLM calls; compatible dispatch, shapes and parity/performance checks are needed first. See docs/AMD_UPSTREAM.md.


🔄 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/3 **Author:** [@boxwrench](https://github.com/boxwrench) **Created:** 10/7/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `amd/glm-gfx1100-setup` --- ### 📝 Commits (2) - [`fa3e4fe`](https://github.com/mw00/project-maya/commit/fa3e4feac078a72b715cbf36183304dd3fdfb958) Add experimental Linux gfx1100 setup and GLM HIP compatibility - [`b3c89bf`](https://github.com/mw00/project-maya/commit/b3c89bfd1fa39cefc11637544a199bba221b4013) Let HIP choose the GLM prefill chunk ### 📊 Changes **18 files changed** (+653 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+4 -0) 📝 `CMakeLists.txt` (+8 -0) 📝 `README.md` (+3 -0) 📝 `docs/AMD_HIP.md` (+5 -0) ➕ `docs/AMD_MAYA.md` (+95 -0) ➕ `docs/AMD_UPSTREAM.md` (+72 -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) 📝 `maya.py` (+126 -10) 📝 `setup.py` (+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) 📝 `src/kernels/cuda/glm_fast.cu` (+11 -0) 📝 `src/kernels/glm_hc_parity.cpp` (+97 -0) ➕ `tests/hip/glm_prefill_attention.cpp` (+89 -0) ➕ `tools/test_maya_hip.py` (+97 -0) </details> ### 📄 Description Maya's installer assumes NVIDIA/CUDA, and the inherited HIP layer lacks several mappings required by Maya's GLM rewrite. Add an opt-in, experimental Linux HIP setup for RX 7900 XT/XTX (`gfx1100`), with one GPU and text input. **Draft:** full-model startup and inference are still pending. The model weights are downloading; the draft can be reviewed now, and will remain draft until an end-to-end run and the follow-ups below are complete. The publication/KDA fixes are in companion #2; this branch keeps those changes separate. ## Changes - Add `--backend hip`, KFD GPU selection restricted to gfx1100, system ROCm 7 prerequisite checks, a separate `build-hip` stamp, rebuild handling, and HIP serving configs. Preserve explicit memory-tuning overrides and skip vision. - Complete the GLM runtime/BLAS/profiler compatibility mappings, guard NVTX and CUDA BF16 headers, and link HIP MMQ and BLAS into the GLM engine. - Use agent-scope acquire loads for the fused HC kernel's FP32 partials on HIP; test eight consecutive fused steps against an independent CPU reference, including aliased gates, in HC3/HC2/HC1 modes. - Accommodate Maya 1.3.0: guard the CUDA WMMA attention implementation and use the existing FP32 path on HIP with a 16-row tile. The CUDA tile requires 66 KiB dynamic shared memory before static storage, exceeding RDNA's 64 KiB workgroup limit. Mask unused softmax lanes for the smaller tile. Compare the real batched attention kernel against a double-precision CPU reference. - Document the setup, tested scope, and upstream Strata integration requirements. Generated local configs/scripts remain ignored; no trial workers, download credentials or session logs are committed. Adding `cmake` to `setup.py`'s `ENGINE_SOURCES` changes the source hash: **existing CUDA installs will rebuild once after updating**. CUDA execution retains its WMMA path, but CUDA was **not compile-checked** because this machine has no `nvcc`. Please build CUDA and run its HC parity test before merging. ## Validation Host: RX 7900 XT (gfx1100, 20 GiB), Ryzen 7 9800X3D, 192 GB DDR5, native Ubuntu Linux, system ROCm 7.2.1 / Clang 22. Initially developed from `c53ae2b`; rebased and retested on Maya 1.3.0, `70e0746`. Results below use this draft plus the companion handoff/KDA fixes together. The independent PR branches combine without conflicts into the exact tested source tree. ```sh python3 tools/test_maya_hip.py LD_LIBRARY_PATH=/opt/rocm/lib HIP_VISIBLE_DEVICES=0 ROCR_VISIBLE_DEVICES=0 \ ctest --test-dir build-hip --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)$' STRATA_GLM_HC2=1 LD_LIBRARY_PATH=/opt/rocm/lib HIP_VISIBLE_DEVICES=0 ROCR_VISIBLE_DEVICES=0 \ build-hip/glm_hc_parity --selftest STRATA_GLM_HC1=1 LD_LIBRARY_PATH=/opt/rocm/lib HIP_VISIBLE_DEVICES=0 ROCR_VISIBLE_DEVICES=0 \ build-hip/glm_hc_parity --selftest ``` ```text Internal ctest changing into directory: /ai/github/project-maya/build-hip Test project /ai/github/project-maya/build-hip Start 2: hip_expert_cache_staging 1/14 Test #2: hip_expert_cache_staging ......... Passed 0.45 sec Start 3: hip_intrinsics 2/14 Test #3: hip_intrinsics ................... Passed 0.05 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.05 sec Start 12: iq1_s_parity 6/14 Test #12: iq1_s_parity ..................... Passed 0.06 sec Start 15: glm_hc_parity 7/14 Test #15: glm_hc_parity .................... Passed 0.06 sec Start 17: glm_kda_parity 8/14 Test #17: glm_kda_parity ................... Passed 0.06 sec Start 18: glm_ffn_parity 9/14 Test #18: glm_ffn_parity ................... Passed 0.05 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.06 sec Start 21: glm_model_test 12/14 Test #21: glm_model_test ................... Passed 0.44 sec Start 43: hip_device_selftest 13/14 Test #43: hip_device_selftest .............. Passed 0.05 sec Start 44: hip_prefill_mmq_parity 14/14 Test #44: hip_prefill_mmq_parity ........... Passed 0.38 sec 100% tests passed, 0 tests failed out of 14 Total Test time (real) = 1.94 sec Installer: 5 tests passed. HC2/HC1: fast 4096-wide HC agrees over 8 fused steps; PASS in both modes. GLM prefill attention: max absolute error 3.923e-08 (tolerance 5e-5) PASS: empty/masked cells, partial tiles, multiple tiles and head groups ``` The full engine and parity suite were tested on gfx1100 only. Isolated shared/GLM handoff tests also pass on gfx1201; that does not establish full-model support. R9700 enablement and a wider upstream HIP-layer refresh belong in a later PR. Credit [Strata #697](https://github.com/Niko1221/Strata/issues/697) for the companion publication fix. ## Before leaving draft - Complete weight verification, model packing, startup, and real 7900 XT requests; report correctness and measured behavior. Synthetic tests do not prove quantized-expert/draft verification correctness. - Consolidate the HIP setup with `setup.py` helpers (`rocm_root`, `amd_problem`, `build_engine_hip`) where appropriate. The current path duplicates parts of those helpers to select an existing system ROCm installation and Maya's GLM/MMQ build/configuration; this is a known follow-up, not a claim that the duplication is final. - Confirm CUDA builds with the author. CUDA is not available on this test host. hipBLASLt tables are not installed by this path: GLM's dense prompt products currently call hipBLAS directly, and its expert products use GGML MMQ. The inherited hipBLASLt table loader is in the separate Qwen prefill path. Copying a table alone would not tune these GLM calls; compatible dispatch, shapes and parity/performance checks are needed first. See `docs/AMD_UPSTREAM.md`. --- <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#273
No description provided.