Repository navigation
cuda: hopper wgmma path review follow-up (multi-GPU correctness + hardening) - #45
Conversation
- repack cache: key on (device, wdata, N, K, wbits) with a mutex (ggml may dispatch from one host thread per device), and publish entries only after a one-time stream sync so consumers on other streams cannot observe uninitialized dense buffers - per-device attr_set / SM count (a second GPU previously skipped the dynamic-SMEM opt-in and inherited device 0's SM count) - CUDA_CHECK on allocations and attribute calls - defensive int8 clamp in the activation quantizer (unreachable in exact arithmetic; insurance against fp rounding at the boundary) - CMake: target-scoped compile definitions/includes/options instead of directory-wide; option help text covers Q2_0
Perf proof: pre-fix vs post-fix vs stock (same pod, same build flags)H100 SXM 80GB HBM3, single GPU. Pre-fix = the #39 merge commit ( 1-bit test model (Q1_0)
Ternary test model (Q2_0)
Correctness
Reading
|
|
Independent multi-GPU / multi-arch sweep of this branch (3 pods, all legs green): 2x H100 SXM5 — the multi-GPU fixes under real dual-GPU load (the gap called out in the PR; previously single-GPU-verified only):
L40S (sm_89) — no-regression check: builds clean without H200 — additional Hopper datapoint: wgmma path correct, +5.9–6.9% over MMQ at pp4096; ≈H100 absolute (prefill compute-bound; the extra HBM bandwidth doesn't move it at these shapes). Raw bench output available internally on request. LGTM from this side — merge-ready. |
What
Review follow-up for #39 (merged): multi-GPU correctness and hardening for the Hopper wgmma
path, plus a wholesale clang-format of the file. Fixes originate from the post-merge triage of
Copilot's inline review comments.
Fixes
(device, wdata, N, K, wbits)instead of the bare weight pointer(ambiguous across devices/views), guarded by a mutex (ggml can dispatch from one host thread
per device), and entries publish only after a one-time
cudaStreamSynchronize— a consumerGEMM on a different stream previously had no ordering dependency on the repack kernel and
could read uninitialized dense buffers.
attr_set/ SM count: a second GPU previously skipped the dynamic-SMEM opt-in(launch failure) and inherited device 0's SM count (wrong stream-K grid).
CUDA_CHECKon allocations and attribute/device queries.maps |x| <= amax to <= 127 — insurance against fp rounding at the boundary).
target_*-scoped compile definitions/includes/options for the opt-in instead ofdirectory-wide; option help text covers Q2_0.
Verification (H100 SXM 80GB HBM3, single GPU)
-DGGML_CUDA_HOPPER_Q1=ON -DGGML_CUDA_CUTLASS_DIR=...: clean (exercises thenew target-scoped wiring)
test-backend-ops -o MUL_MATq1_0+q2_0: 86/86 OK — re-run after the clang-format commit too(mutex is off the hot path; the stream sync is once per tensor)
The multi-GPU changes are code-reviewed but verified on a single GPU only — no multi-GPU
Hopper box was available. The cache key, per-device attrs, and SM-count fixes are
straightforwardly correct by construction; flagging for whoever runs the next multi-GPU sweep.