Commit 3a03870
cuda: port TQ kernel optimizations from TheTom/llama-cpp-turboquant
mmvq-tq.cu: complete rewrite synced from turboquant PR ggml-org#57
- AMD/ROCm: scalar half path (dp4a regresses on RDNA4) — replaces compute-bound V12 WHT shmem kernel
- NVIDIA: dp4a multi-token path with register-based __byte_perm centroid LUT
- Multi-token support up to ne[1]=8 for speculative decoding (was ne[1]=1 only)
- ggml_cuda_mul_mat_tq4_1s_cublas: large prefill via runtime fp16 dequant + cuBLAS
- Load-time q8_0 conversion now opt-in (GGML_TQ_CONVERT_Q8=1), default off
ggml-cuda.cu dispatch:
- Use ggml_cuda_mul_mat_tq for ne[1]<=8 (was ne[1]==1)
- Add cuBLAS path for large TQ4_1S prefill
fattn-common.cuh: ROCm FA pool OOM bypass
- HIP: raw cudaMalloc/Free for f16 temp buffers instead of pool
- Prevents permanent VRAM retention from peak-size pool allocations
- Fixes OOM when using quantized KV cache on ROCm
fattn.cu: force VEC FA path for quantized KV on HIP
- Prevents TILE/MMA paths from allocating temp f16 buffers for quant KV
- Also enables mixed f16/turbo KV type combinations
turbo-quant.cuh, turbo-innerq.cuh: minor correctness fixes
- Wrap bare cuda*Symbol calls in CUDA_CHECK
- Fix TURBO_IQ_API DLL export macros for static builds
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 90904d3 commit 3a03870
7 files changed
Lines changed: 477 additions & 226 deletions
File tree
- ggml/src/ggml-cuda
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1297 | 1297 | | |
1298 | 1298 | | |
1299 | 1299 | | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
1300 | 1324 | | |
1301 | 1325 | | |
| 1326 | + | |
1302 | 1327 | | |
1303 | 1328 | | |
1304 | 1329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
475 | 488 | | |
476 | 489 | | |
477 | 490 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2469 | 2469 | | |
2470 | 2470 | | |
2471 | 2471 | | |
2472 | | - | |
2473 | | - | |
2474 | | - | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
2475 | 2478 | | |
2476 | 2479 | | |
2477 | 2480 | | |
| |||
0 commit comments