• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #ifndef TENSORFLOW_COMPILER_XLA_SERVICE_CPU_RUNTIME_MATMUL_MKL_H_
17 #define TENSORFLOW_COMPILER_XLA_SERVICE_CPU_RUNTIME_MATMUL_MKL_H_
18 
19 #include <iostream>
20 #include "tensorflow/core/platform/types.h"
21 #ifdef INTEL_MKL
22 #include "third_party/intel_mkl_ml/include/mkl_cblas.h"
23 
24 extern void __xla_cpu_runtime_MKLMatMulF32(
25     const void* /* xla::ExecutableRunOptions* */ run_options_ptr, float* out,
26     float* lhs, float* rhs, tensorflow::int64 m, tensorflow::int64 n,
27     tensorflow::int64 k, tensorflow::int32 transpose_lhs,
28     tensorflow::int32 transpose_rhs);
29 extern void __xla_cpu_runtime_MKLMatMulF64(
30     const void* /* xla::ExecutableRunOptions* */ run_options_ptr, double* out,
31     double* lhs, double* rhs, tensorflow::int64 m, tensorflow::int64 n,
32     tensorflow::int64 k, tensorflow::int32 transpose_lhs,
33     tensorflow::int32 transpose_rhs);
34 extern void __xla_cpu_runtime_MKLSingleThreadedMatMulF32(
35     const void* /* xla::ExecutableRunOptions* */ run_options_ptr, float* out,
36     float* lhs, float* rhs, tensorflow::int64 m, tensorflow::int64 n,
37     tensorflow::int64 k, tensorflow::int32 transpose_lhs,
38     tensorflow::int32 transpose_rhs);
39 extern void __xla_cpu_runtime_MKLSingleThreadedMatMulF64(
40     const void* /* xla::ExecutableRunOptions* */ run_options_ptr, double* out,
41     double* lhs, double* rhs, tensorflow::int64 m, tensorflow::int64 n,
42     tensorflow::int64 k, tensorflow::int32 transpose_lhs,
43     tensorflow::int32 transpose_rhs);
44 
45 #else
__xla_cpu_runtime_MKLMatMulF32(const void * run_options_ptr,float * out,float * lhs,float * rhs,tensorflow::int64 m,tensorflow::int64 n,tensorflow::int64 k,tensorflow::int32 transpose_lhs,tensorflow::int32 transpose_rhs)46 extern void __xla_cpu_runtime_MKLMatMulF32(
47     const void* /* xla::ExecutableRunOptions* */ run_options_ptr, float* out,
48     float* lhs, float* rhs, tensorflow::int64 m, tensorflow::int64 n,
49     tensorflow::int64 k, tensorflow::int32 transpose_lhs,
50     tensorflow::int32 transpose_rhs) {
51   std::cerr << "Attempt to call MKL MatMul runtime library without defining "
52                "INTEL_MKL. Add --config=mkl to build with MKL.";
53   exit(1);
54 }
__xla_cpu_runtime_MKLMatMulF64(const void * run_options_ptr,double * out,double * lhs,double * rhs,tensorflow::int64 m,tensorflow::int64 n,tensorflow::int64 k,tensorflow::int32 transpose_lhs,tensorflow::int32 transpose_rhs)55 extern void __xla_cpu_runtime_MKLMatMulF64(
56     const void* /* xla::ExecutableRunOptions* */ run_options_ptr, double* out,
57     double* lhs, double* rhs, tensorflow::int64 m, tensorflow::int64 n,
58     tensorflow::int64 k, tensorflow::int32 transpose_lhs,
59     tensorflow::int32 transpose_rhs) {
60   std::cerr << "Attempt to call MKL MatMul runtime library without defining "
61                "INTEL_MKL. Add --config=mkl to build with MKL.";
62   exit(1);
63 }
__xla_cpu_runtime_MKLSingleThreadedMatMulF32(const void * run_options_ptr,float * out,float * lhs,float * rhs,tensorflow::int64 m,tensorflow::int64 n,tensorflow::int64 k,tensorflow::int32 transpose_lhs,tensorflow::int32 transpose_rhs)64 extern void __xla_cpu_runtime_MKLSingleThreadedMatMulF32(
65     const void* /* xla::ExecutableRunOptions* */ run_options_ptr, float* out,
66     float* lhs, float* rhs, tensorflow::int64 m, tensorflow::int64 n,
67     tensorflow::int64 k, tensorflow::int32 transpose_lhs,
68     tensorflow::int32 transpose_rhs) {
69   std::cerr << "Attempt to call MKL MatMul runtime library without defining "
70                "INTEL_MKL. Add --config=mkl to build with MKL.";
71   exit(1);
72 }
__xla_cpu_runtime_MKLSingleThreadedMatMulF64(const void * run_options_ptr,double * out,double * lhs,double * rhs,tensorflow::int64 m,tensorflow::int64 n,tensorflow::int64 k,tensorflow::int32 transpose_lhs,tensorflow::int32 transpose_rhs)73 extern void __xla_cpu_runtime_MKLSingleThreadedMatMulF64(
74     const void* /* xla::ExecutableRunOptions* */ run_options_ptr, double* out,
75     double* lhs, double* rhs, tensorflow::int64 m, tensorflow::int64 n,
76     tensorflow::int64 k, tensorflow::int32 transpose_lhs,
77     tensorflow::int32 transpose_rhs) {
78   std::cerr << "Attempt to call MKL MatMul runtime library without defining "
79                "INTEL_MKL. Add --config=mkl to build with MKL.";
80   exit(1);
81 }
82 
83 #endif  // INTEL_MKL
84 #endif  // TENSORFLOW_COMPILER_XLA_SERVICE_CPU_RUNTIME_MATMUL_MKL_H_
85