Skip to content

Commit 3e02da7

Browse files
kmbandyclaude
andcommitted
fix(weight-pager): guard cross-layer prefetch behind GGML_USE_HIP
The WP_PREFETCH_XLAYER cross-layer router-prefetch block (off by default) was added without a backend guard, but it uses HIP-only symbols — current_hip_device / ggml_cuda_get_wp_compute_stream (declared only under GGML_USE_HIP) and raw hip* device copies. It compiled on the HIP build (R9700/6900xt) but broke build-army's CUDA sm_61 compile with "hipStream_t was not declared" etc., which blocked mad-lab-2026 (1070 CUDA + 480 Vulkan) from building master. Weight paging is an RDNA/HIP feature and the non-HIP cards don't page weights, so wrap the block in #if defined(GGML_USE_HIP). HIP builds are byte-identical (block unchanged inside the guard); CUDA/Vulkan builds compile it out. Verified build-hip still links clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GxHFe5y6ACxqFmFFzDBwtg
1 parent 9a65e05 commit 3e02da7

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/weight-pager/wp-eval-cb.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,12 @@ bool weight_pager_eval_cb(struct ggml_tensor * t, bool ask, void * user_data) {
335335
if (!ask) return true;
336336

337337
// --- Cross-layer prefetch (WP_PREFETCH_XLAYER), gated OFF by default -----
338+
// HIP-only: weight paging is an RDNA/HIP feature (R9700, 6900xt) and this
339+
// block uses the HIP-gated side channel (current_hip_device /
340+
// ggml_cuda_get_wp_compute_stream, declared only under GGML_USE_HIP) plus
341+
// raw hip* device copies. Non-HIP builds (CUDA sm_61 / Vulkan on the 1070
342+
// and 480) don't page weights, so compile it out there.
343+
#if defined(GGML_USE_HIP)
338344
// At the ffn_gate_inp router MUL_MAT (start of each MoE block): src[0] is
339345
// the router weight (host-copied once per layer), src[1] is the residual
340346
// `cur` (== the expert input). Predict layers L+1..L+K's experts from `cur`
@@ -421,6 +427,7 @@ bool weight_pager_eval_cb(struct ggml_tensor * t, bool ask, void * user_data) {
421427
}
422428
}
423429
}
430+
#endif // GGML_USE_HIP — cross-layer prefetch (weight paging is HIP/RDNA-only)
424431
const bool eval_debug = eval_debug_enabled();
425432
const uint64_t sync_fallbacks_before =
426433
batch_eval_cb ? pager->sync_fallback_count() : 0;

0 commit comments

Comments
 (0)