Skip to content

Commit 0181de2

Browse files
TheTomclaude
authored andcommitted
fix(ggml-cuda): HIP nodiscard + MUSA cudaMemcpyToSymbol alias
Two CI build failures both pre-existing on TQ tip, exposed by upstream-policy CI on PR TheTom#146: 1. ubuntu-22-hip-quality-check — fattn-common.cuh:1312-1313 in TQ's HIP hip_f16_alloc destructor calls hipStreamSynchronize / hipFree without consuming the return value. HIP's recent runtime declares these [[nodiscard]] and the HIP quality build uses -Werror: error: ignoring return value of type 'hipError_t' declared with 'nodiscard' attribute [-Werror,-Wunused-value] Fix: (void) cast both calls. We're in a destructor and can't propagate errors anyway; intent is fire-and-forget cleanup. Matches the idiom used in upstream code for the same situation. 2. ubuntu-22-musa — turbo-quant.cuh uses cudaMemcpyToSymbol in InnerQ calibration; MUSA's vendor header (vendors/musa.h) aliases every other cudaMemcpy* variant but missed cudaMemcpyToSymbol. Result on MUSA build: error: use of undeclared identifier 'cudaMemcpyToSymbol'; did you mean 'musaMemcpyToSymbol'? Fix: add the missing alias next to the other cudaMemcpy* defines. Mirrors the same alias already present in vendors/hip.h:143. Both are TQ-only paths (HIP f16 alloc was added in 0757ff4 2026-04-18; MUSA was never built against TQ in-tree). M5 Max + M2 mini local Metal builds unaffected by either change. Flagged by @pacak on PR TheTom#146 (ubuntu-latest-cuda + cross-vendor CI fails). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-Authored-By: tturney@psyguard.ai
1 parent acfc75e commit 0181de2

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

ggml/src/ggml-cuda/fattn-common.cuh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,8 +1309,10 @@ void launch_fattn(
13091309
hip_f16_alloc(cudaStream_t s) : stream(s) {}
13101310
~hip_f16_alloc() {
13111311
if (ptr) {
1312-
cudaStreamSynchronize(stream);
1313-
cudaFree(ptr);
1312+
// Cast to void: hipStreamSynchronize / hipFree are [[nodiscard]] under
1313+
// HIP's -Werror policy; we're in a destructor and can't propagate errors.
1314+
(void) cudaStreamSynchronize(stream);
1315+
(void) cudaFree(ptr);
13141316
}
13151317
}
13161318
void alloc(size_t nelements) {

ggml/src/ggml-cuda/vendors/musa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
#define cudaMemcpyDeviceToHost musaMemcpyDeviceToHost
7878
#define cudaMemcpyHostToDevice musaMemcpyHostToDevice
7979
#define cudaMemcpyKind musaMemcpyKind
80+
#define cudaMemcpyToSymbol musaMemcpyToSymbol
8081
#define cudaMemset musaMemset
8182
#define cudaMemsetAsync musaMemsetAsync
8283
#define cudaMemGetInfo musaMemGetInfo

0 commit comments

Comments
 (0)