Distribute and run LLMs with a single file.
C++ cross-platformggufllama-cpplocal-ailocal-inferencelocal-llmopen-source-aisingle-file-executablespeech-to-text
Clean up some code
Justine Tunney0b3f3bd9dc58
diff --git a/llamafile/BUILD.mk b/llamafile/BUILD.mkindex 3b4760ed..a9e95b51 100644--- a/llamafile/BUILD.mk+++ b/llamafile/BUILD.mk@@ -70,10 +70,6 @@ o/$(MODE)/llamafile/sgemm_sss_test: \o/$(MODE)/llamafile/sgemm_sss_test.o \o/$(MODE)/llama.cpp/llama.cpp.a-o/$(MODE)/llamafile/fun: \- o/$(MODE)/llamafile/fun.o \- o/$(MODE)/llama.cpp/llama.cpp.a-o/$(MODE)/llamafile/sgemm_vecdot_test: \o/$(MODE)/llamafile/sgemm_vecdot_test.o \o/$(MODE)/llama.cpp/llama.cpp.adiff --git a/llamafile/sgemm.cpp b/llamafile/sgemm.cppindex 1656bca8..f109148b 100644--- a/llamafile/sgemm.cpp+++ b/llamafile/sgemm.cpp@@ -132,7 +132,7 @@ bool llamafile_sgemm(int m, int n, int k, const void *A, int lda, const void *B,#ifdef __x86_64__if (Btype != GGML_TYPE_F32)return false;- if (have_avx512bf16 && !(k % 16))+ if (have_avx512bf16 && !(k % 32))return llamafile_sgemm_bss_avx512bf16(m, n, k, (const ggml_bf16_t *)A, lda,(const float *)B, ldb, (float *)C, ldc, ith, nth,task);diff --git a/llamafile/sgemm_bss_avx512bf16.cpp b/llamafile/sgemm_bss_avx512bf16.cppindex 5e924903..4afe9704 100644--- a/llamafile/sgemm_bss_avx512bf16.cpp+++ b/llamafile/sgemm_bss_avx512bf16.cpp@@ -20,28 +20,28 @@#include "sgemm.h"#include <immintrin.h>-#define KN 16+#define KN 32-typedef __m256 D;-typedef __m256bh V;+typedef __m512 D;+typedef __m512bh V;typedef ggml_bf16_t TA;typedef float TB;typedef float TC;-static inline __m256 zero() {- return _mm256_setzero_ps();+static inline __m512 zero() {+ return _mm512_setzero_ps();}-static inline __m256bh load(const ggml_bf16_t *p) {- return (__m256bh)_mm256_loadu_ps((const float *)p);+static inline __m512bh load(const ggml_bf16_t *p) {+ return (__m512bh)_mm512_loadu_ps((const float *)p);}-static inline __m256bh load(const float *p) {- return _mm512_cvtneps_pbh(_mm512_loadu_ps(p));+static inline __m512bh load(const float *p) {+ return _mm512_cvtne2ps_pbh(_mm512_loadu_ps(p + 16), _mm512_loadu_ps(p));}-static inline __m256 madd(__m256bh x, __m256bh y, __m256 z) {- return _mm256_dpbf16_ps(z, x, y);+static inline __m512 madd(__m512bh x, __m512bh y, __m512 z) {+ return _mm512_dpbf16_ps(z, x, y);}#include "sgemmer.inc"