Browse Source

!1807 回退 'Pull Request ls : Adaptation rectification of op_tiling.'

From: @zhao_zhixuan
Reviewed-by: @xchu42,@wqtshg
Signed-off-by: @wqtshg
tags/v1.3.0
mindspore-ci-bot Gitee 3 years ago
parent
commit
076e4222ed
3 changed files with 21 additions and 20 deletions
  1. +12
    -12
      ge/hybrid/node_executor/aicore/aicore_op_task.cc
  2. +2
    -2
      ge/hybrid/node_executor/aicore/aicore_op_task.h
  3. +7
    -6
      ge/single_op/task/op_task.cc

+ 12
- 12
ge/hybrid/node_executor/aicore/aicore_op_task.cc View File

@@ -25,7 +25,7 @@
#include "single_op/task/build_task_utils.h"
#include "single_op/task/tbe_task_builder.h"

using optiling::utils::OpRunInfo;
using optiling::OpRunInfo;

namespace ge {
namespace hybrid {
@@ -359,7 +359,9 @@ Status AiCoreOpTask::UpdateTilingInfo(TaskContext &context) {
GE_CHECK_NOTNULL(op_desc);

GELOGD("[%s] Start to update tiling info for task: [%s]", node->GetName().c_str(), stub_name_.c_str());
OpRunInfo tiling_info(-1, true, 0);
OpRunInfo tiling_info;
tiling_info.block_dim = -1; // codex: Using uninitialized value
tiling_info.clear_atomic = true;

auto execution_context = context.GetExecutionContext();

@@ -368,14 +370,12 @@ Status AiCoreOpTask::UpdateTilingInfo(TaskContext &context) {
RECORD_EXECUTION_EVENT(execution_context, context.GetNodeName(), "[CalcTilingInfo] End");

// update op args by tiling info
block_dim_ = tiling_info.GetBlockDim();
clear_atomic_ = tiling_info.GetClearAtomic();
std::vector<int64_t> workspaces;
tiling_info.GetAllWorkspaces(workspaces);
op_desc->SetWorkspaceBytes(workspaces);

tiling_data_ = tiling_info.GetAllTilingData().str();
tiling_key_ = tiling_info.GetTilingKey();
block_dim_ = static_cast<uint32_t>(tiling_info.block_dim);
op_desc->SetWorkspaceBytes(tiling_info.workspaces);
clear_atomic_ = tiling_info.clear_atomic;

tiling_data_ = tiling_info.tiling_data.str();
tiling_key_ = tiling_info.tiling_key;
GELOGD("Successfully getting [tiling_key] : %u", tiling_key_);
if (tiling_data_.empty()) {
GELOGD("[%s] Tiling data is empty.", op_desc->GetName().c_str());
@@ -412,7 +412,7 @@ Status AiCoreOpTask::UpdateTilingInfo(TaskContext &context) {

Status AiCoreOpTask::CalcTilingInfo(const NodePtr &node, OpRunInfo &tiling_info) {
GELOGD("[%s] Start to invoke OpParaCalculate.", node->GetName().c_str());
GE_CHK_STATUS_RET(optiling::OpParaCalculateV2(*node, tiling_info),
GE_CHK_STATUS_RET(OpParaCalculate(*node, tiling_info),
"[Invoke][OpParaCalculate]Failed calc tiling data of node %s.",
node->GetName().c_str());
GELOGD("[%s] Done invoking OpParaCalculate successfully.", node->GetName().c_str());
@@ -633,7 +633,7 @@ std::string AtomicAddrCleanOpTask::GetKeyForKernelName(const OpDesc &op_desc) co

Status AtomicAddrCleanOpTask::CalcTilingInfo(const NodePtr &node, OpRunInfo &tiling_info) {
GELOGD("[%s] Start to invoke OpAtomicCalculate.", node->GetName().c_str());
GE_CHK_STATUS_RET(optiling::OpAtomicCalculateV2(*node, tiling_info),
GE_CHK_STATUS_RET(OpAtomicCalculate(*node, tiling_info),
"[Invoke][OpAtomicCalculate]Failed calc tiling data of node %s.",
node->GetName().c_str());
GELOGD("[%s] Done invoking OpAtomicCalculate successfully.", node->GetName().c_str());


+ 2
- 2
ge/hybrid/node_executor/aicore/aicore_op_task.h View File

@@ -85,7 +85,7 @@ class AiCoreOpTask {
virtual std::string GetKeyForTvmMagic() const;
virtual std::string GetKeyForTvmMetaData() const;
virtual std::string GetKeyForKernelName(const OpDesc &op_desc) const;
virtual Status CalcTilingInfo(const NodePtr &node, optiling::utils::OpRunInfo &tiling_info);
virtual Status CalcTilingInfo(const NodePtr &node, optiling::OpRunInfo &tiling_info);

std::unique_ptr<TensorBuffer> tiling_buffer_ = nullptr;
std::string tiling_data_;
@@ -130,7 +130,7 @@ class AtomicAddrCleanOpTask : public AiCoreOpTask {
std::string GetKeyForTvmMagic() const override;
std::string GetKeyForTvmMetaData() const override;
std::string GetKeyForKernelName(const OpDesc &op_desc) const override;
Status CalcTilingInfo(const NodePtr &node, optiling::utils::OpRunInfo &tiling_info) override;
Status CalcTilingInfo(const NodePtr &node, optiling::OpRunInfo &tiling_info) override;

private:
Status InitAtomicAddrCleanIndices(const OpDesc &op_desc);


+ 7
- 6
ge/single_op/task/op_task.cc View File

@@ -224,17 +224,18 @@ Status TbeOpTask::LaunchKernel(rtStream_t stream) {
Status TbeOpTask::UpdateRunInfo() {
// invoke OpParaCalculate
GELOGD("Start to invoke OpParaCalculate.");
optiling::utils::OpRunInfo run_info(0, true, 0);
auto ret = optiling::OpParaCalculateV2(*node_, run_info);
optiling::OpRunInfo run_info;
run_info.block_dim = 0;
auto ret = optiling::OpParaCalculate(*node_, run_info);
if (ret != GRAPH_SUCCESS) {
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Invoke][OpParaCalculate] failed, ret = %u.", ret);
REPORT_INNER_ERROR("E19999", "invoke OpParaCalculate failed, ret = %u.", ret);
return ACL_ERROR_GE_INTERNAL_ERROR;
}
block_dim_ = run_info.GetBlockDim();
tiling_data_ = run_info.GetAllTilingData().str();
tiling_key_ = run_info.GetTilingKey();
run_info.GetAllWorkspaces(run_info_workspaces_);
block_dim_ = run_info.block_dim;
tiling_data_ = run_info.tiling_data.str();
tiling_key_ = run_info.tiling_key;
run_info_workspaces_ = run_info.workspaces;
GELOGD("Done invoking OpParaCalculate successfully. block_dim = %u, tiling size = %zu, tiling_key = %u", block_dim_,
tiling_data_.size(), tiling_key_);
return SUCCESS;


Loading…
Cancel
Save