1 /** 2 * Copyright 2022 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_OPLIB_OP_INFO_KEYS_H_ 18 #define MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_OPLIB_OP_INFO_KEYS_H_ 19 #include <set> 20 #include <string> 21 #include <map> 22 23 namespace mindspore::kernel { 24 // json common value 25 constexpr auto kDynamicShapeSupport = "dynamicShapeSupport"; 26 constexpr auto kFlag = "flag"; 27 constexpr auto kTrue = "true"; 28 constexpr auto kOp = "op"; 29 constexpr auto kPattern = "pattern"; 30 constexpr auto kSlicePattern = "slicePattern"; 31 constexpr auto kValue = "value"; 32 constexpr auto kNeedCheckSupport = "needCheckSupport"; 33 constexpr auto kRangeLimit = "rangeLimit"; 34 constexpr auto kGgatKeyAttr = "sgatKeyAttr"; 35 constexpr auto kOpFile = "opFile"; 36 constexpr auto kOpInterface = "opInterface"; 37 constexpr auto kBinfile = "binfile"; 38 constexpr auto kKernel = "kernel"; 39 constexpr auto kAsync = "async"; 40 constexpr auto kCompute = "compute"; 41 constexpr auto kCost = "cost"; 42 constexpr auto kDynamicFormat = "dynamicFormat"; 43 constexpr auto kPartial = "partial"; 44 constexpr auto kPrecisionReduce = "precision_reduce"; 45 constexpr auto kDynamincRankSupport = "dynamicRankSupport"; 46 constexpr auto kDynamicCompileStatic = "dynamicCompileStatic"; 47 constexpr auto kHeavyOp = "heavyOp"; 48 constexpr auto kCubeOp = "cubeOp"; 49 constexpr auto kNull = "Null"; 50 constexpr auto kJitCompile = "jitCompile"; 51 constexpr auto kSoftSync = "softsync"; 52 constexpr auto kOpImplSwitch = "opImplSwitch"; 53 constexpr auto kPreBuildPattern = "prebuildPattern"; 54 55 // attr keys 56 constexpr auto kAttr = "attr"; 57 constexpr auto kList = "list"; 58 constexpr auto kParamType = "paramType"; 59 constexpr auto kType = "type"; 60 constexpr auto kDefaultValue = "defaultValue"; 61 // input/output keys 62 constexpr auto kInput = "input"; 63 constexpr auto kOutput = "output"; 64 constexpr auto kDtype = "dtype"; 65 constexpr auto kFormat = "format"; 66 constexpr auto kName = "name"; 67 constexpr auto kReshapeType = "reshapeType"; 68 constexpr auto kReshape_Type = "reshape_type"; 69 constexpr auto kShape = "shape"; 70 constexpr auto kNeedCompile = "needCompile"; 71 constexpr auto kUnknownShapeFormat = "unknownshape_format"; 72 constexpr auto kValueDepend = "valueDepend"; 73 constexpr auto kShapesType = "shapesType"; 74 // key values 75 constexpr auto kRequired = "required"; 76 constexpr auto kOptional = "optional"; 77 constexpr auto kDynamic = "dynamic"; 78 constexpr auto kImplyType = "imply_type"; 79 constexpr auto kOpName = "op_name"; 80 constexpr auto kAsyncFlag = "async_flag"; 81 constexpr auto kComputeCost = "compute_cost"; 82 constexpr auto kPartialFlag = "partial_flag"; 83 constexpr auto kOpPattern = "op_pattern"; 84 constexpr auto kFormatAgnostic = "formatAgnostic"; 85 constexpr auto kBroadcast = "broadcast"; 86 constexpr auto kReduce = "reduce"; 87 constexpr auto kDtypeFormat = "dtype_format"; 88 constexpr auto kIputs = "inputs"; 89 constexpr auto kOutputs = "outputs"; 90 91 constexpr auto kIndex = "index"; 92 constexpr auto kProcessor = "processor"; 93 constexpr auto kIgnored = "ignored"; 94 95 constexpr auto kProAICORE = "AiCore"; 96 constexpr auto kProCUDA = "CUDA"; 97 constexpr auto kProCPU = "CPU"; 98 constexpr auto kCtxCPU = "CPU"; 99 constexpr auto kCtxGPU = "GPU"; 100 constexpr auto kCtxAscend = "Ascend"; 101 constexpr auto kImplyAKGStr = "AKG"; // this type refer: CUDA & CPU with difference process 102 constexpr auto kImplyTBEStr = "TBE"; 103 constexpr auto kImplyAICPUStr = "AiCPU"; 104 constexpr auto kImplyCPUStr = "CPU"; 105 constexpr auto kImplyCUDAStr = "CUDA"; 106 constexpr auto kImplyGPUStr = "GPU"; 107 constexpr auto kImplyBISHENGStr = "BiSheng"; 108 const std::map<std::string, std::string> kProcessorMap = { 109 {kCtxAscend, kImplyTBEStr}, {kCtxGPU, kImplyCUDAStr}, {kCtxCPU, kImplyCPUStr}}; 110 enum OpImplyType { kImplyAKG = 0, kImplyTBE, kImplyAICPU, kImplyCPU, kImplyGPU, kImplyBISHENG, kImplyDynamicAKG }; 111 enum OpPattern { kCommonPattern = 0, kFormatAgnosticPattern, kBroadcastPattern, kReducePattern, kDynamicFormatPattern }; 112 static const std::map<std::string, OpPattern> kPatternMap = { 113 {kFormatAgnostic, kFormatAgnosticPattern}, 114 {kBroadcast, kBroadcastPattern}, 115 {kReduce, kReducePattern}, 116 }; 117 const std::map<std::string, OpImplyType> kImplyTypeStrToEnumMap = { 118 {kImplyTBEStr, kImplyTBE}, {kImplyAKGStr, kImplyAKG}, {kImplyCPUStr, kImplyCPU}, 119 {kImplyAICPUStr, kImplyAICPU}, {kImplyGPUStr, kImplyGPU}, {kImplyBISHENGStr, kImplyBISHENG}}; 120 const std::map<OpImplyType, std::string> kImplyTypeEnumToStrMap = { 121 {kImplyTBE, kImplyTBEStr}, {kImplyAKG, kImplyAKGStr}, {kImplyCPU, kImplyCPUStr}, 122 {kImplyAICPU, kImplyAICPUStr}, {kImplyGPU, kImplyGPUStr}, {kImplyBISHENG, kImplyBISHENGStr}}; 123 } // namespace mindspore::kernel 124 #endif // MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_OPLIB_OP_INFO_KEYS_H_ 125