已合并
【fix】: code warning #4795
tang-haojie创建于 9月8日
【fix】: code warning #4795
已合并
共 5 个文件变更+20-9
| @@ -479,7 +479,7 @@ int32_t SuperKernelPass::GetScopeIdByCtrlEdge(const NodePtr &node, bool is_send) | |||
| 479 | return GetScopeId(related_node); | 479 | return GetScopeId(related_node); |
| 480 | } | 480 | } |
| 481 | 481 | ||
| 482 | -uint32_t SuperKernelPass::GetEventId(const NodePtr &node) { | 482 | +uint32_t SuperKernelPass::GetEventId(const NodePtr &node) const { |
| 483 | uint32_t event_id = 0; | 483 | uint32_t event_id = 0; |
| 484 | auto type = node->GetType(); | 484 | auto type = node->GetType(); |
| 485 | if (type == SENDNOTIFY) { | 485 | if (type == SENDNOTIFY) { |
| @@ -494,7 +494,7 @@ uint32_t SuperKernelPass::GetEventId(const NodePtr &node) { | |||
| 494 | return event_id; | 494 | return event_id; |
| 495 | } | 495 | } |
| 496 | 496 | ||
| 497 | -aclskScopeVerifyKernelType SuperKernelPass::GetKernelType(const NodePtr &node) { | 497 | +aclskScopeVerifyKernelType SuperKernelPass::GetKernelType(const NodePtr &node) const { |
| 498 | std::string core_type; | 498 | std::string core_type; |
| 499 | (void)AttrUtils::GetStr(node->GetOpDescBarePtr(), ATTR_NAME_CUBE_VECTOR_CORE_TYPE, core_type); | 499 | (void)AttrUtils::GetStr(node->GetOpDescBarePtr(), ATTR_NAME_CUBE_VECTOR_CORE_TYPE, core_type); |
| 500 | if (core_type == "AIC") { | 500 | if (core_type == "AIC") { |
| @@ -510,7 +510,7 @@ aclskScopeVerifyKernelType SuperKernelPass::GetKernelType(const NodePtr &node) { | |||
| 510 | } | 510 | } |
| 511 | 511 | ||
| 512 | void SuperKernelPass::FillCoreLimit(const OpDesc *op_desc, aclskScopeVerifyNodeInfo &info, int32_t ai_core_cnt_global, | 512 | void SuperKernelPass::FillCoreLimit(const OpDesc *op_desc, aclskScopeVerifyNodeInfo &info, int32_t ai_core_cnt_global, |
| 513 | - int32_t vector_core_cnt_global) { | 513 | + int32_t vector_core_cnt_global) const { |
| 514 | info.flag = 0U; | 514 | info.flag = 0U; |
| 515 | info.coreLimit[0] = ai_core_cnt_global; | 515 | info.coreLimit[0] = ai_core_cnt_global; |
| 516 | info.coreLimit[1] = vector_core_cnt_global; | 516 | info.coreLimit[1] = vector_core_cnt_global; |
| @@ -104,7 +104,7 @@ class SuperKernelPass : public GraphPass { | |||
| 104 | bool FillVerifyNodeInfo(const NodePtr &node, aclskScopeVerifyNodeInfo &info, int32_t ai_core_cnt_global, | 104 | bool FillVerifyNodeInfo(const NodePtr &node, aclskScopeVerifyNodeInfo &info, int32_t ai_core_cnt_global, |
| 105 | int32_t vector_core_cnt_global); | 105 | int32_t vector_core_cnt_global); |
| 106 | void FillCoreLimit(const OpDesc *op_desc, aclskScopeVerifyNodeInfo &info, int32_t ai_core_cnt_global, | 106 | void FillCoreLimit(const OpDesc *op_desc, aclskScopeVerifyNodeInfo &info, int32_t ai_core_cnt_global, |
| 107 | - int32_t vector_core_cnt_global); | 107 | + int32_t vector_core_cnt_global) const; |
| 108 | Status CallAclskVerify(const ComputeGraphPtr &graph, std::vector<aclskScopeVerifyNodeInfo> &verify_nodes, | 108 | Status CallAclskVerify(const ComputeGraphPtr &graph, std::vector<aclskScopeVerifyNodeInfo> &verify_nodes, |
| 109 | std::vector<NodePtr> &node_mapping, std::vector<aclskScopeVerifySplitResult> &split_results); | 109 | std::vector<NodePtr> &node_mapping, std::vector<aclskScopeVerifySplitResult> &split_results); |
| 110 | bool IsFirstNodeInScope(const std::string &scope_name, int64_t topo_id); | 110 | bool IsFirstNodeInScope(const std::string &scope_name, int64_t topo_id); |
| @@ -115,10 +115,10 @@ class SuperKernelPass : public GraphPass { | |||
| 115 | const aclskScopeVerifyNodeInfo *verify_nodes_base, | 115 | const aclskScopeVerifyNodeInfo *verify_nodes_base, |
| 116 | const std::vector<NodePtr> &node_mapping, std::set<std::string> &need_split_scopes, | 116 | const std::vector<NodePtr> &node_mapping, std::set<std::string> &need_split_scopes, |
| 117 | std::map<std::string, std::vector<ScopeCutPoint>> &scope_cut_id); | 117 | std::map<std::string, std::vector<ScopeCutPoint>> &scope_cut_id); |
| 118 | - aclskScopeVerifyKernelType GetKernelType(const NodePtr &node); | 118 | + aclskScopeVerifyKernelType GetKernelType(const NodePtr &node) const; |
| 119 | int32_t GetScopeId(const NodePtr &node); | 119 | int32_t GetScopeId(const NodePtr &node); |
| 120 | int32_t GetScopeIdByCtrlEdge(const NodePtr &node, bool is_send); | 120 | int32_t GetScopeIdByCtrlEdge(const NodePtr &node, bool is_send); |
| 121 | - uint32_t GetEventId(const NodePtr &node); | 121 | + uint32_t GetEventId(const NodePtr &node) const; |
| 122 | 122 | ||
| 123 | std::map<std::string, std::vector<NodePtr>> ori_super_nodes_; | 123 | std::map<std::string, std::vector<NodePtr>> ori_super_nodes_; |
| 124 | std::map<std::string, std::map<int64_t, std::vector<size_t>>> ori_super_nodes_id_; | 124 | std::map<std::string, std::map<int64_t, std::vector<size_t>>> ori_super_nodes_id_; |
| @@ -1,3 +1,7 @@ | |||
| 1 | +#!/usr/bin/env python3 | ||
| 2 | +# -*- coding: utf-8 -*- | ||
| 3 | +# ------------------------------------------------------------------- | ||
| 4 | +# ----------------------------------------------------------------------------------------------------------- | ||
| 1 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 5 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 2 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of | 6 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 3 | # CANN Open Software License Agreement Version 2.0 (the "License"). | 7 | # CANN Open Software License Agreement Version 2.0 (the "License"). |
| @@ -14,9 +18,11 @@ def generate_tf_model(): | |||
| 14 | b = tf.compat.v1.placeholder(tf.float32, shape=[3, 2], name="b") | 18 | b = tf.compat.v1.placeholder(tf.float32, shape=[3, 2], name="b") |
| 15 | matmul = tf.linalg.matmul(a, b, name="matmul") | 19 | matmul = tf.linalg.matmul(a, b, name="matmul") |
| 16 | c = tf.compat.v1.placeholder(tf.float32, shape=[2, 2], name="c") | 20 | c = tf.compat.v1.placeholder(tf.float32, shape=[2, 2], name="c") |
| 17 | - add = tf.add(matmul, c, name="add") | 21 | + tf.add(matmul, c, name="add") |
| 18 | - with tf.compat.v1.Session() as sess: | 22 | + with tf.compat.v1.Session(): |
| 19 | - tf.io.write_graph(tf.compat.v1.get_default_graph(), ".", "./matmul_add.pb", as_text=False) | 23 | + tf.io.write_graph( |
| 24 | + tf.compat.v1.get_default_graph(), ".", "./matmul_add.pb", as_text=False | ||
| 25 | + ) | ||
| 20 | print("Create Model Successful.") | 26 | print("Create Model Successful.") |
| 21 | 27 | ||
| 22 | 28 | ||
| @@ -1,3 +1,7 @@ | |||
| 1 | +#!/usr/bin/env python3 | ||
| 2 | +# -*- coding: utf-8 -*- | ||
| 3 | +# ------------------------------------------------------------------- | ||
| 4 | +# ----------------------------------------------------------------------------------------------------------- | ||
| 1 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 5 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 2 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of | 6 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 3 | # CANN Open Software License Agreement Version 2.0 (the "License"). | 7 | # CANN Open Software License Agreement Version 2.0 (the "License"). |
| @@ -150,6 +150,7 @@ ge::graphStatus DeviceHbmToHostPermanent(const ge::Node *node, LoweringGlobalDat | |||
| 150 | GE_ASSERT_NOTNULL(allocator_holder); | 150 | GE_ASSERT_NOTNULL(allocator_holder); |
| 151 | auto dst_address = bg::DevMemValueHolder::CreateSingleDataOutput( | 151 | auto dst_address = bg::DevMemValueHolder::CreateSingleDataOutput( |
| 152 | "CopyD2H", {src.address, tensor_size, allocator_holder}, src_logic_stream_id); | 152 | "CopyD2H", {src.address, tensor_size, allocator_holder}, src_logic_stream_id); |
| 153 | + GE_ASSERT_NOTNULL(dst_address); | ||
| 153 | bg::ValueHolder::AddDependency(sync_stream_holder, dst_address); | 154 | bg::ValueHolder::AddDependency(sync_stream_holder, dst_address); |
| 154 | 155 | ||
| 155 | dst.order_holders.clear(); | 156 | dst.order_holders.clear(); |