1 /* Copyright 2015 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 #include "tensorflow/stream_executor/blas.h" 17 18 #include "tensorflow/stream_executor/lib/strcat.h" 19 20 namespace perftools { 21 namespace gputools { 22 namespace blas { 23 TransposeString(Transpose t)24string TransposeString(Transpose t) { 25 switch (t) { 26 case Transpose::kNoTranspose: 27 return "NoTranspose"; 28 case Transpose::kTranspose: 29 return "Transpose"; 30 case Transpose::kConjugateTranspose: 31 return "ConjugateTranspose"; 32 default: 33 LOG(FATAL) << "Unknown transpose " << static_cast<int32>(t); 34 } 35 } 36 UpperLowerString(UpperLower ul)37string UpperLowerString(UpperLower ul) { 38 switch (ul) { 39 case UpperLower::kUpper: 40 return "Upper"; 41 case UpperLower::kLower: 42 return "Lower"; 43 default: 44 LOG(FATAL) << "Unknown upperlower " << static_cast<int32>(ul); 45 } 46 } 47 DiagonalString(Diagonal d)48string DiagonalString(Diagonal d) { 49 switch (d) { 50 case Diagonal::kUnit: 51 return "Unit"; 52 case Diagonal::kNonUnit: 53 return "NonUnit"; 54 default: 55 LOG(FATAL) << "Unknown diagonal " << static_cast<int32>(d); 56 } 57 } 58 SideString(Side s)59string SideString(Side s) { 60 switch (s) { 61 case Side::kLeft: 62 return "Left"; 63 case Side::kRight: 64 return "Right"; 65 default: 66 LOG(FATAL) << "Unknown side " << static_cast<int32>(s); 67 } 68 } 69 70 // -- AlgorithmConfig 71 ToString() const72string AlgorithmConfig::ToString() const { return port::StrCat(algorithm_); } 73 ComputationTypeString(ComputationType ty)74string ComputationTypeString(ComputationType ty) { 75 switch (ty) { 76 case ComputationType::kF16: 77 return "f16"; 78 case ComputationType::kF32: 79 return "f32"; 80 case ComputationType::kF64: 81 return "f64"; 82 case ComputationType::kComplexF32: 83 return "complex f32"; 84 case ComputationType::kComplexF64: 85 return "complex f64"; 86 default: 87 LOG(FATAL) << "Unknown ComputationType " << static_cast<int32>(ty); 88 } 89 } 90 91 } // namespace blas 92 } // namespace gputools 93 } // namespace perftools 94