[PR #1752] [CLOSED] HIP: keep the old file-tier cache rule on AMD + build without CUDA toolkit (#1691) #3650

Closed
opened 2026-11-07 15:29:49 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1752
Author: @KevinX8
Created: 10/9/2026
Status: ❌ Closed

Base: main ← Head: fix-1691-hip-filetier-pin


📝 Commits (2)

  • e113879 HIP: keep the old file-tier cache rule (read unbuffered unless the cache holds every read byte) (#1691)
  • 7db06ea Build without a CUDA toolkit: skip the CUDA-only TUs (W4A4, qwen35 engine) when there is no CUDA compiler

📊 Changes

2 files changed (+18 additions, -0 deletions)

View changed files

📝 CMakeLists.txt (+12 -0)
📝 src/core/expert_source.cpp (+6 -0)

📄 Description

Bisected the gfx906 prompt stalls and 0.1.41 verify timeouts to 805088d (#1194); full story in #1691. Now rebased onto v0.1.44.1 (two commits).

Commit 1 - the fix (HIP builds only, 6 lines, one file): keep the pre-#1194 rule in file_tier_unbuffered - read the file tier unbuffered unless the page cache can hold every read byte. The 5%-of-read-bytes rule stays everywhere else.

Why: on ROCm the expert arena is HMM-tracked but unpinned (VmPin 0 after hipHostRegister). Cached file-tier reads churn the page cache, reclaim unmaps the arena's pages, and KFD suspends all of the process's GPU queues (measured: up to 45 of 60 s suspended while idle, 7-26 s per prompt). Past 60 s the watchdog kills the engine. On a 60 GB box with a 43 GiB resident budget the new rule picks the cached path (12.4 GiB of experts read from files, ~4-6 GiB of cache room); 0.1.40 read unbuffered there.

Commit 2 - build fix (CMake only, no engine sources): stock v0.1.44.x does not compile for gfx906 on a ROCm-only box. Two new unconditional TUs need the CUDA toolkit: strata_mmq_w4a4 (needs cuda_runtime.h/cublas; RTX-50-only with runtime W4A8 fallback) and strata_qwen35 (raw cublas calls, runs only for qwen35moe models; generate.cpp already guards STRATA_HAVE_QWEN35). Both are now gated on CMAKE_CUDA_COMPILER, so CUDA builds are unaffected and ROCm-only builds work again.

Measured on 1x MI50 16 GB (gfx906), ROCm 10.1, 60 GB RAM, budget 43 GiB, v0.1.44.1 + these changes, standard 256k config: file tier reads unbuffered; prompt 1 (cold, 6734 tokens) 61 tok/s, prompt 2 273 tok/s warming to ~300 tok/s on synthetic uniform-random-word prompts (which route across all experts and defeat the profile-ranked RAM copy); coherent real-world prompts (source code) reach 330+ tok/s on the same build. a same-session back-to-back A/B (forced restarts, identical prompts) gives 0.1.43+PR 286/297 tok/s vs 0.1.44.1+PR 276/289 tok/s with identical 25.7 tok/s decode - no version gap, the earlier 356-365 figures were quieter-box runs. 300-token story 260 tok/s prefill / 26.5 tok/s decode; 0 watchdog stalls / 0 verify timeouts. (The 0.1.43-based revision of the rule change gave 356-365 tok/s prompts on the same box; prompt 1 here carries first-request warm-up. Stock 0.1.44.1 on the same box: 18-62 tok/s, engine dead on prompt 2 - see #1691 for the proof run.)

Not fixed by this change: while a large RAM hog is actively running with no request in flight, the GPU is still suspended for most of that window (the #1705/#750 pressure case); the next request after it is unaffected.


🔄 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/Niko1221/Strata/pull/1752 **Author:** [@KevinX8](https://github.com/KevinX8) **Created:** 10/9/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-1691-hip-filetier-pin` --- ### 📝 Commits (2) - [`e113879`](https://github.com/Niko1221/Strata/commit/e1138792b380568c791771e0425646de73f20f78) HIP: keep the old file-tier cache rule (read unbuffered unless the cache holds every read byte) (#1691) - [`7db06ea`](https://github.com/Niko1221/Strata/commit/7db06ea1e64614717907f76aa6fadb580b2b10d9) Build without a CUDA toolkit: skip the CUDA-only TUs (W4A4, qwen35 engine) when there is no CUDA compiler ### 📊 Changes **2 files changed** (+18 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+12 -0) 📝 `src/core/expert_source.cpp` (+6 -0) </details> ### 📄 Description Bisected the gfx906 prompt stalls and 0.1.41 verify timeouts to 805088d (#1194); full story in #1691. Now rebased onto v0.1.44.1 (two commits). **Commit 1 - the fix (HIP builds only, 6 lines, one file):** keep the pre-#1194 rule in `file_tier_unbuffered` - read the file tier unbuffered unless the page cache can hold every read byte. The 5%-of-read-bytes rule stays everywhere else. **Why:** on ROCm the expert arena is HMM-tracked but unpinned (VmPin 0 after hipHostRegister). Cached file-tier reads churn the page cache, reclaim unmaps the arena's pages, and KFD suspends all of the process's GPU queues (measured: up to 45 of 60 s suspended while idle, 7-26 s per prompt). Past 60 s the watchdog kills the engine. On a 60 GB box with a 43 GiB resident budget the new rule picks the cached path (12.4 GiB of experts read from files, ~4-6 GiB of cache room); 0.1.40 read unbuffered there. **Commit 2 - build fix (CMake only, no engine sources):** stock v0.1.44.x does not compile for gfx906 on a ROCm-only box. Two new unconditional TUs need the CUDA toolkit: `strata_mmq_w4a4` (needs cuda_runtime.h/cublas; RTX-50-only with runtime W4A8 fallback) and `strata_qwen35` (raw cublas calls, runs only for qwen35moe models; generate.cpp already guards `STRATA_HAVE_QWEN35`). Both are now gated on `CMAKE_CUDA_COMPILER`, so CUDA builds are unaffected and ROCm-only builds work again. **Measured on 1x MI50 16 GB (gfx906), ROCm 10.1, 60 GB RAM, budget 43 GiB, v0.1.44.1 + these changes, standard 256k config:** file tier reads unbuffered; prompt 1 (cold, 6734 tokens) 61 tok/s, prompt 2 273 tok/s warming to ~300 tok/s on synthetic uniform-random-word prompts (which route across all experts and defeat the profile-ranked RAM copy); coherent real-world prompts (source code) reach 330+ tok/s on the same build. a same-session back-to-back A/B (forced restarts, identical prompts) gives 0.1.43+PR 286/297 tok/s vs 0.1.44.1+PR 276/289 tok/s with identical 25.7 tok/s decode - no version gap, the earlier 356-365 figures were quieter-box runs. 300-token story 260 tok/s prefill / 26.5 tok/s decode; 0 watchdog stalls / 0 verify timeouts. (The 0.1.43-based revision of the rule change gave 356-365 tok/s prompts on the same box; prompt 1 here carries first-request warm-up. Stock 0.1.44.1 on the same box: 18-62 tok/s, engine dead on prompt 2 - see #1691 for the proof run.) **Not fixed by this change:** while a large RAM hog is actively running with no request in flight, the GPU is still suspended for most of that window (the #1705/#750 pressure case); the next request after it is unaffected. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:29:49 +07:00
Sign in to join this conversation.
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
Niko1221/Strata#3650
No description provided.