[PR #298] [CLOSED] hip(exl3): implement portable grouped-expert prefill kernels #456

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

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/298
Author: @LostVector
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: feat/exl3-hip-prefill


📝 Commits (2)

  • 1f68e8f experiment(exl3): add portable HIP prefill kernels
  • b51d489 docs: record experimental HIP EXL3 validation and limits

📊 Changes

3 files changed (+177 additions, -5 deletions)

View changed files

➕ docs/EXL3_HIP.md (+48 -0)
📝 src/kernels/cuda/exl3.cu (+125 -5)
📝 tests/exl3_test.cu (+4 -0)

📄 Description

HIP currently compiles exl3::set_gate_up, set_down and gemm_rows as no-ops. This supplies portable prefill kernels so manually configured DeepSeek EXL3 models can actually execute the grouped-expert path on AMD.

The kernels reuse the existing eight-activation block_gemv decoder, handle routed row bounds on the device, apply gate/up scales and clamped SwiGLU, and consume FP16 down/GEMM inputs through a separate adapter. Original decode input structure is preserved. CUDA retains its tensor-core path. This is an FP32 FMA bring-up implementation, not an optimized WMMA port.

Validation on ROCm 7.14.1 / gfx1201:

  • HIP maya-ds4 and exl3_test build successfully.
  • Complete exl3_test passes: 0 failures, 0 launch errors. HIP now runs the previously skipped CPU-reference grouped-expert and FP16-row GEMM cases, including empty experts and row tails. Existing decode/window exactness tests pass.
  • HIP CUDA-name mapping check passes; no new runtime calls.
  • LibertAIDAI/DeepSeek-V4.1-Flash-1017-EXL3-3.5bpw loads on 2 x R9700 32 GB + 16 GB RX 9070-family GPU, TP2 plus singleton, 262144 context. Short and fresh 1K-token prompt smoke tests produce coherent answers.

Practical setup comparison (same fixed synthetic API prompts; one output token, temperature zero, reasoning none, cache_n=0):

Fresh prompt Previous Q8 setup EXL3 setup
1043 tokens A 17.988 s 8.063 s
1043 tokens B 16.698 s 6.975 s
2067 tokens C 19.558 s 10.654 s

Repeated 256-token generation: 18.6 tok/s EXL3 versus 18.2 Q8 (first runs 12.1 versus 13.4). Ryzen 9950X / 256 GB RAM; DS4_SPLIT=36,4, context262144, reserve2048 MiB, explicit RAM experts. Host expert storage is173.1 GB with EXL3 versus237.9 GB in the Q8 setup.

These are setup comparisons, not an isolated quant/kernel A/B: Q8 used abc09c7 plus the optimization in #297; EXL3 used 8d9a9b5, that optimization and these kernels. Quant, expert profile and default chunk size differ (8192 Q8,2048 EXL3). Both setups enable DS4_SKIP_UNPICKED=1; #297 remains a separate PR and is not included here. Unmodified HIP grouped EXL3 prefill is a no-op, so there is no valid EXL3 before/after performance baseline.

Draft / remaining work: independent full-model EXL3 parity and broader quality checks; NVIDIA build/runtime validation; more hardware and shapes; optimized AMD matrix-instruction kernels. Vision and DSpark are disabled in the trial. The installer’s EXL3 HIP rejection stays in place; this PR deliberately does not advertise general setup support. Documentation records the manual launch and validation limits.


🔄 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/298 **Author:** [@LostVector](https://github.com/LostVector) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/exl3-hip-prefill` --- ### 📝 Commits (2) - [`1f68e8f`](https://github.com/mw00/project-maya/commit/1f68e8fe8eab068cabcf7abe55c1be01de98b4a2) experiment(exl3): add portable HIP prefill kernels - [`b51d489`](https://github.com/mw00/project-maya/commit/b51d489de09cfe181c80bfe5fddcd7b5d29dc434) docs: record experimental HIP EXL3 validation and limits ### 📊 Changes **3 files changed** (+177 additions, -5 deletions) <details> <summary>View changed files</summary> ➕ `docs/EXL3_HIP.md` (+48 -0) 📝 `src/kernels/cuda/exl3.cu` (+125 -5) 📝 `tests/exl3_test.cu` (+4 -0) </details> ### 📄 Description HIP currently compiles `exl3::set_gate_up`, `set_down` and `gemm_rows` as no-ops. This supplies portable prefill kernels so manually configured DeepSeek EXL3 models can actually execute the grouped-expert path on AMD. The kernels reuse the existing eight-activation `block_gemv` decoder, handle routed row bounds on the device, apply gate/up scales and clamped SwiGLU, and consume FP16 down/GEMM inputs through a separate adapter. Original decode input structure is preserved. CUDA retains its tensor-core path. This is an FP32 FMA bring-up implementation, not an optimized WMMA port. Validation on ROCm 7.14.1 / gfx1201: - HIP `maya-ds4` and `exl3_test` build successfully. - Complete `exl3_test` passes: **0 failures, 0 launch errors**. HIP now runs the previously skipped CPU-reference grouped-expert and FP16-row GEMM cases, including empty experts and row tails. Existing decode/window exactness tests pass. - HIP CUDA-name mapping check passes; no new runtime calls. - LibertAIDAI/DeepSeek-V4.1-Flash-1017-EXL3-3.5bpw loads on 2 x R9700 32 GB + 16 GB RX 9070-family GPU, TP2 plus singleton, 262144 context. Short and fresh 1K-token prompt smoke tests produce coherent answers. Practical setup comparison (same fixed synthetic API prompts; one output token, temperature zero, reasoning none, `cache_n=0`): | Fresh prompt | Previous Q8 setup | EXL3 setup | | --- | --- | --- | | 1043 tokens A | 17.988 s | 8.063 s | | 1043 tokens B | 16.698 s | 6.975 s | | 2067 tokens C | 19.558 s | 10.654 s | Repeated 256-token generation: 18.6 tok/s EXL3 versus 18.2 Q8 (first runs 12.1 versus 13.4). Ryzen 9950X / 256 GB RAM; `DS4_SPLIT=36,4`, context262144, reserve2048 MiB, explicit RAM experts. Host expert storage is173.1 GB with EXL3 versus237.9 GB in the Q8 setup. **These are setup comparisons, not an isolated quant/kernel A/B:** Q8 used `abc09c7` plus the optimization in #297; EXL3 used `8d9a9b5`, that optimization and these kernels. Quant, expert profile and default chunk size differ (8192 Q8,2048 EXL3). Both setups enable `DS4_SKIP_UNPICKED=1`; #297 remains a separate PR and is not included here. Unmodified HIP grouped EXL3 prefill is a no-op, so there is no valid EXL3 before/after performance baseline. **Draft / remaining work:** independent full-model EXL3 parity and broader quality checks; NVIDIA build/runtime validation; more hardware and shapes; optimized AMD matrix-instruction kernels. Vision and DSpark are disabled in the trial. The installer’s EXL3 HIP rejection stays in place; this PR deliberately does not advertise general setup support. Documentation records the manual launch and validation limits. --- <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:37 +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#456
No description provided.