150
|
1 //===- cblas.h - Simple Blas subset ---------------------------------------===//
|
|
2 //
|
|
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
4 // See https://llvm.org/LICENSE.txt for license information.
|
|
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
6 //
|
|
7 //===----------------------------------------------------------------------===//
|
|
8 #ifndef MLIR_CPU_RUNNER_CBLAS_H_
|
|
9 #define MLIR_CPU_RUNNER_CBLAS_H_
|
|
10
|
|
11 #include "mlir_runner_utils.h"
|
|
12
|
|
13 #ifdef _WIN32
|
|
14 #ifndef MLIR_CBLAS_EXPORT
|
|
15 #ifdef cblas_EXPORTS
|
|
16 /* We are building this library */
|
|
17 #define MLIR_CBLAS_EXPORT __declspec(dllexport)
|
|
18 #else
|
|
19 /* We are using this library */
|
|
20 #define MLIR_CBLAS_EXPORT __declspec(dllimport)
|
|
21 #endif // cblas_EXPORTS
|
|
22 #endif // MLIR_CBLAS_EXPORT
|
|
23 #else
|
|
24 #define MLIR_CBLAS_EXPORT
|
|
25 #endif // _WIN32
|
|
26
|
|
27 /// This reproduces a minimal subset of cblas to allow integration testing
|
|
28 /// without explicitly requiring a dependence on an external library.
|
|
29 /// Without loss of generality, various cblas implementations may be swapped in
|
|
30 /// by including the proper headers and linking with the proper library.
|
|
31 enum CBLAS_ORDER { CblasRowMajor = 101, CblasColMajor = 102 };
|
|
32 enum CBLAS_TRANSPOSE {
|
|
33 CblasNoTrans = 111,
|
|
34 CblasTrans = 112,
|
|
35 CblasConjTrans = 113
|
|
36 };
|
|
37
|
|
38 extern "C" MLIR_CBLAS_EXPORT float cblas_sdot(const int N, const float *X,
|
|
39 const int incX, const float *Y,
|
|
40 const int incY);
|
|
41
|
|
42 extern "C" MLIR_CBLAS_EXPORT void
|
|
43 cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
|
|
44 const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
|
|
45 const int K, const float alpha, const float *A, const int lda,
|
|
46 const float *B, const int ldb, const float beta, float *C,
|
|
47 const int ldc);
|
|
48
|
|
49 #endif // MLIR_CPU_RUNNER_CBLAS_H_
|