[HIP] Device buffer pool + right-sized GEMV blocks (decode perf)

DeviceBuf::alloc/Drop now reuse freed buffers via a thread-local size-bucketed
free list instead of hipMalloc/hipFree per intermediate (~1200 alloc/free per
token). Safe: all launches share the default stream and host copies are blocking,
so a recycled buffer's prior use is ordered before its next launch. Escape hatch
VETTA_NO_BUF_POOL=1. nvfp4_gemv 256->128 threads (K/16=144 groups: half the waves
were idle), mxfp8_gemv 256->64 (K/32<=72 groups); cheaper block reduction.

MEASURED (gfx1150 release, GEN 64): decode 269ms/tok -> 234ms/tok (3.72->4.27
tok/s, ~15%). Parity unchanged: 18 ld GPU + 17 hip GPU green. Profiling shows the
remaining hotspot is the scalar-dequant expert GEMV (~87ms/tok) — the fdot2
hardware-dot + device-resident blocks + hipGraph path is the next big lever.
This commit is contained in:
adm committed 2026-12-01 17:27:07 +01:00
1 parent 0a46c4dd7b
commit 4bc268f69c
2 files changed
+31 -3

No files matched your search

+2 -2
View File
@@ -586,7 +586,7 @@ extern "C" int vetta_nvfp4_gemv(const uint8_t* packed, const uint8_t* scales,
int N, int K, vetta_stream_t stream) {
if (N <= 0 || K <= 0 || (K % 16) != 0) return 1;
hipStream_t s = stream ? (hipStream_t)stream : (hipStream_t)0;
k_nvfp4_gemv<<<N, 256, 0, s>>>(packed, scales, outer_scale, x, y, N, K);
k_nvfp4_gemv<<<N, 128, 0, s>>>(packed, scales, outer_scale, x, y, N, K);
HIP_CHECK(hipGetLastError());
return 0;
}
@@ -683,7 +683,7 @@ extern "C" int vetta_mxfp8_gemv(const uint8_t* weights, const uint8_t* scales,
vetta_stream_t stream) {
if (N <= 0 || K <= 0 || (K % 32) != 0) return 1;
hipStream_t s = stream ? (hipStream_t)stream : (hipStream_t)0;
k_mxfp8_gemv<<<N, 256, 0, s>>>(weights, scales, x, y, N, K);
k_mxfp8_gemv<<<N, 64, 0, s>>>(weights, scales, x, y, N, K);
HIP_CHECK(hipGetLastError());
return 0;
}