已合并
legacy下线:ThresholdGradV2D新增tiling/infer调试日志+op_graph InferDataType迁移 #9507
legacy下线:ThresholdGradV2D新增tiling/infer调试日志+op_graph InferDataType迁移 #9507
已合并
liuyi2025创建于 8 天前
4 个文件变更+53-0
@@ -0,0 +1,13 @@
1+# ----------------------------------------------------------------------------
2+# Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4+# CANN Open Software License Agreement Version 2.0 (the "License").
5+# Please refer to the License for details. You may not use this file except in compliance with the License.
6+# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7+# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8+# See LICENSE in the root of the software repository for the full text of the License.
9+# ----------------------------------------------------------------------------
10+# Generated By CANNBot
11+ 
12+message(STATUS "=== Debug: start ops.activation.threshold_grad_v2_d.op_graph.CMakeLists.txt ")
13+add_graph_plugin_sources()
@@ -0,0 +1,35 @@
1+/**
T
Ttangweiwei28 天前

[PR描述规范性] 本 PR 未关联任何 Issue。建议补充关联 Issue 链接(如 Fixes #xxx 或关联Issue #xxx),便于追溯需求来源和闭环管理。

likedislike
liuyi2025
7 天前 评论:
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4+ * CANN Open Software License Agreement Version 2.0 (the "License").
5+ * Please refer to the License for details. You may not use this file except in compliance with the License.
6+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7+ * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8+ * See LICENSE in the root of the software repository for the full text of the License.
9+ */
10+ 
11+/* Generated By CANNBot */
12+ 
13+/*!
14+ * \file threshold_grad_v2_d_graph_infer.cpp
15+ * \brief ThresholdGradV2D graph InferDataType implementation
16+ */
17+ 
18+#include "register/op_impl_registry.h"
19+#include "log/log.h"
20+ 
21+using namespace ge;
22+ 
23+namespace ops {
24+static constexpr int64_t IDX_0 = 0;
25+ 
26+static ge::graphStatus InferDataType4ThresholdGradV2D(gert::InferDataTypeContext* context)
27+{
28+ OP_LOGD(context->GetNodeName(), "Begin to do InferDataType4ThresholdGradV2D");
29+ context->SetOutputDataType(IDX_0, context->GetInputDataType(IDX_0));
30+ OP_LOGD(context->GetNodeName(), "End to do InferDataType4ThresholdGradV2D");
31+ return ge::GRAPH_SUCCESS;
32+}
33+ 
34+IMPL_OP(ThresholdGradV2D).InferDataType(InferDataType4ThresholdGradV2D);
35+} // namespace ops
@@ -117,6 +117,8 @@ ge::graphStatus ThresholdGradV2DTiling::DoOpTiling()
117 return ge::GRAPH_FAILED;117 return ge::GRAPH_FAILED;
118 }118 }
119 119 
120+ OP_LOGI(context_->GetNodeName(), "[TilingData] tilingKey=%lu, threshold=%f", tilingKey, (double)thresHold);
121+ 
120 return ge::GRAPH_SUCCESS;122 return ge::GRAPH_SUCCESS;
121}123}
122 124 
@@ -139,6 +141,7 @@ ge::graphStatus TilingForThresholdGradV2D(gert::TilingContext* context)
139 }141 }
140 auto compileInfo = reinterpret_cast<const BroadcastCompileInfo*>(context->GetCompileInfo());142 auto compileInfo = reinterpret_cast<const BroadcastCompileInfo*>(context->GetCompileInfo());
141 OP_CHECK_NULL_WITH_CONTEXT(context, compileInfo);143 OP_CHECK_NULL_WITH_CONTEXT(context, compileInfo);
144+ OP_LOGD(context->GetNodeName(), "Begin the tiling process for Arch35 architecture");
142 OP_LOGD("ThresholdGradV2DTiling", "Enter new ThresholdGradV2DTiling");145 OP_LOGD("ThresholdGradV2DTiling", "Enter new ThresholdGradV2DTiling");
143 ThresholdGradV2DTiling tiling(context);146 ThresholdGradV2DTiling tiling(context);
144 return tiling.DoTiling();147 return tiling.DoTiling();
@@ -15,6 +15,7 @@
15 * \brief ThresholdGradV2D 形状/类型推导: out = broadcast(gradOutput, self), dtype=gradOutput15 * \brief ThresholdGradV2D 形状/类型推导: out = broadcast(gradOutput, self), dtype=gradOutput
16 */16 */
17 17 
18+#include "util/shape_util.h"
18#include "register/op_impl_registry.h"19#include "register/op_impl_registry.h"
19#include "exe_graph/runtime/infer_shape_context.h"20#include "exe_graph/runtime/infer_shape_context.h"
20#include "exe_graph/runtime/infer_datatype_context.h"21#include "exe_graph/runtime/infer_datatype_context.h"
@@ -43,6 +44,7 @@ static ge::graphStatus InferShape4ThresholdGradV2D(gert::InferShapeContext* cont
43 int64_t sd = (i < rn - sn) ? 1 : s->GetDim(i - (rn - sn));44 int64_t sd = (i < rn - sn) ? 1 : s->GetDim(i - (rn - sn));
44 out->SetDim(i, gd > sd ? gd : sd);45 out->SetDim(i, gd > sd ? gd : sd);
45 }46 }
47+ OP_LOGI(context->GetNodeName(), "[InferShape] output shape=%s", Ops::Base::ToString(*out).c_str());
46 return ge::GRAPH_SUCCESS;48 return ge::GRAPH_SUCCESS;
47}49}
48 50