Skip to content

Commit

Permalink
ggml : add NVPL BLAS support (ggerganov#8329) (ggerganov#8425)
Browse files Browse the repository at this point in the history
* ggml : add NVPL BLAS support

* ggml : replace `<BLASLIB>_ENABLE_CBLAS` with `GGML_BLAS_USE_<BLASLIB>`

---------

Co-authored-by: ntukanov <ntukanov@nvidia.com>
  • Loading branch information
2 people authored and Nexesenex committed Jul 12, 2024
1 parent 1b7ebe8 commit 313864d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ggml-blas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
# include <Accelerate/Accelerate.h>
#elif defined(GGML_BLAS_USE_MKL)
# include <mkl.h>
#elif defined(GGML_BLAS_USE_BLIS)
# include <blis.h>
#elif defined(GGML_BLAS_USE_NVPL)
# include <nvpl_blas.h>
#else
# include <cblas.h>
# ifdef BLIS_ENABLE_CBLAS
# include <blis.h>
# endif
#endif

struct ggml_backend_blas_context {
Expand Down Expand Up @@ -140,10 +141,14 @@ static void ggml_backend_blas_mul_mat(ggml_backend_blas_context * ctx, struct gg
openblas_set_num_threads(ctx->n_threads);
#endif

#if defined(BLIS_ENABLE_CBLAS)
#if defined(GGML_BLAS_USE_BLIS)
bli_thread_set_num_threads(ctx->n_threads);
#endif

#if defined(GGML_BLAS_USE_NVPL)
nvpl_blas_set_num_threads(ctx->n_threads);
#endif

for (int64_t i13 = 0; i13 < ne13; i13++) {
for (int64_t i12 = 0; i12 < ne12; i12++) {
const int64_t i03 = i13/r3;
Expand Down

0 comments on commit 313864d

Please sign in to comment.