已合并
针对nn仓部分算子存在错误日志问题进行统一整改 #9382
gaomingyuan创建于 8 天前
针对nn仓部分算子存在错误日志问题进行统一整改 #9382
已合并
共 8 个文件变更+62-82
| @@ -194,7 +194,7 @@ int main(int argc, char* argv[]) | |||
| 194 | std::map<AscendString, AscendString> global_options = {{"ge.exec.deviceId", "0"}, {"ge.graphRunMode", "1"}}; | 194 | std::map<AscendString, AscendString> global_options = {{"ge.exec.deviceId", "0"}, {"ge.graphRunMode", "1"}}; |
| 195 | Status ret = ge::GEInitialize(global_options); | 195 | Status ret = ge::GEInitialize(global_options); |
| 196 | if (ret != SUCCESS) { | 196 | if (ret != SUCCESS) { |
| 197 | - printf("%s - INFO - [XIR]: Initialize ge using ge global options failed\n", GetTime().c_str()); | 197 | + printf("%s - ERROR - [XIR]: Initialize ge using ge global options failed\n", GetTime().c_str()); |
| 198 | return FAILED; | 198 | return FAILED; |
| 199 | } | 199 | } |
| 200 | printf("%s - INFO - [XIR]: Initialize ge using ge global options success\n", GetTime().c_str()); | 200 | printf("%s - INFO - [XIR]: Initialize ge using ge global options success\n", GetTime().c_str()); |
| @@ -246,7 +246,7 @@ int main(int argc, char* argv[]) | |||
| 246 | std::vector<ge::Tensor> output; | 246 | std::vector<ge::Tensor> output; |
| 247 | ret = session->RunGraph(graph_id, input, output); | 247 | ret = session->RunGraph(graph_id, input, output); |
| 248 | if (ret != SUCCESS) { | 248 | if (ret != SUCCESS) { |
| 249 | - printf("%s - INFO - [XIR]: Run graph failed\n", GetTime().c_str()); | 249 | + printf("%s - ERROR - [XIR]: Run graph failed\n", GetTime().c_str()); |
| 250 | delete session; | 250 | delete session; |
| 251 | GEFinalize(); | 251 | GEFinalize(); |
| 252 | return FAILED; | 252 | return FAILED; |
| @@ -288,7 +288,7 @@ int main(int argc, char* argv[]) | |||
| 288 | printf("%s - INFO - [XIR]: Start to finalize ir graph session\n", GetTime().c_str()); | 288 | printf("%s - INFO - [XIR]: Start to finalize ir graph session\n", GetTime().c_str()); |
| 289 | ret = ge::GEFinalize(); | 289 | ret = ge::GEFinalize(); |
| 290 | if (ret != SUCCESS) { | 290 | if (ret != SUCCESS) { |
| 291 | - printf("%s - INFO - [XIR]: Finalize ir graph session failed\n", GetTime().c_str()); | 291 | + printf("%s - ERROR - [XIR]: Finalize ir graph session failed\n", GetTime().c_str()); |
| 292 | return FAILED; | 292 | return FAILED; |
| 293 | } | 293 | } |
| 294 | printf("%s - INFO - [XIR]: Finalize ir graph session success\n", GetTime().c_str()); | 294 | printf("%s - INFO - [XIR]: Finalize ir graph session success\n", GetTime().c_str()); |
| @@ -42,7 +42,6 @@ constexpr uint64_t ASCEND_WORKSPACE = 16777216; | |||
| 42 | 42 | ||
| 43 | ge::graphStatus ReluGradV2Tiling::CalcInputDtype() | 43 | ge::graphStatus ReluGradV2Tiling::CalcInputDtype() |
| 44 | { | 44 | { |
| 45 | - OP_LOGD(tilingContext->GetNodeName(), "ReluGradV2Tiling CalcInputDtype enter."); | ||
| 46 | auto inputDesc = tilingContext->GetInputDesc(0); | 45 | auto inputDesc = tilingContext->GetInputDesc(0); |
| 47 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, inputDesc); | 46 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, inputDesc); |
| 48 | this->inputDtype = inputDesc->GetDataType(); | 47 | this->inputDtype = inputDesc->GetDataType(); |
| @@ -58,7 +57,6 @@ ge::graphStatus ReluGradV2Tiling::CalcInputDtype() | |||
| 58 | 57 | ||
| 59 | ge::graphStatus ReluGradV2Tiling::CheckShape() | 58 | ge::graphStatus ReluGradV2Tiling::CheckShape() |
| 60 | { | 59 | { |
| 61 | - OP_LOGD(tilingContext->GetNodeName(), "ReluGradV2Tiling CheckShape enter."); | ||
| 62 | auto gradientsStorageShape = tilingContext->GetInputShape(0); | 60 | auto gradientsStorageShape = tilingContext->GetInputShape(0); |
| 63 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, gradientsStorageShape); | 61 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, gradientsStorageShape); |
| 64 | const gert::Shape& inputGradientsShape = EnsureNotScalar(gradientsStorageShape->GetStorageShape()); | 62 | const gert::Shape& inputGradientsShape = EnsureNotScalar(gradientsStorageShape->GetStorageShape()); |
| @@ -96,7 +94,6 @@ ge::graphStatus ReluGradV2Tiling::CheckShape() | |||
| 96 | 94 | ||
| 97 | ge::graphStatus ReluGradV2Tiling::CalcOutputDtype() | 95 | ge::graphStatus ReluGradV2Tiling::CalcOutputDtype() |
| 98 | { | 96 | { |
| 99 | - OP_LOGD(tilingContext->GetNodeName(), "ReluGradV2Tiling CalcOutputDtype enter."); | ||
| 100 | auto outputDesc = tilingContext->GetOutputDesc(0); | 97 | auto outputDesc = tilingContext->GetOutputDesc(0); |
| 101 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, outputDesc); | 98 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, outputDesc); |
| 102 | this->outputDtype = outputDesc->GetDataType(); | 99 | this->outputDtype = outputDesc->GetDataType(); |
| @@ -111,14 +108,13 @@ ge::graphStatus ReluGradV2Tiling::CalcOutputDtype() | |||
| 111 | 108 | ||
| 112 | ge::graphStatus ReluGradV2Tiling::RunTiling() | 109 | ge::graphStatus ReluGradV2Tiling::RunTiling() |
| 113 | { | 110 | { |
| 114 | - OP_LOGD(tilingContext->GetNodeName(), "ReluGradV2Tiling RunTiling enter."); | ||
| 115 | ElewiseBaseTiling elewiseBaseTiling(tilingContext); | 111 | ElewiseBaseTiling elewiseBaseTiling(tilingContext); |
| 116 | 112 | ||
| 117 | - OP_CHECK_IF(CalcInputDtype() != ge::GRAPH_SUCCESS, OP_LOGE(tilingContext, "Get input dtype failed."), | 113 | + OP_CHECK_IF(CalcInputDtype() != ge::GRAPH_SUCCESS, OP_LOGE(tilingContext->GetNodeName(), "Get input dtype failed."), |
| 118 | return ge::GRAPH_FAILED); | 114 | return ge::GRAPH_FAILED); |
| 119 | - OP_CHECK_IF(CalcOutputDtype() != ge::GRAPH_SUCCESS, OP_LOGE(tilingContext, "Get output dtype failed."), | 115 | + OP_CHECK_IF(CalcOutputDtype() != ge::GRAPH_SUCCESS, |
| 120 | - return ge::GRAPH_FAILED); | 116 | + OP_LOGE(tilingContext->GetNodeName(), "Get output dtype failed."), return ge::GRAPH_FAILED); |
| 121 | - OP_CHECK_IF(CheckShape() != ge::GRAPH_SUCCESS, OP_LOGE(tilingContext, "Check shape failed."), | 117 | + OP_CHECK_IF(CheckShape() != ge::GRAPH_SUCCESS, OP_LOGE(tilingContext->GetNodeName(), "Check shape failed."), |
| 122 | return ge::GRAPH_FAILED); | 118 | return ge::GRAPH_FAILED); |
| 123 | 119 | ||
| 124 | auto tiling = tilingContext->GetTilingData<EleBaseTilingDataV2>(); | 120 | auto tiling = tilingContext->GetTilingData<EleBaseTilingDataV2>(); |
| @@ -152,8 +148,8 @@ ge::graphStatus ReluGradV2Tiling::RunTiling() | |||
| 152 | return ge::GRAPH_FAILED; | 148 | return ge::GRAPH_FAILED; |
| 153 | } | 149 | } |
| 154 | 150 | ||
| 155 | - OP_CHECK_IF(baseTilingResult != ge::GRAPH_SUCCESS, OP_LOGE(tilingContext, "ElewiseBaseTiling failed."), | 151 | + OP_CHECK_IF(baseTilingResult != ge::GRAPH_SUCCESS, |
| 156 | - return ge::GRAPH_FAILED); | 152 | + OP_LOGE(tilingContext->GetNodeName(), "ElewiseBaseTiling failed."), return ge::GRAPH_FAILED); |
| 157 | 153 | ||
| 158 | size_t* currentWorkspace = tilingContext->GetWorkspaceSizes(1); | 154 | size_t* currentWorkspace = tilingContext->GetWorkspaceSizes(1); |
| 159 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, currentWorkspace); | 155 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, currentWorkspace); |
| @@ -169,7 +165,6 @@ ge::graphStatus ReluGradV2Tiling::RunTiling() | |||
| 169 | 165 | ||
| 170 | static ge::graphStatus TilingForReluGradV2(gert::TilingContext* tilingContextGen) | 166 | static ge::graphStatus TilingForReluGradV2(gert::TilingContext* tilingContextGen) |
| 171 | { | 167 | { |
| 172 | - OP_LOGD("ReluGradV2", "Enter TilingForReluGradV2"); | ||
| 173 | if (tilingContextGen == nullptr) { | 168 | if (tilingContextGen == nullptr) { |
| 174 | OP_LOGE("ReluGradV2", "Tiling context is null"); | 169 | OP_LOGE("ReluGradV2", "Tiling context is null"); |
| 175 | return ge::GRAPH_FAILED; | 170 | return ge::GRAPH_FAILED; |
| @@ -177,7 +172,6 @@ static ge::graphStatus TilingForReluGradV2(gert::TilingContext* tilingContextGen | |||
| 177 | auto compileInfo = tilingContextGen->GetCompileInfo<ReluGradV2CompileInfo>(); | 172 | auto compileInfo = tilingContextGen->GetCompileInfo<ReluGradV2CompileInfo>(); |
| 178 | OP_CHECK_NULL_WITH_CONTEXT(tilingContextGen, compileInfo); | 173 | OP_CHECK_NULL_WITH_CONTEXT(tilingContextGen, compileInfo); |
| 179 | 174 | ||
| 180 | - OP_LOGD("ReluGradV2", "Enter new ReluGradV2Tiling"); | ||
| 181 | ReluGradV2Tiling baseOpTiling(tilingContextGen); | 175 | ReluGradV2Tiling baseOpTiling(tilingContextGen); |
| 182 | return baseOpTiling.RunTiling(); | 176 | return baseOpTiling.RunTiling(); |
| 183 | } | 177 | } |
| @@ -190,7 +190,7 @@ int main(int argc, char* argv[]) | |||
| 190 | std::map<AscendString, AscendString> global_options = {{"ge.exec.deviceId", "0"}, {"ge.graphRunMode", "1"}}; | 190 | std::map<AscendString, AscendString> global_options = {{"ge.exec.deviceId", "0"}, {"ge.graphRunMode", "1"}}; |
| 191 | Status ret = ge::GEInitialize(global_options); | 191 | Status ret = ge::GEInitialize(global_options); |
| 192 | if (ret != SUCCESS) { | 192 | if (ret != SUCCESS) { |
| 193 | - printf("%s - INFO - [XIR]: Initialize ge using ge global options failed\n", GetTime().c_str()); | 193 | + printf("%s - ERROR - [XIR]: Initialize ge using ge global options failed\n", GetTime().c_str()); |
| 194 | return FAILED; | 194 | return FAILED; |
| 195 | } | 195 | } |
| 196 | printf("%s - INFO - [XIR]: Initialize ge using ge global options success\n", GetTime().c_str()); | 196 | printf("%s - INFO - [XIR]: Initialize ge using ge global options success\n", GetTime().c_str()); |
| @@ -242,7 +242,7 @@ int main(int argc, char* argv[]) | |||
| 242 | std::vector<ge::Tensor> output; | 242 | std::vector<ge::Tensor> output; |
| 243 | ret = session->RunGraph(graph_id, input, output); | 243 | ret = session->RunGraph(graph_id, input, output); |
| 244 | if (ret != SUCCESS) { | 244 | if (ret != SUCCESS) { |
| 245 | - printf("%s - INFO - [XIR]: Run graph failed\n", GetTime().c_str()); | 245 | + printf("%s - ERROR - [XIR]: Run graph failed\n", GetTime().c_str()); |
| 246 | delete session; | 246 | delete session; |
| 247 | GEFinalize(); | 247 | GEFinalize(); |
| 248 | return FAILED; | 248 | return FAILED; |
| @@ -284,7 +284,7 @@ int main(int argc, char* argv[]) | |||
| 284 | printf("%s - INFO - [XIR]: Start to finalize ir graph session\n", GetTime().c_str()); | 284 | printf("%s - INFO - [XIR]: Start to finalize ir graph session\n", GetTime().c_str()); |
| 285 | ret = ge::GEFinalize(); | 285 | ret = ge::GEFinalize(); |
| 286 | if (ret != SUCCESS) { | 286 | if (ret != SUCCESS) { |
| 287 | - printf("%s - INFO - [XIR]: Finalize ir graph session failed\n", GetTime().c_str()); | 287 | + printf("%s - ERROR - [XIR]: Finalize ir graph session failed\n", GetTime().c_str()); |
| 288 | return FAILED; | 288 | return FAILED; |
| 289 | } | 289 | } |
| 290 | printf("%s - INFO - [XIR]: Finalize ir graph session success\n", GetTime().c_str()); | 290 | printf("%s - INFO - [XIR]: Finalize ir graph session success\n", GetTime().c_str()); |
| @@ -28,7 +28,6 @@ const gert::Shape g_vec_1_shape = {1}; | |||
| 28 | 28 | ||
| 29 | ge::graphStatus SoftplusTiling::CalcInputDtype() | 29 | ge::graphStatus SoftplusTiling::CalcInputDtype() |
| 30 | { | 30 | { |
| 31 | - OP_LOGD(tilingContext->GetNodeName(), "SoftplusTiling CalcInputDtype enter."); | ||
| 32 | auto inputDesc = tilingContext->GetInputDesc(0); | 31 | auto inputDesc = tilingContext->GetInputDesc(0); |
| 33 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, inputDesc); | 32 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, inputDesc); |
| 34 | this->inputDtype = inputDesc->GetDataType(); | 33 | this->inputDtype = inputDesc->GetDataType(); |
| @@ -52,7 +51,6 @@ static inline const gert::Shape& EnsureNotScalar(const gert::Shape& in_shape) | |||
| 52 | 51 | ||
| 53 | ge::graphStatus SoftplusTiling::CheckShape() | 52 | ge::graphStatus SoftplusTiling::CheckShape() |
| 54 | { | 53 | { |
| 55 | - OP_LOGD(tilingContext->GetNodeName(), "SoftplusTiling CheckShape enter."); | ||
| 56 | auto inputStorageShape = tilingContext->GetInputShape(0); | 54 | auto inputStorageShape = tilingContext->GetInputShape(0); |
| 57 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, inputStorageShape); | 55 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, inputStorageShape); |
| 58 | const gert::Shape& inputYShape = EnsureNotScalar(inputStorageShape->GetStorageShape()); | 56 | const gert::Shape& inputYShape = EnsureNotScalar(inputStorageShape->GetStorageShape()); |
| @@ -72,7 +70,6 @@ ge::graphStatus SoftplusTiling::CheckShape() | |||
| 72 | 70 | ||
| 73 | ge::graphStatus SoftplusTiling::CalcOutputDtype() | 71 | ge::graphStatus SoftplusTiling::CalcOutputDtype() |
| 74 | { | 72 | { |
| 75 | - OP_LOGD(tilingContext->GetNodeName(), "SoftplusTiling CalcOutputDtype enter."); | ||
| 76 | auto outputDesc = tilingContext->GetOutputDesc(0); | 73 | auto outputDesc = tilingContext->GetOutputDesc(0); |
| 77 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, outputDesc); | 74 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, outputDesc); |
| 78 | this->outputDtype = outputDesc->GetDataType(); | 75 | this->outputDtype = outputDesc->GetDataType(); |
| @@ -90,13 +87,12 @@ ge::graphStatus SoftplusTiling::RunTiling() | |||
| 90 | { | 87 | { |
| 91 | auto tiling = tilingContext->GetTilingData<Ops::Base::EleBaseTilingData16B>(); | 88 | auto tiling = tilingContext->GetTilingData<Ops::Base::EleBaseTilingData16B>(); |
| 92 | 89 | ||
| 93 | - OP_LOGD(tilingContext->GetNodeName(), "SoftplusTiling RunTiling enter."); | ||
| 94 | ElewiseBaseTiling elewiseBaseTiling(tilingContext); | 90 | ElewiseBaseTiling elewiseBaseTiling(tilingContext); |
| 95 | - OP_CHECK_IF(CalcInputDtype() == ge::GRAPH_FAILED, OP_LOGE(tilingContext, "get input dtype failed"), | 91 | + OP_CHECK_IF(CalcInputDtype() == ge::GRAPH_FAILED, OP_LOGE(tilingContext->GetNodeName(), "get input dtype failed"), |
| 96 | return ge::GRAPH_FAILED); | 92 | return ge::GRAPH_FAILED); |
| 97 | - OP_CHECK_IF(CalcOutputDtype() == ge::GRAPH_FAILED, OP_LOGE(tilingContext, "get output dtype failed"), | 93 | + OP_CHECK_IF(CalcOutputDtype() == ge::GRAPH_FAILED, OP_LOGE(tilingContext->GetNodeName(), "get output dtype failed"), |
| 98 | return ge::GRAPH_FAILED); | 94 | return ge::GRAPH_FAILED); |
| 99 | - OP_CHECK_IF(CheckShape() == ge::GRAPH_FAILED, OP_LOGE(tilingContext, "check shape failed"), | 95 | + OP_CHECK_IF(CheckShape() == ge::GRAPH_FAILED, OP_LOGE(tilingContext->GetNodeName(), "check shape failed"), |
| 100 | return ge::GRAPH_FAILED); | 96 | return ge::GRAPH_FAILED); |
| 101 | 97 | ||
| 102 | ge::graphStatus baseTilingResult = ge::GRAPH_FAILED; | 98 | ge::graphStatus baseTilingResult = ge::GRAPH_FAILED; |
| @@ -116,7 +112,7 @@ ge::graphStatus SoftplusTiling::RunTiling() | |||
| 116 | "The dtype of y must be DT_FLOAT16, DT_BF16, or DT_FLOAT"); | 112 | "The dtype of y must be DT_FLOAT16, DT_BF16, or DT_FLOAT"); |
| 117 | return ge::GRAPH_FAILED; | 113 | return ge::GRAPH_FAILED; |
| 118 | } | 114 | } |
| 119 | - OP_CHECK_IF(baseTilingResult == ge::GRAPH_FAILED, OP_LOGE(tilingContext, "elewiseBaseTiling failed"), | 115 | + OP_CHECK_IF(baseTilingResult == ge::GRAPH_FAILED, OP_LOGE(tilingContext->GetNodeName(), "elewiseBaseTiling failed"), |
| 120 | return ge::GRAPH_FAILED); | 116 | return ge::GRAPH_FAILED); |
| 121 | 117 | ||
| 122 | size_t* currentWorkspace = tilingContext->GetWorkspaceSizes(1); | 118 | size_t* currentWorkspace = tilingContext->GetWorkspaceSizes(1); |
| @@ -132,7 +128,6 @@ ge::graphStatus SoftplusTiling::RunTiling() | |||
| 132 | 128 | ||
| 133 | static ge::graphStatus Tiling4Softplus(gert::TilingContext* tilingContextGen) | 129 | static ge::graphStatus Tiling4Softplus(gert::TilingContext* tilingContextGen) |
| 134 | { | 130 | { |
| 135 | - OP_LOGD(tilingContextGen->GetNodeName(), "Tiling4Softplus rt2.0 is running."); | ||
| 136 | auto compileInfo = tilingContextGen->GetCompileInfo<SoftplusCompileInfo>(); | 131 | auto compileInfo = tilingContextGen->GetCompileInfo<SoftplusCompileInfo>(); |
| 137 | OP_CHECK_NULL_WITH_CONTEXT(tilingContextGen, compileInfo); | 132 | OP_CHECK_NULL_WITH_CONTEXT(tilingContextGen, compileInfo); |
| 138 | 133 | ||
| @@ -49,7 +49,6 @@ T inline CeilDivide(T num1, T num2) | |||
| 49 | 49 | ||
| 50 | static ge::graphStatus CheckDtype(const gert::TilingContext* context, MapIndexTilingParam& tilingParam) | 50 | static ge::graphStatus CheckDtype(const gert::TilingContext* context, MapIndexTilingParam& tilingParam) |
| 51 | { | 51 | { |
| 52 | - OP_LOGD(context->GetNodeName(), "CheckDtype begin."); | ||
| 53 | auto inputXPtr = context->GetInputDesc(0); | 52 | auto inputXPtr = context->GetInputDesc(0); |
| 54 | OP_CHECK_NULL_WITH_CONTEXT(context, inputXPtr); | 53 | OP_CHECK_NULL_WITH_CONTEXT(context, inputXPtr); |
| 55 | auto xDtype = inputXPtr->GetDataType(); | 54 | auto xDtype = inputXPtr->GetDataType(); |
| @@ -94,7 +93,6 @@ static ge::graphStatus CheckDtype(const gert::TilingContext* context, MapIndexTi | |||
| 94 | 93 | ||
| 95 | static ge::graphStatus CheckShape(const gert::TilingContext* context, MapIndexTilingParam& tilingParam) | 94 | static ge::graphStatus CheckShape(const gert::TilingContext* context, MapIndexTilingParam& tilingParam) |
| 96 | { | 95 | { |
| 97 | - OP_LOGD(context->GetNodeName(), "CheckShape begin."); | ||
| 98 | auto xShapePtr = context->GetInputShape(0); | 96 | auto xShapePtr = context->GetInputShape(0); |
| 99 | OP_CHECK_NULL_WITH_CONTEXT(context, xShapePtr); | 97 | OP_CHECK_NULL_WITH_CONTEXT(context, xShapePtr); |
| 100 | auto xShape = xShapePtr->GetStorageShape(); | 98 | auto xShape = xShapePtr->GetStorageShape(); |
| @@ -162,8 +160,6 @@ static ge::graphStatus CheckShape(const gert::TilingContext* context, MapIndexTi | |||
| 162 | 160 | ||
| 163 | static ge::graphStatus CheckAttr(const gert::TilingContext* context) | 161 | static ge::graphStatus CheckAttr(const gert::TilingContext* context) |
| 164 | { | 162 | { |
| 165 | - OP_LOGD(context->GetNodeName(), "checkAttr begin."); | ||
| 166 | - | ||
| 167 | auto attrs = context->GetAttrs(); | 163 | auto attrs = context->GetAttrs(); |
| 168 | OP_CHECK_NULL_WITH_CONTEXT(context, attrs); | 164 | OP_CHECK_NULL_WITH_CONTEXT(context, attrs); |
| 169 | 165 | ||
| @@ -177,17 +173,18 @@ static ge::graphStatus CheckAttr(const gert::TilingContext* context) | |||
| 177 | 173 | ||
| 178 | static ge::graphStatus GetPlatInfo(const gert::TilingContext* context, MapIndexTilingParam& tilingParam) | 174 | static ge::graphStatus GetPlatInfo(const gert::TilingContext* context, MapIndexTilingParam& tilingParam) |
| 179 | { | 175 | { |
| 180 | - OP_LOGD(context->GetNodeName(), "GetPlatInfo begin."); | ||
| 181 | auto platformInfo = context->GetPlatformInfo(); | 176 | auto platformInfo = context->GetPlatformInfo(); |
| 182 | OP_CHECK_NULL_WITH_CONTEXT(context, platformInfo); | 177 | OP_CHECK_NULL_WITH_CONTEXT(context, platformInfo); |
| 183 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 178 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 184 | tilingParam.totalCoreNum = ascendcPlatform.GetCoreNumAiv(); | 179 | tilingParam.totalCoreNum = ascendcPlatform.GetCoreNumAiv(); |
| 185 | - OP_CHECK_IF((tilingParam.totalCoreNum <= 0), OP_LOGE(context->GetNodeName(), "Failed to get core num."), | 180 | + OP_CHECK_IF((tilingParam.totalCoreNum <= 0), |
| 181 | + OP_LOGE(context->GetNodeName(), "Failed to get core num, coreNum: %ld.", tilingParam.totalCoreNum), | ||
| 186 | return ge::GRAPH_FAILED); | 182 | return ge::GRAPH_FAILED); |
| 187 | uint64_t ubSize; | 183 | uint64_t ubSize; |
| 188 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ubSize); | 184 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ubSize); |
| 189 | tilingParam.ubSize = static_cast<int64_t>(ubSize) - RESERVED_UB_SIZE; | 185 | tilingParam.ubSize = static_cast<int64_t>(ubSize) - RESERVED_UB_SIZE; |
| 190 | - OP_CHECK_IF((tilingParam.ubSize <= 0), OP_LOGE(context->GetNodeName(), "Failed to get ub size."), | 186 | + OP_CHECK_IF((tilingParam.ubSize <= 0), |
| 187 | + OP_LOGE(context->GetNodeName(), "Failed to get ub size, ubSize: %ld.", tilingParam.ubSize), | ||
| 191 | return ge::GRAPH_FAILED); | 188 | return ge::GRAPH_FAILED); |
| 192 | tilingParam.vfLen = Ops::Base::GetVRegSize(context); | 189 | tilingParam.vfLen = Ops::Base::GetVRegSize(context); |
| 193 | tilingParam.workspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); | 190 | tilingParam.workspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); |
| @@ -196,7 +193,6 @@ static ge::graphStatus GetPlatInfo(const gert::TilingContext* context, MapIndexT | |||
| 196 | 193 | ||
| 197 | static ge::graphStatus DoTiling(const gert::TilingContext* context, MapIndexTilingParam& tilingParam) | 194 | static ge::graphStatus DoTiling(const gert::TilingContext* context, MapIndexTilingParam& tilingParam) |
| 198 | { | 195 | { |
| 199 | - OP_LOGD(context->GetNodeName(), "DoTiling begin."); | ||
| 200 | tilingParam.normalCoreProcessNum = CeilDivide(tilingParam.Dim0Size, tilingParam.totalCoreNum); | 196 | tilingParam.normalCoreProcessNum = CeilDivide(tilingParam.Dim0Size, tilingParam.totalCoreNum); |
| 201 | tilingParam.usedCoreNum = CeilDivide(tilingParam.Dim0Size, tilingParam.normalCoreProcessNum); | 197 | tilingParam.usedCoreNum = CeilDivide(tilingParam.Dim0Size, tilingParam.normalCoreProcessNum); |
| 202 | tilingParam.tailCoreProcessNum = tilingParam.Dim0Size - | 198 | tilingParam.tailCoreProcessNum = tilingParam.Dim0Size - |
| @@ -229,7 +225,6 @@ static ge::graphStatus DoTiling(const gert::TilingContext* context, MapIndexTili | |||
| 229 | inline static ge::graphStatus SetTilingData(gert::TilingContext* context, const MapIndexTilingParam& tilingParam, | 225 | inline static ge::graphStatus SetTilingData(gert::TilingContext* context, const MapIndexTilingParam& tilingParam, |
| 230 | MapIndexTilingData& tilingData) | 226 | MapIndexTilingData& tilingData) |
| 231 | { | 227 | { |
| 232 | - OP_LOGD(context->GetNodeName(), "SetTilingData begin."); | ||
| 233 | tilingData.set_totalCoreNum(tilingParam.totalCoreNum); | 228 | tilingData.set_totalCoreNum(tilingParam.totalCoreNum); |
| 234 | tilingData.set_usedCoreNum(tilingParam.usedCoreNum); | 229 | tilingData.set_usedCoreNum(tilingParam.usedCoreNum); |
| 235 | tilingData.set_normalCoreProcessNum(tilingParam.normalCoreProcessNum); | 230 | tilingData.set_normalCoreProcessNum(tilingParam.normalCoreProcessNum); |
| @@ -268,8 +263,6 @@ inline static void PrintTilingData(const gert::TilingContext* context, MapIndexT | |||
| 268 | 263 | ||
| 269 | ge::graphStatus Tiling4MapIndex(gert::TilingContext* context) | 264 | ge::graphStatus Tiling4MapIndex(gert::TilingContext* context) |
| 270 | { | 265 | { |
| 271 | - OP_LOGD(context->GetNodeName(), "Tiling4MapIndex running begin."); | ||
| 272 | - | ||
| 273 | MapIndexTilingParam tilingParam; | 266 | MapIndexTilingParam tilingParam; |
| 274 | 267 | ||
| 275 | OP_CHECK_IF(CheckDtype(context, tilingParam) != ge::GRAPH_SUCCESS, | 268 | OP_CHECK_IF(CheckDtype(context, tilingParam) != ge::GRAPH_SUCCESS, |
| @@ -295,11 +288,7 @@ ge::graphStatus Tiling4MapIndex(gert::TilingContext* context) | |||
| 295 | return ge::GRAPH_SUCCESS; | 288 | return ge::GRAPH_SUCCESS; |
| 296 | } | 289 | } |
| 297 | 290 | ||
| 298 | -ge::graphStatus TilingPrepare4MapIndex(gert::TilingParseContext* context) | 291 | +ge::graphStatus TilingPrepare4MapIndex(gert::TilingParseContext* context) { return ge::GRAPH_SUCCESS; } |
| 299 | -{ | ||
| 300 | - OP_LOGD(context->GetNodeName(), "TilingPrepare4MapIndex entering."); | ||
| 301 | - return ge::GRAPH_SUCCESS; | ||
| 302 | -} | ||
| 303 | 292 | ||
| 304 | IMPL_OP_OPTILING(MapIndex).Tiling(Tiling4MapIndex).TilingParse<MapIndexCompileInfo>(TilingPrepare4MapIndex); | 293 | IMPL_OP_OPTILING(MapIndex).Tiling(Tiling4MapIndex).TilingParse<MapIndexCompileInfo>(TilingPrepare4MapIndex); |
| 305 | } // namespace optiling | 294 | } // namespace optiling |
| @@ -94,7 +94,6 @@ string QuantUpdateScatterRegbaseTiling::GetErrMsg(ge::DataType type) const | |||
| 94 | 94 | ||
| 95 | void QuantUpdateScatterRegbaseTiling::CalcTilingDataForLargeBatchLargeQuant() | 95 | void QuantUpdateScatterRegbaseTiling::CalcTilingDataForLargeBatchLargeQuant() |
| 96 | { | 96 | { |
| 97 | - OP_LOGD(context_->GetNodeName(), "enter CalcTilingDataForLargeBatchLargeQuant"); | ||
| 98 | tilingData_.set_innerLoopEle(maxUpdatesSize_ / BYTES_ONE_BLOCK * BYTES_ONE_BLOCK / updateDtypeSize_ / BUFFER_NUM); | 97 | tilingData_.set_innerLoopEle(maxUpdatesSize_ / BYTES_ONE_BLOCK * BYTES_ONE_BLOCK / updateDtypeSize_ / BUFFER_NUM); |
| 99 | tilingData_.set_innerLoopFullRpt(0); | 98 | tilingData_.set_innerLoopFullRpt(0); |
| 100 | if (tilingData_.get_innerLoopEle() == 0) { | 99 | if (tilingData_.get_innerLoopEle() == 0) { |
| @@ -114,7 +113,6 @@ void QuantUpdateScatterRegbaseTiling::CalcTilingDataForLargeBatchLargeQuant() | |||
| 114 | 113 | ||
| 115 | void QuantUpdateScatterRegbaseTiling::CalcTilingDataForLargeBatchLittleQuant() | 114 | void QuantUpdateScatterRegbaseTiling::CalcTilingDataForLargeBatchLittleQuant() |
| 116 | { | 115 | { |
| 117 | - OP_LOGD(context_->GetNodeName(), "enter CalcTilingDataForLargeBatchLittleQuant"); | ||
| 118 | int64_t updateDim3Align = tilingData_.get_updateDim3() / tilingData_.get_updateOriLastDim() * | 116 | int64_t updateDim3Align = tilingData_.get_updateDim3() / tilingData_.get_updateOriLastDim() * |
| 119 | tilingData_.get_updateOriLastDimAlign(); | 117 | tilingData_.get_updateOriLastDimAlign(); |
| 120 | int64_t innerLoopEle = maxUpdatesSize_ / BYTES_ONE_BLOCK * BYTES_ONE_BLOCK / updateDtypeSize_ / BUFFER_NUM / | 118 | int64_t innerLoopEle = maxUpdatesSize_ / BYTES_ONE_BLOCK * BYTES_ONE_BLOCK / updateDtypeSize_ / BUFFER_NUM / |
| @@ -139,7 +137,6 @@ void QuantUpdateScatterRegbaseTiling::CalcTilingDataForLargeBatchLittleQuant() | |||
| 139 | 137 | ||
| 140 | void QuantUpdateScatterRegbaseTiling::CalcTilingDataForLargeEleLargeQuant() | 138 | void QuantUpdateScatterRegbaseTiling::CalcTilingDataForLargeEleLargeQuant() |
| 141 | { | 139 | { |
| 142 | - OP_LOGD(context_->GetNodeName(), "enter CalcTilingDataForLargeEleLargeQuant"); | ||
| 143 | int64_t innerLoopEle = maxUpdatesSize_ / BYTES_ONE_BLOCK * BYTES_ONE_BLOCK / updateDtypeSize_ / BUFFER_NUM; | 140 | int64_t innerLoopEle = maxUpdatesSize_ / BYTES_ONE_BLOCK * BYTES_ONE_BLOCK / updateDtypeSize_ / BUFFER_NUM; |
| 144 | tilingData_.set_innerLoopEle(innerLoopEle); | 141 | tilingData_.set_innerLoopEle(innerLoopEle); |
| 145 | tilingData_.set_innerLoopFullRpt(0); | 142 | tilingData_.set_innerLoopFullRpt(0); |
| @@ -160,7 +157,6 @@ void QuantUpdateScatterRegbaseTiling::CalcTilingDataForLargeEleLargeQuant() | |||
| 160 | 157 | ||
| 161 | ge::graphStatus QuantUpdateScatterRegbaseTiling::CalcTilingDataForLargeEleLittleQuant() | 158 | ge::graphStatus QuantUpdateScatterRegbaseTiling::CalcTilingDataForLargeEleLittleQuant() |
| 162 | { | 159 | { |
| 163 | - OP_LOGD(context_->GetNodeName(), "enter CalcTilingDataForLargeEleLittleQuant"); | ||
| 164 | int64_t updateDim3Align = tilingData_.get_updateDim3() / tilingData_.get_updateOriLastDim() * | 160 | int64_t updateDim3Align = tilingData_.get_updateDim3() / tilingData_.get_updateOriLastDim() * |
| 165 | tilingData_.get_updateOriLastDimAlign(); | 161 | tilingData_.get_updateOriLastDimAlign(); |
| 166 | int64_t innerLoopEle = maxUpdatesSize_ / updateDtypeSize_ / BUFFER_NUM / updateDim3Align * | 162 | int64_t innerLoopEle = maxUpdatesSize_ / updateDtypeSize_ / BUFFER_NUM / updateDim3Align * |
| @@ -316,7 +312,9 @@ ge::graphStatus QuantUpdateScatterRegbaseTiling::GetTilingParam() | |||
| 316 | } | 312 | } |
| 317 | OP_LOGD(context_->GetNodeName(), "maxUpdatesSize_: %ld", maxUpdatesSize_); | 313 | OP_LOGD(context_->GetNodeName(), "maxUpdatesSize_: %ld", maxUpdatesSize_); |
| 318 | 314 | ||
| 319 | - OP_CHECK_IF(ge::GRAPH_SUCCESS != GetTilingNeg2(), OP_LOGE(context_->GetNodeName(), "some case not support."), | 315 | + OP_CHECK_IF(ge::GRAPH_SUCCESS != GetTilingNeg2(), |
| 316 | + OP_LOGE(context_->GetNodeName(), "GetTilingNeg2 failed, updateDim2: %ld, updateDim3: %ld.", | ||
| 317 | + updateNewShape_.GetDim(DIM_2), updateNewShape_.GetDim(DIM_3)), | ||
| 320 | return ge::GRAPH_FAILED); | 318 | return ge::GRAPH_FAILED); |
| 321 | return ge::GRAPH_SUCCESS; | 319 | return ge::GRAPH_SUCCESS; |
| 322 | } | 320 | } |
| @@ -651,7 +649,6 @@ void QuantUpdateScatterRegbaseTiling::PrintDebugInfo() | |||
| 651 | 649 | ||
| 652 | ge::graphStatus QuantUpdateScatterRegbaseTiling::DoTiling() | 650 | ge::graphStatus QuantUpdateScatterRegbaseTiling::DoTiling() |
| 653 | { | 651 | { |
| 654 | - OP_LOGD(context_->GetNodeName(), "Enter quant_update_scatter_regbase dotiling!"); | ||
| 655 | OP_CHECK_IF(PrepareTilingParams() != ge::GRAPH_SUCCESS, | 652 | OP_CHECK_IF(PrepareTilingParams() != ge::GRAPH_SUCCESS, |
| 656 | OP_LOGE(context_->GetNodeName(), "PrepareTilingParams failed!"), return ge::GRAPH_FAILED); | 653 | OP_LOGE(context_->GetNodeName(), "PrepareTilingParams failed!"), return ge::GRAPH_FAILED); |
| 657 | OP_CHECK_IF(VerifyNullTenosr() != ge::GRAPH_SUCCESS, OP_LOGE(context_->GetNodeName(), "VerifyNullTenosr failed!"), | 654 | OP_CHECK_IF(VerifyNullTenosr() != ge::GRAPH_SUCCESS, OP_LOGE(context_->GetNodeName(), "VerifyNullTenosr failed!"), |
| @@ -693,7 +690,6 @@ static ge::graphStatus Tiling4QuantUpdateScatter(gert::TilingContext* context) | |||
| 693 | { | 690 | { |
| 694 | auto compileInfo = context->GetCompileInfo<QuantUpdateScatterCompileInfo>(); | 691 | auto compileInfo = context->GetCompileInfo<QuantUpdateScatterCompileInfo>(); |
| 695 | OP_CHECK_NULL_WITH_CONTEXT(context, compileInfo); | 692 | OP_CHECK_NULL_WITH_CONTEXT(context, compileInfo); |
| 696 | - OP_LOGD(context->GetNodeName(), "Enter new QuantUpdateScatterTiling"); | ||
| 697 | QuantUpdateScatterRegbaseTiling tiling(context); | 693 | QuantUpdateScatterRegbaseTiling tiling(context); |
| 698 | return tiling.DoTiling(); | 694 | return tiling.DoTiling(); |
| 699 | } | 695 | } |
| @@ -72,33 +72,32 @@ bool SparseSliceTiling::UseSIMT() | |||
| 72 | 72 | ||
| 73 | ge::graphStatus SparseSliceTiling::GetShapeAttrsInfo() | 73 | ge::graphStatus SparseSliceTiling::GetShapeAttrsInfo() |
| 74 | { | 74 | { |
| 75 | - OP_LOGD(context_->GetNodeName(), "Enter SparseSliceTiling GetShapeAttrsInfo."); | ||
| 76 | OP_TILING_CHECK(CheckDtype() != ge::GRAPH_SUCCESS, OP_LOGE(context_->GetNodeName(), "Check datatype failed. "), | 75 | OP_TILING_CHECK(CheckDtype() != ge::GRAPH_SUCCESS, OP_LOGE(context_->GetNodeName(), "Check datatype failed. "), |
| 77 | return ge::GRAPH_FAILED); | 76 | return ge::GRAPH_FAILED); |
| 78 | OP_TILING_CHECK(CheckShape() != ge::GRAPH_SUCCESS, OP_LOGE(context_->GetNodeName(), "Check shape failed. "), | 77 | OP_TILING_CHECK(CheckShape() != ge::GRAPH_SUCCESS, OP_LOGE(context_->GetNodeName(), "Check shape failed. "), |
| 79 | return ge::GRAPH_FAILED); | 78 | return ge::GRAPH_FAILED); |
| 80 | - OP_LOGD(context_->GetNodeName(), "End SparseSliceTiling GetShapeAttrsInfo."); | ||
| 81 | 79 | ||
| 82 | return ge::GRAPH_SUCCESS; | 80 | return ge::GRAPH_SUCCESS; |
| 83 | } | 81 | } |
| 84 | 82 | ||
| 85 | ge::graphStatus SparseSliceTiling::GetPlatformInfo() | 83 | ge::graphStatus SparseSliceTiling::GetPlatformInfo() |
| 86 | { | 84 | { |
| 87 | - OP_LOGD(context_->GetNodeName(), "Enter SparseSliceTiling GetPlatformInfo."); | ||
| 88 | auto platformInfo = context_->GetPlatformInfo(); | 85 | auto platformInfo = context_->GetPlatformInfo(); |
| 89 | OP_CHECK_NULL_WITH_CONTEXT(context_, platformInfo); | 86 | OP_CHECK_NULL_WITH_CONTEXT(context_, platformInfo); |
| 90 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 87 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 91 | tilingParams.totalCoreNum = ascendcPlatform.GetCoreNumAiv(); | 88 | tilingParams.totalCoreNum = ascendcPlatform.GetCoreNumAiv(); |
| 92 | - OP_TILING_CHECK((tilingParams.totalCoreNum <= 0), OP_LOGE(context_->GetNodeName(), "Failed to core num."), | 89 | + OP_TILING_CHECK( |
| 93 | - return ge::GRAPH_FAILED); | 90 | + (tilingParams.totalCoreNum <= 0), |
| 91 | + OP_LOGE(context_->GetNodeName(), "Failed to get core num, coreNum: %ld.", tilingParams.totalCoreNum), | ||
| 92 | + return ge::GRAPH_FAILED); | ||
| 94 | uint64_t ubSize; | 93 | uint64_t ubSize; |
| 95 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ubSize); | 94 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ubSize); |
| 96 | tilingParams.ubSize = static_cast<int64_t>(ubSize) - RESERVED_UB_SIZE; | 95 | tilingParams.ubSize = static_cast<int64_t>(ubSize) - RESERVED_UB_SIZE; |
| 97 | - OP_TILING_CHECK((tilingParams.ubSize <= 0), OP_LOGE(context_->GetNodeName(), "Failed to get ub size."), | 96 | + OP_TILING_CHECK((tilingParams.ubSize <= 0), |
| 97 | + OP_LOGE(context_->GetNodeName(), "Failed to get ub size, ubSize: %ld.", tilingParams.ubSize), | ||
| 98 | return ge::GRAPH_FAILED); | 98 | return ge::GRAPH_FAILED); |
| 99 | tilingParams.vfLen = Ops::Base::GetVRegSize(context_); | 99 | tilingParams.vfLen = Ops::Base::GetVRegSize(context_); |
| 100 | tilingParams.workspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); | 100 | tilingParams.workspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); |
| 101 | - OP_LOGD(context_->GetNodeName(), "End SparseSliceTiling GetPlatformInfo."); | ||
| 102 | 101 | ||
| 103 | return ge::GRAPH_SUCCESS; | 102 | return ge::GRAPH_SUCCESS; |
| 104 | } | 103 | } |
| @@ -107,7 +106,6 @@ bool SparseSliceTiling::IsCapable() { return true; } | |||
| 107 | 106 | ||
| 108 | ge::graphStatus SparseSliceTiling::DoOpTiling() | 107 | ge::graphStatus SparseSliceTiling::DoOpTiling() |
| 109 | { | 108 | { |
| 110 | - OP_LOGD(context_->GetNodeName(), "Enter SparseSliceTiling DoOpTiling."); | ||
| 111 | ge::graphStatus res = SetTilingParams(); | 109 | ge::graphStatus res = SetTilingParams(); |
| 112 | OP_TILING_CHECK(res != ge::GRAPH_SUCCESS, | 110 | OP_TILING_CHECK(res != ge::GRAPH_SUCCESS, |
| 113 | OP_LOGE(context_->GetNodeName(), "SparseSliceTiling SetTilingParams Failed"), return res); | 111 | OP_LOGE(context_->GetNodeName(), "SparseSliceTiling SetTilingParams Failed"), return res); |
| @@ -275,7 +273,6 @@ ge::graphStatus SparseSliceTiling::CheckShape() | |||
| 275 | 273 | ||
| 276 | ge::graphStatus SparseSliceTiling::SetTilingParams() | 274 | ge::graphStatus SparseSliceTiling::SetTilingParams() |
| 277 | { | 275 | { |
| 278 | - OP_LOGD(context_->GetNodeName(), "Enter SparseSliceTiling SetTilingParams."); | ||
| 279 | auto indicesPtr = context_->GetInputShape(0); | 276 | auto indicesPtr = context_->GetInputShape(0); |
| 280 | auto indicesShape = indicesPtr->GetStorageShape(); | 277 | auto indicesShape = indicesPtr->GetStorageShape(); |
| 281 | tilingParams.valueNumbers = static_cast<int64_t>(indicesShape.GetDim(0)); | 278 | tilingParams.valueNumbers = static_cast<int64_t>(indicesShape.GetDim(0)); |
| @@ -349,7 +346,6 @@ void SparseSliceTiling::PrintTilingData() | |||
| 349 | 346 | ||
| 350 | ge::graphStatus SparseSliceTiling::CalcYShape() | 347 | ge::graphStatus SparseSliceTiling::CalcYShape() |
| 351 | { | 348 | { |
| 352 | - OP_LOGD(context_->GetNodeName(), "Begin calculate y_shape. "); | ||
| 353 | const gert::Tensor* shapeTensor = context_->GetInputTensor(DIGIT_TWO); | 349 | const gert::Tensor* shapeTensor = context_->GetInputTensor(DIGIT_TWO); |
| 354 | const gert::Tensor* startTensor = context_->GetInputTensor(DIGIT_THREE); | 350 | const gert::Tensor* startTensor = context_->GetInputTensor(DIGIT_THREE); |
| 355 | const gert::Tensor* sizeTensor = context_->GetInputTensor(DIGIT_FOUR); | 351 | const gert::Tensor* sizeTensor = context_->GetInputTensor(DIGIT_FOUR); |
| @@ -394,7 +390,6 @@ ge::graphStatus SparseSliceTiling::CalcYShape() | |||
| 394 | tilingData.set_sliceStart(tilingParams.sliceStart); | 390 | tilingData.set_sliceStart(tilingParams.sliceStart); |
| 395 | tilingData.set_sliceEnd(tilingParams.sliceEnd); | 391 | tilingData.set_sliceEnd(tilingParams.sliceEnd); |
| 396 | OP_LOGD(context_->GetNodeName(), "Print Y shape is empty: %d. ", tilingParams.IsEmptyYShape); | 392 | OP_LOGD(context_->GetNodeName(), "Print Y shape is empty: %d. ", tilingParams.IsEmptyYShape); |
| 397 | - OP_LOGD(context_->GetNodeName(), "End Calculate Y shape. "); | ||
| 398 | return ge::GRAPH_SUCCESS; | 393 | return ge::GRAPH_SUCCESS; |
| 399 | } | 394 | } |
| 400 | 395 | ||
| @@ -426,8 +421,6 @@ static ge::graphStatus Tiling4SparseSlice(gert::TilingContext* context_) | |||
| 426 | 421 | ||
| 427 | ge::graphStatus TilingPrepare4SparseSlice(gert::TilingParseContext* context_) | 422 | ge::graphStatus TilingPrepare4SparseSlice(gert::TilingParseContext* context_) |
| 428 | { | 423 | { |
| 429 | - OP_LOGD(context_->GetNodeName(), "TilingPrepare4SparseSlice entering."); | ||
| 430 | - | ||
| 431 | auto compileInfo = GetCompileInfoPtr<SparseSliceCompileInfo>(context_); | 424 | auto compileInfo = GetCompileInfoPtr<SparseSliceCompileInfo>(context_); |
| 432 | OP_CHECK_NULL_WITH_CONTEXT(context_, compileInfo); | 425 | OP_CHECK_NULL_WITH_CONTEXT(context_, compileInfo); |
| 433 | auto platformInfo = context_->GetPlatformInfo(); | 426 | auto platformInfo = context_->GetPlatformInfo(); |
| @@ -448,4 +441,4 @@ IMPL_OP_OPTILING(SparseSlice) | |||
| 448 | .Tiling(Tiling4SparseSlice) | 441 | .Tiling(Tiling4SparseSlice) |
| 449 | .TilingParse<SparseSliceCompileInfo>(TilingPrepare4SparseSlice) | 442 | .TilingParse<SparseSliceCompileInfo>(TilingPrepare4SparseSlice) |
| 450 | .TilingInputsDataDependency({SHAPE_IDX, START_IDX, SIZE_IDX}); | 443 | .TilingInputsDataDependency({SHAPE_IDX, START_IDX, SIZE_IDX}); |
| 451 | -} // namespace optiling | 444 | +} // namespace optiling |
| @@ -8,6 +8,7 @@ | |||
| 8 | # See LICENSE in the root of the software repository for the full text of the License. | 8 | # See LICENSE in the root of the software repository for the full text of the License. |
| 9 | # ----------------------------------------------------------------------------------------------------------- | 9 | # ----------------------------------------------------------------------------------------------------------- |
| 10 | 10 | ||
| 11 | +import fcntl | ||
| 11 | import os | 12 | import os |
| 12 | import shutil | 13 | import shutil |
| 13 | from abc import ABC, abstractmethod | 14 | from abc import ABC, abstractmethod |
| @@ -177,24 +178,36 @@ class OpBuilder(ABC): | |||
| 177 | f"please install it via 'pip install ninja'" | 178 | f"please install it via 'pip install ninja'" |
| 178 | ) | 179 | ) |
| 179 | 180 | ||
| 180 | - try: | 181 | + ext_dir = os.path.expanduser( |
| 181 | - op_module = load( | 182 | + os.environ.get( |
| 182 | - name=self.name, | 183 | + "TORCH_EXTENSIONS_DIR", os.path.join("~", ".cache", "torch_extensions") |
| 183 | - sources=self.get_absolute_paths(self.sources()), | ||
| 184 | - extra_include_paths=self.get_absolute_paths(self.include_paths()), | ||
| 185 | - extra_cflags=self.cxx_args(), | ||
| 186 | - extra_ldflags=self.extra_ldflags(), | ||
| 187 | - verbose=verbose, | ||
| 188 | ) | 184 | ) |
| 189 | - except Exception as e: | 185 | + ) |
| 190 | - raise RuntimeError( | 186 | + os.makedirs(ext_dir, exist_ok=True) |
| 191 | - f"Failed to JIT compile operator '{self.name}': {e}\n" | 187 | + lock_path = os.path.join(ext_dir, f"{self.name}.compile.lock") |
| 192 | - f"Common causes:\n" | ||
| 193 | - f" 1. CANN toolkit not sourced: source <cann_path>/set_env.sh\n" | ||
| 194 | - f" 2. Missing compiler: ensure gcc/g++ in PATH\n" | ||
| 195 | - f" 3. Missing ninja: pip install ninja" | ||
| 196 | - ) from e | ||
| 197 | 188 | ||
| 198 | - OpBuilder._loaded_ops[self.name] = op_module | 189 | + with open(lock_path, "w") as lock_file: |
| 190 | + fcntl.flock(lock_file, fcntl.LOCK_EX) | ||
| 191 | + if self.name in OpBuilder._loaded_ops: | ||
| 192 | + return OpBuilder._loaded_ops[self.name] | ||
| 199 | 193 | ||
| 200 | - return op_module | 194 | + try: |
| 195 | + op_module = load( | ||
| 196 | + name=self.name, | ||
| 197 | + sources=self.get_absolute_paths(self.sources()), | ||
| 198 | + extra_include_paths=self.get_absolute_paths(self.include_paths()), | ||
| 199 | + extra_cflags=self.cxx_args(), | ||
| 200 | + extra_ldflags=self.extra_ldflags(), | ||
| 201 | + verbose=verbose, | ||
| 202 | + ) | ||
| 203 | + except Exception as e: | ||
| 204 | + raise RuntimeError( | ||
| 205 | + f"Failed to JIT compile operator '{self.name}': {e}\n" | ||
| 206 | + f"Common causes:\n" | ||
| 207 | + f" 1. CANN toolkit not sourced: source <cann_path>/set_env.sh\n" | ||
| 208 | + f" 2. Missing compiler: ensure gcc/g++ in PATH\n" | ||
| 209 | + f" 3. Missing ninja: pip install ninja" | ||
| 210 | + ) from e | ||
| 211 | + | ||
| 212 | + OpBuilder._loaded_ops[self.name] = op_module | ||
| 213 | + return op_module | ||