[PR #2] [MERGED] Fix HIP doorbell publication and KDA parity initialization #274

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/2
Author: @boxwrench
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/8/2026
Merged by: @mw00

Base: main ← Head: amd/hip-handoff-fences


📝 Commits (1)

  • 71b8d47 Fix HIP doorbell publication and initialize KDA test state

📊 Changes

5 files changed (+155 additions, -2 deletions)

View changed files

📝 CMakeLists.txt (+4 -0)
📝 src/kernels/cuda/elementwise.cu (+7 -1)
📝 src/kernels/cuda/glm_fast.cu (+5 -0)
📝 src/kernels/glm_kda_parity.cpp (+3 -1)
➕ tests/hip/glm_handoff.cpp (+136 -0)

📄 Description

AMD host polling can stall when the GPU publishes a mapped-memory sequence counter but that store remains in its cache. Backport the publication fix from Strata #697 to the shared doorbells and Maya's own GLM routing signal.

Changes

  • Retain the payload fences and add a HIP-only system fence after each signal store in doorbell_ring_kernel, doorbell_publish_kernel, and moe_route_kernel.
  • Make the ring store volatile, matching upstream Strata. This is the one production change also visible to CUDA builds; the added fences are guarded by __HIPCC__.
  • Register hip_glm_handoff: replay the actual captured routing graph for 100 disk requests and 100 CPU-lane requests, checking changing IDs, weights, input payloads and host answers. The CPU polls the signal without a driver query or synchronization before answering.
  • Initialize the KDA parity fixture's recurrence state with cudaMemset, as its CPU reference already assumes. Keep its numerical tolerance unchanged.

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 current Maya 1.3.0, 70e0746. The HIP binaries used the compatibility fixes from the companion Linux HIP setup draft (#3); this PR does not claim to repair all existing GLM HIP compilation blockers by itself.

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 '^(hip_handoff|hip_glm_handoff|glm_kda_parity)$'
Internal ctest changing into directory: /ai/github/project-maya/build-hip
Test project /ai/github/project-maya/build-hip
    Start  4: hip_handoff
1/3 Test  #4: hip_handoff ......................   Passed    0.47 sec
    Start  5: hip_glm_handoff
2/3 Test  #5: hip_glm_handoff ..................   Passed    0.08 sec
    Start 17: glm_kda_parity
3/3 Test #17: glm_kda_parity ...................   Passed    0.06 sec

100% tests passed, 0 tests failed out of 3

Total Test time (real) =   0.61 sec

Both the shared handoff test and the actual GLM routing handoff also pass as isolated gfx1201 binaries on an AI PRO R9700. Full-engine validation was on gfx1100 only; no R9700 model support is enabled here.

CUDA was not compile-checked: this machine has no nvcc. Please build CUDA once before merging. No full 321B model inference or throughput claim is made.


🔄 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/2 **Author:** [@boxwrench](https://github.com/boxwrench) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/8/2026 **Merged by:** [@mw00](https://github.com/mw00) **Base:** `main` ← **Head:** `amd/hip-handoff-fences` --- ### 📝 Commits (1) - [`71b8d47`](https://github.com/mw00/project-maya/commit/71b8d47b8664f66f6a55cb05f46f31ca92b8c86e) Fix HIP doorbell publication and initialize KDA test state ### 📊 Changes **5 files changed** (+155 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+4 -0) 📝 `src/kernels/cuda/elementwise.cu` (+7 -1) 📝 `src/kernels/cuda/glm_fast.cu` (+5 -0) 📝 `src/kernels/glm_kda_parity.cpp` (+3 -1) ➕ `tests/hip/glm_handoff.cpp` (+136 -0) </details> ### 📄 Description AMD host polling can stall when the GPU publishes a mapped-memory sequence counter but that store remains in its cache. Backport the publication fix from [Strata #697](https://github.com/Niko1221/Strata/issues/697) to the shared doorbells and Maya's own GLM routing signal. ## Changes - Retain the payload fences and add a HIP-only system fence after each signal store in `doorbell_ring_kernel`, `doorbell_publish_kernel`, and `moe_route_kernel`. - Make the ring store volatile, matching upstream Strata. This is the one production change also visible to CUDA builds; the added fences are guarded by `__HIPCC__`. - Register `hip_glm_handoff`: replay the actual captured routing graph for 100 disk requests and 100 CPU-lane requests, checking changing IDs, weights, input payloads and host answers. The CPU polls the signal without a driver query or synchronization before answering. - Initialize the KDA parity fixture's recurrence state with `cudaMemset`, as its CPU reference already assumes. Keep its numerical tolerance unchanged. ## 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 current Maya 1.3.0, `70e0746`. The HIP binaries used the compatibility fixes from the companion Linux HIP setup draft (#3); this PR does not claim to repair all existing GLM HIP compilation blockers by itself. ```sh 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 '^(hip_handoff|hip_glm_handoff|glm_kda_parity)$' ``` ```text Internal ctest changing into directory: /ai/github/project-maya/build-hip Test project /ai/github/project-maya/build-hip Start 4: hip_handoff 1/3 Test #4: hip_handoff ...................... Passed 0.47 sec Start 5: hip_glm_handoff 2/3 Test #5: hip_glm_handoff .................. Passed 0.08 sec Start 17: glm_kda_parity 3/3 Test #17: glm_kda_parity ................... Passed 0.06 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 0.61 sec ``` Both the shared handoff test and the actual GLM routing handoff also pass as isolated gfx1201 binaries on an AI PRO R9700. Full-engine validation was on gfx1100 only; no R9700 model support is enabled here. CUDA was **not compile-checked**: this machine has no `nvcc`. Please build CUDA once before merging. No full 321B model inference or throughput claim is made. --- <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#274
No description provided.