[runtime] fix: BooleanToTranspose function definition conflict (#6452)
authorcloud-mxd <maxiandi@bytedance.com>
Fri, 11 Sep 2020 15:53:45 +0000 (23:53 +0800)
committerGitHub <noreply@github.com>
Fri, 11 Sep 2020 15:53:45 +0000 (08:53 -0700)
src/runtime/contrib/cblas/cblas.cc
src/runtime/contrib/cblas/mkl.cc
src/runtime/contrib/cblas/mkldnn.cc
src/runtime/contrib/cublas/cublas.cc

index 0bd6e6f..ce24aa8 100644 (file)
@@ -34,10 +34,11 @@ namespace tvm {
 namespace contrib {
 
 using namespace runtime;
-
+namespace {
 inline CBLAS_TRANSPOSE BooleanToTranspose(bool trans) { return trans ? CblasTrans : CblasNoTrans; }
 
 inline char BooleanToTransposeChar(bool trans) { return trans ? 'T' : 'N'; }
+}  // namespace
 
 struct CblasSgemmOp {
   typedef float TDatatype;
index fa98a35..cae6f0a 100644 (file)
@@ -34,7 +34,7 @@ namespace tvm {
 namespace contrib {
 
 using namespace runtime;
-
+namespace {
 inline CBLAS_TRANSPOSE BooleanToTranspose(bool trans) { return trans ? CblasTrans : CblasNoTrans; }
 
 inline CBLAS_OFFSET StringToOffset(const std::string offset_type) {
@@ -51,6 +51,7 @@ inline CBLAS_OFFSET StringToOffset(const std::string offset_type) {
 }
 
 inline char BooleanToTransposeChar(bool trans) { return trans ? 'T' : 'N'; }
+}  // namespace
 
 struct MKLGemmU8S8S32Op {
   void operator()(bool ta, bool tb, int M, int N, int K, float alpha, const void* A, int lda,
index 164f15a..5030f89 100644 (file)
@@ -34,8 +34,9 @@ namespace tvm {
 namespace contrib {
 
 using namespace runtime;
-
+namespace {
 inline char BooleanToTransposeChar(bool trans) { return trans ? 'T' : 'N'; }
+}  // namespace
 
 struct MKLDNNSgemmOp {
   typedef float TDatatype;
index 24468a7..e9f1718 100644 (file)
@@ -31,7 +31,7 @@ namespace tvm {
 namespace contrib {
 
 using namespace runtime;
-
+namespace {
 inline cublasOperation_t BooleanToTranspose(bool item) { return item ? CUBLAS_OP_T : CUBLAS_OP_N; }
 
 inline void TryEnableTensorCore(cublasHandle_t hdl) {
@@ -40,6 +40,7 @@ inline void TryEnableTensorCore(cublasHandle_t hdl) {
   CHECK_CUBLAS_ERROR(cublasGetVersion(hdl, &version));
   if (version >= 9000) CHECK_CUBLAS_ERROR(cublasSetMathMode(hdl, CUBLAS_TENSOR_OP_MATH));
 }
+}  // namespace
 
 struct CublasHgemmOp {
   typedef half TDatatype;