libquant: GPTQ's factorisations through LAPACK where OpenBLAS is found; one layer's factor at a time

At K = 21504 (a dense 27B's down projection) the single-threaded Cholesky and inverse took hours
a layer; dpotrf / dpotri take 13.5 s for all three on 24 cores, identical to 1e-14. Without
OpenBLAS nothing changes. The factor cache kept every layer's factor, 3.7 GB each at that
width, which OOM-killed a 62-layer conversion at layer 25; it now keeps one at a time (a layer's
experts arrive together and still share it). RAD_LQ_FACTOR_CACHE_ALL keeps the old behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mici81andClaude Opus 5.5 authored and StillDeadcode committed 2026-10-19 10:41:22 +02:00
1 parent d82c11644e
commit c94a0e6cc2
2 files changed
+61 -1

No files matched your search

+8
View File
@@ -27,3 +27,11 @@ if(OpenMP_CXX_FOUND)
else()
message(STATUS "libquant: no OpenMP -- quantisers will run single-threaded")
endif()
# GPTQ's Hessian factorisations through LAPACK where OpenBLAS is installed (lq_gptq.cpp): the
# built-in loops are single-threaded and take hours on a 21504-wide down projection.
find_library(LQ_OPENBLAS openblas)
if(LQ_OPENBLAS)
target_compile_definitions(libquant PRIVATE RAD_LQ_LAPACK=1)
target_link_libraries(libquant PRIVATE ${LQ_OPENBLAS})
endif()