forked from marian-nmt/marian-dev
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathprod_blas.h
47 lines (46 loc) · 1.3 KB
/
prod_blas.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#if MKL_FOUND
#include <mkl.h>
#elif BLAS_FOUND
#if WASM_COMPATIBLE_BLAS
#include "3rd_party/onnxjs/src/wasm-ops/gemm.h"
#else
#include <cblas.h>
#endif // WASM_COMPATIBLE_BLAS
#endif
inline void sgemm(bool transA,
bool transB,
int rows_a,
int rows_b,
int width,
float alpha,
float* a,
int lda,
float* b,
int ldb,
float beta,
float* c,
int ldc) {
#if BLAS_FOUND
#if WASM_COMPATIBLE_BLAS
gemm_f32_imp(transA, transB, rows_a, rows_b, width, alpha, a, b, beta, c);
#else
cblas_sgemm(CblasRowMajor,
transA ? CblasTrans : CblasNoTrans,
transB ? CblasTrans : CblasNoTrans,
rows_a,
rows_b,
width,
alpha,
a,
lda,
b,
ldb,
beta,
c,
ldc);
#endif
#else
transA; transB; rows_a; rows_b; width; alpha; a; lda; b; ldb; beta; c; ldc; // make compiler happy
ABORT("Marian must be compiled with a BLAS library");
#endif
}