!29109 Fix Core Dump after RuntimeError
Merge pull request !29109 from hwjiaorui/segmentation-fault
This commit is contained in:
commit
68189870e4
|
@ -71,7 +71,7 @@ std::string OpTilingCalculateAdapter::GetOutputName(const CNodePtr &node, size_t
|
|||
|
||||
std::string OpTilingCalculateAdapter::GetInputName(const CNodePtr &node, size_t index) {
|
||||
MS_EXCEPTION_IF_NULL(node);
|
||||
if (input_names_.size() < index) {
|
||||
if (input_names_.size() <= index) {
|
||||
return "unknown_name";
|
||||
}
|
||||
return input_names_[index];
|
||||
|
|
|
@ -319,16 +319,16 @@ std::vector<GraphSegmentPtr> AscendDeviceContext::PartitionGraph(
|
|||
|
||||
void AscendDeviceContext::UnifyMindIR(const KernelGraphPtr &graph) const {
|
||||
MS_EXCEPTION_IF_NULL(graph);
|
||||
AscendGraphOptimization::GetInstance().UnifyMindIR(graph);
|
||||
GetAscendGraphOptimization().UnifyMindIR(graph);
|
||||
}
|
||||
|
||||
void AscendDeviceContext::OptimizeGraph(const KernelGraphPtr &graph) const {
|
||||
MS_EXCEPTION_IF_NULL(graph);
|
||||
AscendGraphOptimization::GetInstance().OptimizeGraph(graph);
|
||||
GetAscendGraphOptimization().OptimizeGraph(graph);
|
||||
}
|
||||
|
||||
void AscendDeviceContext::SetOperatorInfo(const std::vector<CNodePtr> &nodes) const {
|
||||
AscendGraphOptimization::GetInstance().SetOperatorInfo(nodes);
|
||||
GetAscendGraphOptimization().SetOperatorInfo(nodes);
|
||||
}
|
||||
|
||||
void AscendDeviceContext::CreateKernel(const std::vector<CNodePtr> &nodes) const {
|
||||
|
@ -618,7 +618,7 @@ bool AscendDeviceContext::IsLoopCountSink(const KernelGraphPtr &graph) const {
|
|||
|
||||
// kernel by kernel mode interface
|
||||
void AscendDeviceContext::OptimizeSingleOpGraph(const KernelGraphPtr &graph) const {
|
||||
AscendGraphOptimization::GetInstance().OptimizeSingleOpGraph(graph);
|
||||
GetAscendGraphOptimization().OptimizeSingleOpGraph(graph);
|
||||
}
|
||||
|
||||
void AscendDeviceContext::PreprocessBeforeRunSingleOpGraph(const KernelGraphPtr &graph) const {
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace mindspore {
|
|||
namespace device {
|
||||
namespace ascend {
|
||||
using AscendAutoMonad = mindspore::session::AscendAutoMonad;
|
||||
|
||||
AscendGraphOptimization GetAscendGraphOptimization() { return AscendGraphOptimization(); }
|
||||
void AscendGraphOptimization::OptimizeGraph(const KernelGraphPtr &graph) {
|
||||
MS_EXCEPTION_IF_NULL(graph);
|
||||
MS_LOG(INFO) << "Status record: start optimize graph. graph id: " << graph->graph_id();
|
||||
|
|
|
@ -26,19 +26,14 @@ namespace device {
|
|||
namespace ascend {
|
||||
class AscendGraphOptimization {
|
||||
public:
|
||||
static AscendGraphOptimization &GetInstance() {
|
||||
static AscendGraphOptimization instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void OptimizeGraph(const KernelGraphPtr &graph);
|
||||
void OptimizeSingleOpGraph(const KernelGraphPtr &graph);
|
||||
void SetOperatorInfo(const std::vector<CNodePtr> &nodes);
|
||||
void UnifyMindIR(const KernelGraphPtr &graph);
|
||||
|
||||
private:
|
||||
AscendGraphOptimization() { graph_manager_ = MakeManager(); }
|
||||
~AscendGraphOptimization() = default;
|
||||
|
||||
private:
|
||||
AscendGraphOptimization(const AscendGraphOptimization &) = delete;
|
||||
AscendGraphOptimization &operator=(const AscendGraphOptimization &) = delete;
|
||||
// Graph Optimized level-2 interface
|
||||
|
@ -70,6 +65,8 @@ class AscendGraphOptimization {
|
|||
// Note: Please clean the set before each use.
|
||||
std::set<KernelGraphPtr> memo_;
|
||||
};
|
||||
|
||||
AscendGraphOptimization GetAscendGraphOptimization();
|
||||
} // namespace ascend
|
||||
} // namespace device
|
||||
} // namespace mindspore
|
||||
|
|
Loading…
Reference in New Issue