2026-11-26 15:40 UTC

Open Maya proposal lets CUDA and HIP GPUs share GLM inference work

state: seedheat: mediumuncertainty: mediumrelevance: highlocal-inference mixed-gpu inference-performanceRenWuJunMaya

What is this?

RenWuJun has proposed an opt-in CUDA+HIP expert helper for Project Maya, an inference project. In the proposed setup, an NVIDIA GPU runs the main CUDA path while a separately built AMD HIP module stores and computes selected GLM model experts; the change is limited to Linux and specific GGUF GLM model shapes. The pull request remains open: Maya’s maintainer praised the approach but said they want to test it on their own mixed-vendor Linux system before considering integration. The developer reports successful builds and tests on one Ubuntu system with a Ryzen AI Max+ 395 and RTX 5090, plus detailed benchmarks. The evidence does not establish broad hardware or model-quality qualification, and this is not yet a merged or generally available Maya feature.

Why it matters

If it works beyond the developer’s rig, this could let people combine GPUs from different vendors for local inference instead of leaving one card idle or being forced into a single-vendor setup. The developer’s earlier two-run comparison reports 45.10 decode tokens/s without speculation for the hybrid setup versus 30.65 for stock CUDA+CPU, but the configurations differed substantially in memory reservation and CPU scheduling, so that is not a clean measure of the helper alone. The latest runs refresh hybrid-only results, not that comparison. The direction is promising; the practical gain, compatibility and quality implications remain uncertain pending independent testing and maintainer review.

Current assessment

