[PR #367] [MERGED] hip: keep Lt tuning locks local to each device (fixes a 2-GPU hang) #493

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

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/367
Author: @Gazelle221B
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @mw00

Base: main ← Head: hip-lt-per-device-lock


📝 Commits (1)

  • 16469ac hip: keep Lt tuning locks local to each device

📊 Changes

1 file changed (+17 additions, -8 deletions)

View changed files

📝 src/ds4/ds4_lt.cu (+17 -8)

📄 Description

Fixes #366.

lt::gemm held the process-wide g_mu while it created a device's handle and workspace, timed candidates and waited on hipEventSynchronize. On a 2-GPU layer split, the downstream GPU's stream can be queued behind a GPU-side wait for the upstream GPU's hand-off. If the downstream worker reaches its first Lt shape first, it keeps g_mu while waiting, and the upstream worker blocks on g_mu and never submits the hand-off.

The change:

  • Dev gets its own mutex, which guards its handle, workspace and picks.
  • g_mu now only guards the store path and appends to the picks file, and is never held across a GPU wait.
  • load_saved takes the store path as an argument instead of reading the global under the lock.

Single-GPU behaviour is unchanged (one device, one lock), and nothing changes on NVIDIA (the file is HIP-only).

Tested on 2x 32 GB AMD GPUs (HIP, gfx1201), DeepSeek-V4.1-Flash Maya-S, automatic 2-GPU split. The runs were on v1.1.21 + #343; this branch is the same one-file change on plain v1.1.21 and compiles cleanly.

Build First 8K prompt Prefill 8K / 32K lt-picks.txt
v1.1.21, Lt on (default) hangs (2 of 2 runs) — not written
v1.1.21, DS4_LT=0 completes 335 / 468 tok/s —
this change, Lt on completes 352 / 500 tok/s written (gfx1201, 100401)

The prefill figures are single profiled samples, so read the +5-7% as indicative only. The main point is that the hang is gone. CI-equivalent checks (HIP mapping check, tools and server tests) passed on the tested tree.

🤖 Generated with Claude Code


🔄 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/367 **Author:** [@Gazelle221B](https://github.com/Gazelle221B) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@mw00](https://github.com/mw00) **Base:** `main` ← **Head:** `hip-lt-per-device-lock` --- ### 📝 Commits (1) - [`16469ac`](https://github.com/mw00/project-maya/commit/16469acb90515469b0c8fbe05f10a422c2ad386b) hip: keep Lt tuning locks local to each device ### 📊 Changes **1 file changed** (+17 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/ds4/ds4_lt.cu` (+17 -8) </details> ### 📄 Description Fixes #366. `lt::gemm` held the process-wide `g_mu` while it created a device's handle and workspace, timed candidates and waited on `hipEventSynchronize`. On a 2-GPU layer split, the downstream GPU's stream can be queued behind a GPU-side wait for the upstream GPU's hand-off. If the downstream worker reaches its first Lt shape first, it keeps `g_mu` while waiting, and the upstream worker blocks on `g_mu` and never submits the hand-off. The change: - `Dev` gets its own mutex, which guards its handle, workspace and picks. - `g_mu` now only guards the store path and appends to the picks file, and is never held across a GPU wait. - `load_saved` takes the store path as an argument instead of reading the global under the lock. Single-GPU behaviour is unchanged (one device, one lock), and nothing changes on NVIDIA (the file is HIP-only). Tested on 2x 32 GB AMD GPUs (HIP, gfx1201), DeepSeek-V4.1-Flash Maya-S, automatic 2-GPU split. The runs were on v1.1.21 + #343; this branch is the same one-file change on plain v1.1.21 and compiles cleanly. | Build | First 8K prompt | Prefill 8K / 32K | `lt-picks.txt` | |---|---|---|---| | v1.1.21, Lt on (default) | hangs (2 of 2 runs) | — | not written | | v1.1.21, `DS4_LT=0` | completes | 335 / 468 tok/s | — | | this change, Lt on | completes | 352 / 500 tok/s | written (gfx1201, 100401) | The prefill figures are single profiled samples, so read the +5-7% as indicative only. The main point is that the hang is gone. CI-equivalent checks (HIP mapping check, tools and server tests) passed on the tested tree. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:26:03 +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#493
No description provided.