Commit 7a64374
fix(ggml-cuda): restore fork build portability across CUDA + HIP backends
The fork's ggml-cuda failed to build on the CUDA host (nvcc, GGML_CUDA=ON)
and on gfx803/HIP — AMD-only vocabulary and a missing warp-sync shim had
leaked into shared/core files. Backend-portability only; no quant math changed.
- set-rows.cu: fp8 e4m3 device decode used __builtin_amdgcn_ldexp
unconditionally (undefined under nvcc). Guard #if GGML_USE_HIP (amdgcn) /
#else portable ldexpf — identical numerics, AMD codegen unchanged.
- turbo_fp8_hadamard.cuh: mt_turbo_fp8_fwht{,_half} declared with raw
hipError_t/hipStream_t, tripping CUDA_CHECK (cudaError_t) at ml8.cu:1533.
Switch to CUDA vocabulary; vendors/hip.h remaps it back to hip* under HIP.
- vendors/hip.h:
* add cudaErrorInvalidValue -> hipErrorInvalidValue remap (needed above).
* add __syncwarp(...) -> __builtin_amdgcn_wave_barrier() shim, beside the
existing __shfl_*_sync shims. __syncwarp is undeclared in the HIP
toolchain for TUs that don't pull it in (e.g. mt_pagedattn_decode.cu);
the shim makes that warp barrier portable WITHOUT editing that file, and
PRESERVES the call on every arch incl. RDNA4 (gfx1201).
Verified:
- CUDA sm_61 (GTX 1070): full llama-server links + runs on-GPU (token output).
- HIP gfx803 / ROCm 6.4 (RX 480): full llama-server links + runs on-GPU
(turbo4 KV, 6.18 GB VRAM, token output).
- mt_pagedattn_decode.cu + fattn-vec compile clean for gfx803 AND gfx1201
(-fsyntax-only); RDNA4 WMMA decode path unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent a90b4dd commit 7a64374
3 files changed
Lines changed: 20 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1167 | 1167 | | |
1168 | 1168 | | |
1169 | 1169 | | |
| 1170 | + | |
1170 | 1171 | | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
1171 | 1175 | | |
1172 | 1176 | | |
1173 | 1177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
180 | | - | |
| 179 | + | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
| 90 | + | |
85 | 91 | | |
86 | 92 | | |
87 | 93 | | |
| |||
0 commit comments