What is new: an open pull request (#879) proposes an opt-in, separately compiled HIP helper for Maya’s existing CUDA-based GLM inference path, along with paired setup and launch tooling and an optional cost-based prefill-admission policy. The contributor reports a v1.1.56 rebase, successful builds and tests on one Ubuntu 26.04 setup, and eight benchmark runs on the target rig. In those runs, mean decode throughput was 45.00 tokens/s without speculation, 45.40 with adaptive prefill, 64.35 with built-in MTP2, and 68.90 with DFlash2; the author describes these as hybrid baseline refreshes, not a new stock CUDA+CPU comparison. Earlier v1.1.55 measurements reported 45.10/64.85/69.05 tokens/s for the hybrid modes versus 30.65/32.95/36.80 for stock CUDA+CPU. The contributor explicitly cautions that the comparison used different UMA reservations and CPU scheduling, and that it does not isolate code changes. The opt-in adaptive policy’s separate two-run-per-arm test reported a 15.3% mean gain at 2K prefill, a 1.6% gain at 8K and essentially unchanged decode; the author calls the sample small and says it has not been compared with an optimally selected smaller fixed share. Numerical checks and tests are reported, but broad quality, long-context and other-hardware validation are absent. Maya’s maintainer has not committed to merging the change and wants to test it on another NVIDIA+AMD Linux setup. Track as a promising, technically detailed proposal—not an adopted feature or a general performance guarantee. Its potential significance is making otherwise separate GPU ecosystems work together for local large-model inference; whether that is reliable and broadly usable remains to be established.

Measured heat

now 0 pts/hpeak 0 pts/hcomments 0/hpeers p10momentum: steady2 platformsage 506h
points/hour across evidence · reading as of 2026-11-27 02:23:58.509736+11:00 · deterministic, not a model opinion

How the heat travelled

11-05 13:00⭐ origin echo-reconstructedThe PR is itself the primary artifact: its author describes an opt-in CUDA+HIP helper for running complementary GLM experts across NVIDIA an
RenWuJun on github (echo) · attributed from hn.story.50435181
—
11-10 02:05first on hacker news · published · +109.1hCUDA+ROCm dual-back ends LLM inference for mixed-vendor GPUs (up to 48% faster)
renwujun
—
11-10 02:05amplified on hacker news 👑hn.story.50435181
renwujun
peak 2 · 1 comments · 98% of case engagement
11-10 02:20our radar first saw it · +109.3hdiscovery anchor: hn.story.50435181—
pace: p35 vs 1845 stories at the 336h mark (now 506h old) — ahead of adobe-max-ai-agents-creative-tools-mcp (1.5x), behind 42loop-agent-operated-product-experiment (0.8x)

Evidence (2) — ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnCUDA+ROCm dual-back ends LLM inference for mixed-vendor GPUs (up to 48% faster)
Retrieved article excerpt

Open article · Retrieved 2026-11-10T02:21:33.875894+00:00

## Repository navigation



# GLM: opt-in CUDA+HIP expert helper for mixed-vendor GPUs - #879

#879

Open

[RenWuJun](https://github.com/RenWuJun) wants to merge 6 commits into

[mw00:main](https://github.com/mw00/project-maya/tree/main)mw00/project-maya:mainfrom 

[RenWuJun:hengha/glm-hip-helper](https://github.com/RenWuJun/project-maya/tree/hengha/glm-hip-helper)RenWuJun/project-maya:hengha/glm-hip-helperCopy head branch name to clipboard

Open

## [GLM: opt-in CUDA+HIP expert helper for mixed-vendor GPUs](https://github.com/mw00/project-maya/pull/879#top)#879 [RenWuJun](https://github.com/RenWuJun) wants to merge 6 commits into [mw00:main](https://github.com/mw00/project-maya/tree/main)mw00/project-maya:mainfrom [RenWuJun:hengha/glm-hip-helper](https://github.com/RenWuJun/project-maya/tree/hengha/glm-hip-helper)RenWuJun/project-maya:hengha/glm-hip-helperCopy head branch name to clipboard

## Conversation

[@RenWuJun](https://github.com/RenWuJun)

### @RenWuJun **[RenWuJun](https://github.com/RenWuJun)** commented [Nov 6, 2026](https://github.com/mw00/project-maya/pull/879#issue-6234010420) • edited Loading Uh oh! There was an error while loading. [Please reload this page](https://github.com/mw00/project-maya/pull/879).

Copy link
 

Copy Markdown

I’m adding an opt-in HIP expert helper to Maya’s CUDA engine. I wanted to use the RTX 5090 and the Radeon 8060S in my Strix Halo machine together: CUDA keeps attention, dense/shared layers and its expert cache, while a separately compiled HIP module stores and computes complementary GLM experts.

I’ve kept this contribution focused on the existing GLM engine and its expert-helper path. I haven’t added DeepSeek support or a new inference engine.

### Current upstream integration: v1.1.56

I merged upstream main `7bf15ac68f9bb5026bd5298849608c83be4ff6c2` into this branch with a normal merge, preserving the published history. The three conflicts were in `remote_experts.hpp`, `remote_experts.cpp` and `glm_fast_path.cu`: upstream's native EXL3 helper and asynchronous enqueue/wait changes intersected the external helper interface.

I retained native EXL3/overlap behavior and the plugin's synchronous GGUF dispatch. External EXL3 or native `MAYA_GLM_HELPER_OVERLAP=1` requests now fail explicitly before entering native helper CUDA state. Plugin grouped prefill overlap still works. I added a Release dispatch/setup regression to CI and documented this boundary; there is no new plugin ABI, kernel, SDK or default-policy change.

Fresh CUDA engine and separate CUDA/HIP 7.1 modules build on the rig. Ubuntu server tests pass (793, 33 skipped), as do installer/tools tests (783, 39 skipped), HIP mapping, Release dispatch/reader/cost and upstream CPU fixtures. All 108 real-weight Maya-M expert arrays match the previous HIP 7.1 fixture bitwise. At 1025 tokens with FP16 KV and fixed placement, all three static full-model endpoints match exactly. Adaptive sequential logits also match; adaptive batch/repeat KL is 6.01e-7 / 5.17e-7, with unchanged top token but non-identical values (maximum absolute differences 5.62 / 2.44). Real-engine startup correctly rejects plugin + native-helper overlap before plugin allocation. Native multi-CUDA EXL3/overlap hardware execution remains unqualified here.

I reran the unchanged native `maya.py --bench` twice per mode on Maya-M, 96 GiB UMA, context 9216, upstream INT8 KV and automatic CUDA sizing. Same initial expert profile; static max64/share0.25, adaptive max128/share0.25. MTP2 and DFlash use static prefill. All eight runs pass:

| CUDA+HIP configuration | Mean decode tok/s | Mean 2K prefill tok/s | Mean 8K prefill tok/s |
| --- | --- | --- | --- |
| No speculation, static prefill | 45.00 | 330 | 963 |
| No speculation, adaptive prefill | 45.40 | 380.5 | 977.5 |
| Built-in MTP, 2 fixed drafts | 64.35 | 317.5 | 928 |
| DFlash2, up to 4 drafts | 68.90 | 324 | 949.5 |

Individual repeats (decode / 2K / 8K): no-spec 44.6/330/962 and 45.4/330/964; adaptive 45.4/378/979 and 45.4/383/976; MTP2 64.3/320/930 and 64.4/315/926; DFlash 68.8/324/949 and 69.0/324/950. Sampled device-wide CUDA peaks were 31573–31591 MiB (about 30.84–30.85 GiB). CUDA cache slots were stable within each pair: 2773 no-spec/adaptive, 2696 MTP2, 2658 DFlash. Source/static-library/module/loaded-runtime identities were checked; original builds are preserved.

These are small-sample hybrid baseline refreshes, not a new stock CUDA+CPU comparison. I retained the existing pack to isolate runtime changes; upstream's new F32 router-bias packing fix is included in code but repacking was not exercised. Throughput is not broad quality qualification. The v1.1.55 stock comparisons and earlier validation below remain historical.

### Implementation

- Reuse `GlmExpertHelper`, existing CUDA/HIP expert kernels, prefill staging and result combination. A small versioned C ABI passes host data and opaque contexts; allocations, device ordinals and runtime handles stay within their owning runtime.
- Add bounded persistent expert storage, generation-checked uploads/replacement, serialized completion and error propagation. Optional mapped input/result buffers use the helper runtime's own allocation.
- Optional weight readback feeds CUDA prefill. Optional grouped helper execution overlaps a bounded share of expert rows with CUDA work; the tested 25% setting is an admission cap, not a fixed compute-time split. Selected experts and routing weights are preserved.
- Add optional cost-based prefill admission using existing completion events and observed helper/staging costs; keep static admission as the default.
- Include prefill reader lifetime/error-handling fixes, standalone executor fixtures, a Release reader regression in CI, and build/settings documentation. Primary CUDA VRAM sizing remains Maya's native automatic policy.

The plugin, readback and grouped prefill are opt-in. Current scope is Linux, one primary GPU, native GGUF GLM experts with width 4096, intermediate width 2048 and at most eight routes. Unsupported plugin configurations fail explicitly. Windows, EXL3, other model shapes, primary/helper hot-expert exchange are outside this PR. Cost-based prefill admission is an additional opt-in policy described below.

### Setup and launch

I also added `setup-cuda-hip.sh` because ordinary setup selects one engine backend at a time. Maya already keeps ordinary CUDA and HIP builds in separate directories; this script prepares a matched CUDA engine and external HIP executor for one configuration.

On Ubuntu 26.04 x86\_64, the guided entry point is:

```
./setup-cuda-hip.sh
```

It offers missing Ubuntu build dependencies through apt/sudo, installs Python/CMake/Ninja into Maya's private environment, and prompts for the GLM config, HIP device and budget. If no CUDA GLM config exists, it calls normal Maya model setup first. Existing configs can use `--install-deps --yes --config ... --hip-device ... --helper-mib ...` to install dependencies and build sequentially in one command. `--deps-plan` previews missing system packages. Working drivers/device permissions remain prerequisites; no graphics driver or external repository installation is automated. Other Linux systems can use preinstalled dependencies.

The helper budget must fit actual HIP runtime memory; `--check` validates without installing/building, and `--no-start` builds/configures without starting the dashboard. BIOS UMA size alone is not the HIP runtime allocation limit.

- Each setup builds in a fresh `build-cuda-hip/pair-*/` directory, with separate engine/module outputs and a manifest. It preserves ordinary builds and previous pairs, and publishes the new config only after both builds succeed.
- The generated launcher supports normal Maya startup, `--bench` and `--report`. Model/drafter, sampling and serving choices are retained. The Models page labels it **CUDA + HIP**; the live GPU monitor still charts the CUDA primary only.
- Startup verifies source/artifact identities and available HIP memory. A source update requires rebuilding the pair rather than refreshing only CUDA. CUDA and HIP ordinals are kept separate, CPU-lane calibration is skipped, and unsupported dashboard edits are rejected before saving.

I tested the actual bash setup, separate builds and generated launcher on the Ubuntu rig. A one-token HTTP smoke passed with both CUDA and HIP runtimes loaded; old stock/hybrid binaries retained their hashes. The setup correctly rejected the old 90 GiB helper budget after the BIOS change. The dependency follow-up was exercised in a fresh source folder and Python environment using the rig's existing compilers. Missing-package installation is covered by mocked package-manager tests and an actual apt simulation, not a clean-OS install. This is lifecycle validation, not a new performance benchmark.

Build prerequisites and all options: [paired setup guide](https://github.com/RenWuJun/project-maya/blob/06e4c81a387e63382203701b03347213ff550839/docs/EXPERT_PLUGIN.md).

I addressed two preflight review findings: the selected HIP runtime device is matched by PCI identity to KFD/DRM architecture metadata, and its target is selected automatically; an explicit `--hip-arch` must match. Preflight also reads the pack's source GGUF header and checks the helper's supported geometry before compiling. Launch validation repeats these checks. Native gfx1151/Maya-M preflight and existing-pair validation pass, and an explicit gfx1100 mismatch is rejected. These are configuration checks, not new inference performance measurements. Other GPU architectures remain unqualified on hardware. The 38 focused tests also pass on macOS; a broader Mac suite run encountered platform/environment failures, while the full Ubuntu tools suite passes.

### Historical v1.1.55 native benchmark

I benchmarked against upstream main v1.1.55 (`c4effee67cb95fb4303720919b075fddf04b4e69`). Ryzen AI Max+ 395, 128 GB unified RAM, RTX 5090 32 GB over **PCIe 4.0 x4 OCuLink**, Ubuntu, CUDA 13.1 / HIP 7.1. GLM-5.3-Flash-Maya-M IQ2\_S, context 9216, native INT8 KV. Unchanged `maya.py --bench`, greedy/thinking off, three answers up to 256 tokens, native warm-ups, two repeats per mode.

| Configuration | Decode tok/s | 2K prefill tok/s | 8K prefill tok/s |
| --- | --- | --- | --- |
| Stock CUDA+CPU, no speculation | 30.65 | 213.5 | 771.5 |
| CUDA+HIP, no speculation | **45.10** | **332** | **969** |
| Stock CUDA+CPU, built-in MTP2 | 32.95 | 209 | 752.5 |
| CUDA+HIP, built-in MTP2 | **64.85** | **321** | **932.5** |
| Stock CUDA+CPU, DFlash2 up to 4 drafts | 36.80 | 213.5 | 768.5 |
| CUDA+HIP, DFlash2 up to 4 drafts | **69.05** | **321.5** | **954** |

**Comparison limit:** stock used a 4 GiB UMA reservation and 119 GiB host RAM with native CPU/RAM scheduling; hybrid used 96 GiB UMA with CPU expert computation disabled. These are practical configurations with different memory reservations and settings, not a code-only A/B. Both used automatic CUDA cache sizing, the same model/tokenizer/start profile, and identical prefill prompt tokens. Stock CPU work and its native DFlash two-lane verification were active. Sampled peak total CUDA usage was approximately 31.0 GiB stock and 30.84 GiB hybrid. All 12 runs exited successfully.

### Opt-in cost-based prefill admission (v1.1.55 measurements)

I also measured an adaptive policy on the same HIP 7.1 fixture. With `STRATA_GLM_HELPER_COST=1`, the scheduler uses recent helper worker time per row and CUDA staging time per MiB to limit helper admission. It reuses existing CUDA events after the next routing synchronization, without an additional GPU wait. The existing share and result-buffer bounds remain; the estimator and its 15% headroom are heuristics. Static admission remains the default.

This is a separate static-versus-adaptive comparison on the CUDA+HIP implementation: Maya-M, 96 GiB UMA, context 9216, native INT8 KV, automatic CUDA pool, MTP/speculation off, unchanged native `--bench`. The control uses a 64-row per-exper
renwujun21
🟧 echo.github ⭐The PR is itself the primary artifact: its author describes an opt-in CUDA+HIP helper for running complementary GLM experts across NVIDIA anRenWuJun——

Interpretation history

Decision trace