Browse Source

!10189 fix shape type error when dynamic_kernel shape type is compute_depend

From: @liubuyu
Reviewed-by: @zhoufeng54,@kisnwang
Signed-off-by: @kisnwang
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
ffe61081d3
4 changed files with 9 additions and 2 deletions
  1. +3
    -1
      mindspore/ccsrc/backend/kernel_compiler/aicpu/aicpu_kernel_build.cc
  2. +1
    -1
      mindspore/ccsrc/runtime/device/ascend/executor/ai_cpu_dynamic_kernel.cc
  3. +1
    -0
      mindspore/ccsrc/runtime/device/ascend/executor/aicpu_ext_info_handle.cc
  4. +4
    -0
      mindspore/ccsrc/utils/utils.h

+ 3
- 1
mindspore/ccsrc/backend/kernel_compiler/aicpu/aicpu_kernel_build.cc View File

@@ -22,6 +22,7 @@
#include <algorithm>
#include <map>
#include <climits>
#include "utils/utils.h"
#include "runtime/device/kernel_runtime.h"
#include "backend/kernel_compiler/aicpu/aicpu_kernel_mod.h"
#include "proto/tensor.pb.h"
@@ -402,7 +403,8 @@ bool CreateExtInfo(const std::shared_ptr<AnfNode> &anf_node, const std::shared_p
char *ext_info_buf = ext_info.data();

UnknowShapeOpType shape_type = UnknowShapeOpType::DEPEND_IN_SHAPE;
if (AnfAlgo::GetCNodeName(anf_node) == "Unique") {
auto op_name = AnfAlgo::GetCNodeName(anf_node);
if (kComputeDepend.find(op_name) != kComputeDepend.end()) {
shape_type = UnknowShapeOpType::DEPEND_COMPUTE;
}
ext_info_offset = SetExtInfoShapeType(ext_info_buf, ext_info_offset, shape_type);


+ 1
- 1
mindspore/ccsrc/runtime/device/ascend/executor/ai_cpu_dynamic_kernel.cc View File

@@ -21,6 +21,7 @@
#include <algorithm>
#include "runtime/mem.h"
#include "runtime/kernel.h"
#include "utils/utils.h"
#include "backend/session/anf_runtime_algorithm.h"
#include "backend/kernel_compiler/aicpu/aicpu_util.h"
#include "runtime/device/executor/executor_callback.h"
@@ -28,7 +29,6 @@
namespace mindspore {
namespace device {
namespace ascend {
std::set<std::string> kComputeDepend = {"Unique", "ComputeAccidentalHits"};
AiCpuDynamicKernel::~AiCpuDynamicKernel() {
// free dev ptr
if (ext_info_addr_dev_ == nullptr) {


+ 1
- 0
mindspore/ccsrc/runtime/device/ascend/executor/aicpu_ext_info_handle.cc View File

@@ -92,6 +92,7 @@ bool AicpuExtInfoHandler::ParseExtShapeType(AicpuExtInfo *aicpu_ext_info) {
if (*type != unknown_type_) {
MS_LOG(ERROR) << "Node:" << node_name_ << " parse ext shape type failed as need:" << unknown_type_
<< " but got:" << *type;
return false;
}
MS_LOG(INFO) << "Node:" << node_name_ << "parse ext shape type success infoLen=" << aicpu_ext_info->infoLen;
return true;


+ 4
- 0
mindspore/ccsrc/utils/utils.h View File

@@ -30,6 +30,8 @@

namespace mindspore {
// op name. Op which not exists in operator/ops.h, so define it's name here
constexpr auto kUniqueOpName = "Unique";
constexpr auto kComputeAccidentalHitsOpName = "ComputeAccidentalHits";
constexpr auto kFour2FiveOpName = "Four2Five";
constexpr auto kFive2FourOpName = "Five2Four";
constexpr auto kConv2DOpName = "Conv2D";
@@ -479,6 +481,8 @@ const std::set<std::string> kHWSpecialFormatSet = {

const std::set<TypeId> kFloatDataTypeSet = {kNumberTypeFloat16, kNumberTypeFloat32};

const std::set<std::string> kComputeDepend = {kUniqueOpName, kComputeAccidentalHitsOpName};

static inline void ChangeFileMode(const std::string &file_name, mode_t mode) {
try {
if (chmod(file_name.c_str(), mode) != 0) {


Loading…
Cancel
Save