[PR #201] HIP: enable mixed APU/discrete GPUs and complementary GLM expert helper #395

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

Original Pull Request: https://github.com/mw00/project-maya/pull/201

State: closed
Merged: Yes


Changes

  1. Allow mixed HIP pairs. Remove the discrete-GPU/APU setup rejection, put the discrete GPU first, and load sequentially so the APU budgets memory after the first GPU's pinned RAM tier.
  2. Connect an opt-in GLM expert helper. STRATA_GLM_EXPERT_HELPER=1 selects visible GPU 1; GPU 0 keeps all trunk layers and MTP. A UMA helper aliases the existing pinned RAM tier without another weight copy. Unset the variable to keep the existing path.
  3. Port complementary-cache coordination from Strata PR #578. Primary/helper ownership is exclusive, replacement follows same-layer heat, and the helper performs activation quantization and weighted reduction. All optimizations belong to the helper switch; no separate opt flag.

Enable the helper

For physical GPU 0 = 8060S and GPU 1 = R9700, merge these fields into the existing Maya config, then restart Maya with that config:

{
  "gpu": [1, 0],
  "layer_split": "0",
  "env": {
    "STRATA_GLM_SPLIT": "0",
    "STRATA_GLM_EXPERT_HELPER": "1"
  }
}

Keep the existing pack, context, MTP and memory-budget settings. The GPU order is process-local: R9700 becomes visible GPU 0 (trunk), 8060S becomes visible GPU 1 (helper). The helper value is a device index, not a Boolean. Remove STRATA_GLM_EXPERT_HELPER to disable it; layer split must stay off while the helper is enabled.

Measured results

Radeon AI PRO R9700 32 GiB + Ryzen AI Max+ 395 / Radeon 8060S, Linux, ROCm 10.2.0a20261014.
Maya-S-v2-IQ2_XXS, 65,536 context / 32,768 input / 2,048 output, MTP on, thinking off, greedy.
Medians of three runs after a 4,096/64-token warmup per configuration; zero prompt reuse. Code-generation workload, same binary and inputs throughout.

Configuration Prefill (tok/s) Decode (tok/s) TTFT (s) Total request time (s)
Strix Halo single GPU 138.4 22.6 236.70 327.22
R9700 single GPU 462.6 18.7 70.84 181.00
R9700 + Strix Halo layer split 325.8 27.3 100.58 175.74
R9700 + Strix Halo expert helper 450.6 30.0 72.73 140.97

Helper enabled vs disabled on R9700: +60% decode, 22% less total request time. This is not an isolated A/B of PR #578 against the earlier helper. R9700 single GPU uses host RAM; automatic layer split selected 27/18 layers.

Measurements use 2a3343f (v1.1.10 base); the performance table has not been rerun after the upstream v1.1.12 merge. Generated text differs across modes/repeats; this is a throughput test, not a quality evaluation. Native GGUF only, not EXL3. NVIDIA, Windows and a discrete helper were not validated here.

Validation

  • HIP/CUDA-name mapping check passes.
  • Server suite: 189 tests, 3 skipped. Installer/tools suite: 266 tests, 27 skipped; no failures.
  • Two-GPU helper component test: ownership/admission, replacement and 12 numerical comparisons pass, all max_abs=0.
  • All 12 measured requests reached the exact input/output lengths, reused zero prompt tokens and used MTP drafts.

Upstream sync: merged v1.1.12 main (7f96a3a) in 9246ccb. Resolved the helper-insertion / EXL3-comment conflict while retaining both implementations. The original PR's added/deleted lines are unchanged; the HIP engine build and checks above passed again after the merge.

Reproduction settings and engine evidence

Hardware: 16C/32T AI Max+ 395, 122.7 GiB OS-visible RAM; R9700 PCIe 5.0 x16; 8060S UMA (120 GiB HIP-reported budget); YMTC PC41Q-2TB-B NVMe. One Release HIP binary built for gfx1201;gfx1151 serves all four configurations.

Helper command, from the repository root (MAYA_S_PACK points to the existing pack):

env -u ROCR_VISIBLE_DEVICES HIP_VISIBLE_DEVICES=1,0 \
  STRATA_GLM_EXPERT_HELPER=1 STRATA_GLM_SPLIT=0 \
  STRATA_GLM_PARALLEL_LOAD=0 STRATA_GLM_MTP_DECODE=1 \
  STRATA_GLM_RESERVE_MB=1024 STRATA_GLM_RAM_HEADROOM_GB=16 \
  STRATA_GLM_PREFILL_SUB=1024 STRATA_GLM_PREFILL_MB=6144 \
  STRATA_GLM_NO_REUSE=1 STRATA_GLM_SLOTS=0 \
  STRATA_HIPBLASLT_TUNING=tools/hip/gfx1201-glm-hipblaslt-100202.txt:tools/hip/gfx1151-glm-hipblaslt-100202.txt:tools/hip/gfx1151-glm-hipblaslt-100401.txt \
  ./build-hip-rocm102/strata --serve --glm-pack "$MAYA_S_PACK" \
  --max-context 65536 --prefill auto --parallel 1

The stdin harness sends a 4,096/64 warmup followed by three 32,768/2,048 requests, temperature 0 / seed 1234. Loading and warmup are excluded. Existing tuning tables mismatch the new hipBLASLt version, so all paths used the hipBLASEx fallback; no retuning between runs.

For the R9700 baseline, unset the helper and expose only physical R9700 (ROCR_VISIBLE_DEVICES=1, no HIP mask). For layer split, unset helper and STRATA_GLM_SPLIT, retain HIP_VISIBLE_DEVICES=1,0, and add --layer-split auto. For Strix Halo alone, use both visibility masks 0, unset helper and keep STRATA_GLM_SPLIT=0.

Selected engine evidence (the HIP build logs device labels as CUDA):

glm fast: CUDA0 layers [0,45) expert pool 22.09 GB, 77-77 slots/layer, the draft layer 77 (3311 total)
glm helper: CUDA1 owns 9202 complementary experts in 61.35 GiB of mapped RAM (no extra weight copy); CUDA0 keeps all trunk layers and MTP; prefill unchanged
glm stat: decode 33.32 ms/tok (30.01 tok/s) | vram hit 26.71% | ram fetches 0.00/tok | disk 0.00 reads/tok in 0.00 waits/tok, 0.00 ms/tok | promotions 0.00/tok | cpu lane 0.08/tok in 0.02 ms/tok | prompt 2.2 ms/tok | vram 3182/3311 ram 9202/10239
glm spec: 1284 of 1505 drafts accepted (85.3%)
glm helper: CUDA1 computed 1759265 experts in 299783 routes, 86759.9 ms, 1 cache swaps
**Original Pull Request:** https://github.com/mw00/project-maya/pull/201 **State:** closed **Merged:** Yes --- ## Changes 1. **Allow mixed HIP pairs.** Remove the discrete-GPU/APU setup rejection, put the discrete GPU first, and load sequentially so the APU budgets memory after the first GPU's pinned RAM tier. 2. **Connect an opt-in GLM expert helper.** `STRATA_GLM_EXPERT_HELPER=1` selects visible GPU 1; GPU 0 keeps all trunk layers and MTP. A UMA helper aliases the existing pinned RAM tier without another weight copy. Unset the variable to keep the existing path. 3. **Port complementary-cache coordination from [Strata PR #578](https://github.com/Niko1221/Strata/pull/578).** Primary/helper ownership is exclusive, replacement follows same-layer heat, and the helper performs activation quantization and weighted reduction. All optimizations belong to the helper switch; no separate opt flag. ## Enable the helper For physical GPU 0 = 8060S and GPU 1 = R9700, merge these fields into the existing Maya config, then restart Maya with that config: ```json { "gpu": [1, 0], "layer_split": "0", "env": { "STRATA_GLM_SPLIT": "0", "STRATA_GLM_EXPERT_HELPER": "1" } } ``` Keep the existing pack, context, MTP and memory-budget settings. The GPU order is process-local: R9700 becomes visible GPU 0 (trunk), 8060S becomes visible GPU 1 (helper). The helper value is a **device index**, not a Boolean. Remove `STRATA_GLM_EXPERT_HELPER` to disable it; layer split must stay off while the helper is enabled. ## Measured results Radeon AI PRO R9700 32 GiB + Ryzen AI Max+ 395 / Radeon 8060S, Linux, ROCm `10.2.0a20261014`. Maya-S-v2-IQ2_XXS, **65,536 context / 32,768 input / 2,048 output**, MTP on, thinking off, greedy. Medians of three runs after a 4,096/64-token warmup per configuration; zero prompt reuse. Code-generation workload, same binary and inputs throughout. | Configuration | Prefill (tok/s) | Decode (tok/s) | TTFT (s) | Total request time (s) | |---|---:|---:|---:|---:| | Strix Halo single GPU | 138.4 | 22.6 | 236.70 | 327.22 | | R9700 single GPU | 462.6 | 18.7 | 70.84 | 181.00 | | R9700 + Strix Halo layer split | 325.8 | 27.3 | 100.58 | 175.74 | | R9700 + Strix Halo expert helper | 450.6 | 30.0 | 72.73 | 140.97 | Helper enabled vs disabled on R9700: **+60% decode, 22% less total request time**. This is not an isolated A/B of PR #578 against the earlier helper. R9700 single GPU uses host RAM; automatic layer split selected 27/18 layers. Measurements use `2a3343f` (v1.1.10 base); the performance table has not been rerun after the upstream v1.1.12 merge. Generated text differs across modes/repeats; this is a throughput test, not a quality evaluation. Native GGUF only, not EXL3. NVIDIA, Windows and a discrete helper were not validated here. ## Validation - HIP/CUDA-name mapping check passes. - Server suite: 189 tests, 3 skipped. Installer/tools suite: 266 tests, 27 skipped; no failures. - Two-GPU helper component test: ownership/admission, replacement and 12 numerical comparisons pass, all `max_abs=0`. - All 12 measured requests reached the exact input/output lengths, reused zero prompt tokens and used MTP drafts. **Upstream sync:** merged v1.1.12 main (`7f96a3a`) in `9246ccb`. Resolved the helper-insertion / EXL3-comment conflict while retaining both implementations. The original PR's added/deleted lines are unchanged; the HIP engine build and checks above passed again after the merge. <details> <summary>Reproduction settings and engine evidence</summary> Hardware: 16C/32T AI Max+ 395, 122.7 GiB OS-visible RAM; R9700 PCIe 5.0 x16; 8060S UMA (120 GiB HIP-reported budget); YMTC PC41Q-2TB-B NVMe. One Release HIP binary built for `gfx1201;gfx1151` serves all four configurations. Helper command, from the repository root (`MAYA_S_PACK` points to the existing pack): ```bash env -u ROCR_VISIBLE_DEVICES HIP_VISIBLE_DEVICES=1,0 \ STRATA_GLM_EXPERT_HELPER=1 STRATA_GLM_SPLIT=0 \ STRATA_GLM_PARALLEL_LOAD=0 STRATA_GLM_MTP_DECODE=1 \ STRATA_GLM_RESERVE_MB=1024 STRATA_GLM_RAM_HEADROOM_GB=16 \ STRATA_GLM_PREFILL_SUB=1024 STRATA_GLM_PREFILL_MB=6144 \ STRATA_GLM_NO_REUSE=1 STRATA_GLM_SLOTS=0 \ STRATA_HIPBLASLT_TUNING=tools/hip/gfx1201-glm-hipblaslt-100202.txt:tools/hip/gfx1151-glm-hipblaslt-100202.txt:tools/hip/gfx1151-glm-hipblaslt-100401.txt \ ./build-hip-rocm102/strata --serve --glm-pack "$MAYA_S_PACK" \ --max-context 65536 --prefill auto --parallel 1 ``` The stdin harness sends a 4,096/64 warmup followed by three 32,768/2,048 requests, temperature 0 / seed 1234. Loading and warmup are excluded. Existing tuning tables mismatch the new hipBLASLt version, so all paths used the hipBLASEx fallback; no retuning between runs. For the R9700 baseline, unset the helper and expose only physical R9700 (`ROCR_VISIBLE_DEVICES=1`, no HIP mask). For layer split, unset helper and `STRATA_GLM_SPLIT`, retain `HIP_VISIBLE_DEVICES=1,0`, and add `--layer-split auto`. For Strix Halo alone, use both visibility masks `0`, unset helper and keep `STRATA_GLM_SPLIT=0`. Selected engine evidence (the HIP build logs device labels as CUDA): ```text glm fast: CUDA0 layers [0,45) expert pool 22.09 GB, 77-77 slots/layer, the draft layer 77 (3311 total) glm helper: CUDA1 owns 9202 complementary experts in 61.35 GiB of mapped RAM (no extra weight copy); CUDA0 keeps all trunk layers and MTP; prefill unchanged glm stat: decode 33.32 ms/tok (30.01 tok/s) | vram hit 26.71% | ram fetches 0.00/tok | disk 0.00 reads/tok in 0.00 waits/tok, 0.00 ms/tok | promotions 0.00/tok | cpu lane 0.08/tok in 0.02 ms/tok | prompt 2.2 ms/tok | vram 3182/3311 ram 9202/10239 glm spec: 1284 of 1505 drafts accepted (85.3%) glm helper: CUDA1 computed 1759265 experts in 299783 routes, 86759.9 ms, 1 cache swaps ``` </details>
bsakaguchi 2026-10-29 21:24:59 +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#395
No description provided.