1 /* Copyright 2017 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_SINGLE_THREADED_MATMUL_H_ 17 #define TENSORFLOW_COMPILER_XLA_SERVICE_CPU_RUNTIME_SINGLE_THREADED_MATMUL_H_ 18 19 #include <complex> 20 21 #include "third_party/eigen3/Eigen/Core" 22 #include "tensorflow/core/platform/types.h" 23 24 extern "C" { 25 26 // Performs a single-threaded matrix multiplication using Eigen. 'lhs' and 'rhs' 27 // are pointers to buffers containing input matrices in column-major order. 28 // 'out' is a pointer to a buffer sufficiently large to hold the result of the 29 // operation. Following standard nomenclature: lhs is m x k, rhs is k x n, and 30 // out is m x n. 31 extern void __xla_cpu_runtime_EigenSingleThreadedMatMulF16( 32 const void* /* xla::ExecutableRunOptions* */ run_options_ptr, 33 Eigen::half* out, Eigen::half* lhs, Eigen::half* rhs, tensorflow::int64 m, 34 tensorflow::int64 n, tensorflow::int64 k, tensorflow::int32 transpose_lhs, 35 tensorflow::int32 transpose_rhs); 36 37 extern void __xla_cpu_runtime_EigenSingleThreadedMatMulF32( 38 const void* /* xla::ExecutableRunOptions* */ run_options_ptr, float* out, 39 float* lhs, float* rhs, tensorflow::int64 m, tensorflow::int64 n, 40 tensorflow::int64 k, tensorflow::int32 transpose_lhs, 41 tensorflow::int32 transpose_rhs); 42 43 extern void __xla_cpu_runtime_EigenSingleThreadedMatMulF64( 44 const void* /* xla::ExecutableRunOptions* */ run_options_ptr, double* out, 45 double* lhs, double* rhs, tensorflow::int64 m, tensorflow::int64 n, 46 tensorflow::int64 k, tensorflow::int32 transpose_lhs, 47 tensorflow::int32 transpose_rhs); 48 49 extern void __xla_cpu_runtime_EigenSingleThreadedMatMulC64( 50 const void* /* xla::ExecutableRunOptions* */ run_options_ptr, 51 std::complex<float>* out, std::complex<float>* lhs, 52 std::complex<float>* rhs, tensorflow::int64 m, tensorflow::int64 n, 53 tensorflow::int64 k, tensorflow::int32 transpose_lhs, 54 tensorflow::int32 transpose_rhs); 55 56 extern void __xla_cpu_runtime_EigenSingleThreadedMatMulC128( 57 const void* /* xla::ExecutableRunOptions* */ run_options_ptr, 58 std::complex<double>* out, std::complex<double>* lhs, 59 std::complex<double>* rhs, tensorflow::int64 m, tensorflow::int64 n, 60 tensorflow::int64 k, tensorflow::int32 transpose_lhs, 61 tensorflow::int32 transpose_rhs); 62 63 extern void __xla_cpu_runtime_EigenSingleThreadedMatMulS32( 64 const void* /* xla::ExecutableRunOptions* */ run_options_ptr, 65 tensorflow::int32* out, tensorflow::int32* lhs, tensorflow::int32* rhs, 66 tensorflow::int64 m, tensorflow::int64 n, tensorflow::int64 k, 67 tensorflow::int32 transpose_lhs, tensorflow::int32 transpose_rhs); 68 69 } // extern "C" 70 71 #endif // TENSORFLOW_COMPILER_XLA_SERVICE_CPU_RUNTIME_SINGLE_THREADED_MATMUL_H_ 72