已合并
【PR】: 重构,删除 exec_order 相关处理,保留 exec_order 字段以保证兼容性 #1297
shengnan创建于 7月15日
【PR】: 重构,删除 exec_order 相关处理,保留 exec_order 字段以保证兼容性 #1297
已合并
共 32 个文件变更+390-605
| @@ -851,7 +851,6 @@ std::string DebugStr(const ascir::Graph &graph, bool verbose) { | |||
| 851 | ss << "Nodes:" << std::endl; | 851 | ss << "Nodes:" << std::endl; |
| 852 | size_t idx = 0UL; | 852 | size_t idx = 0UL; |
| 853 | for (auto node : graph.GetAllNodes()) { | 853 | for (auto node : graph.GetAllNodes()) { |
| 854 | - // Node name and exec_order | ||
| 855 | ss << " " << node->GetName() << ": " << node->GetType() << " (" << idx++ << ")" << std::endl; | 854 | ss << " " << node->GetName() << ": " << node->GetType() << " (" << idx++ << ")" << std::endl; |
| 856 | 855 | ||
| 857 | NodeAttrStr(ss, graph, node, verbose); | 856 | NodeAttrStr(ss, graph, node, verbose); |
| @@ -819,7 +819,7 @@ AscGraphAttr *AscGraphImpl::GetGraphAttrsGroup() const { | |||
| 819 | } | 819 | } |
| 820 | 820 | ||
| 821 | AscOpOutput AscGraphImpl::CreateContiguousData(const char *name, const ge::DataType &dt, const vector<Axis> &axes, | 821 | AscOpOutput AscGraphImpl::CreateContiguousData(const char *name, const ge::DataType &dt, const vector<Axis> &axes, |
| 822 | - const Format &format) { | 822 | + const size_t index, const Format &format) { |
| 823 | auto data_op_desc = OpDescBuilder(name, kAscData).AddOutput("y").Build(); | 823 | auto data_op_desc = OpDescBuilder(name, kAscData).AddOutput("y").Build(); |
| 824 | GE_ASSERT_NOTNULL(data_op_desc); | 824 | GE_ASSERT_NOTNULL(data_op_desc); |
| 825 | // Add output and attr | 825 | // Add output and attr |
| @@ -831,10 +831,9 @@ AscOpOutput AscGraphImpl::CreateContiguousData(const char *name, const ge::DataT | |||
| 831 | GE_ASSERT_NOTNULL(data_attr); | 831 | GE_ASSERT_NOTNULL(data_attr); |
| 832 | AddNode(*data_op); | 832 | AddNode(*data_op); |
| 833 | data_op_desc->SetExtAttr(ascir::cg::RELATED_OP, data_op); | 833 | data_op_desc->SetExtAttr(ascir::cg::RELATED_OP, data_op); |
| 834 | - data_attr->sched.exec_order = ascir::cg::CodeGenUtils::GenNextExecId(*data_op); | ||
| 835 | auto data_ir_attr = ComGraphMakeUnique<AscDataIrAttrDef>(); | 834 | auto data_ir_attr = ComGraphMakeUnique<AscDataIrAttrDef>(); |
| 836 | GE_ASSERT_NOTNULL(data_ir_attr); | 835 | GE_ASSERT_NOTNULL(data_ir_attr); |
| 837 | - GE_ASSERT_GRAPH_SUCCESS(data_ir_attr->SetIndex(data_attr->sched.exec_order)); | 836 | + GE_ASSERT_GRAPH_SUCCESS(data_ir_attr->SetIndex(index)); |
| 838 | data_attr->ir_attr = std::move(data_ir_attr); | 837 | data_attr->ir_attr = std::move(data_ir_attr); |
| 839 | 838 | ||
| 840 | AscOpOutput asc_op_output(data_op.get(), 0U); // data只有一个输出 | 839 | AscOpOutput asc_op_output(data_op.get(), 0U); // data只有一个输出 |
| @@ -861,14 +860,6 @@ AscOpOutput AscGraphImpl::CreateContiguousOut(const char *name, const DataType & | |||
| 861 | return asc_op_output; | 860 | return asc_op_output; |
| 862 | } | 861 | } |
| 863 | 862 | ||
| 864 | -void AscGraphImpl::SortByExecOrder() { | ||
| 865 | - compute_graph_->TopologicalSorting([](const NodePtr &a, const NodePtr &b) { | ||
| 866 | - auto node_a = std::dynamic_pointer_cast<AscNode>(a); | ||
| 867 | - auto node_b = std::dynamic_pointer_cast<AscNode>(b); | ||
| 868 | - return node_a->attr.sched.exec_order < node_b->attr.sched.exec_order; | ||
| 869 | - }); | ||
| 870 | -} | ||
| 871 | - | ||
| 872 | const ComputeGraphPtr AscGraphImpl::GetComputeGraph() const { | 863 | const ComputeGraphPtr AscGraphImpl::GetComputeGraph() const { |
| 873 | return compute_graph_; | 864 | return compute_graph_; |
| 874 | } | 865 | } |
| @@ -915,10 +906,6 @@ std::string AscGraph::GetName() const { | |||
| 915 | return impl_->GetName(); | 906 | return impl_->GetName(); |
| 916 | } | 907 | } |
| 917 | 908 | ||
| 918 | -void AscGraph::SortByExecOrder() { | ||
| 919 | - impl_->SortByExecOrder(); | ||
| 920 | -} | ||
| 921 | - | ||
| 922 | bool AscGraph::CopyFrom(const AscGraph &graph) { | 909 | bool AscGraph::CopyFrom(const AscGraph &graph) { |
| 923 | GE_ASSERT_TRUE(impl_->CopyFrom(graph, *this)); | 910 | GE_ASSERT_TRUE(impl_->CopyFrom(graph, *this)); |
| 924 | std::vector<AscGraph> sub_graphs; | 911 | std::vector<AscGraph> sub_graphs; |
| @@ -1167,17 +1154,6 @@ bool AscGraph::CheckAxisValid() const { | |||
| 1167 | return true; | 1154 | return true; |
| 1168 | } | 1155 | } |
| 1169 | 1156 | ||
| 1170 | -bool AscGraph::CheckExecOrderValid() const { | ||
| 1171 | - std::set<int64_t> exec_order_set; | ||
| 1172 | - for (const auto &node : GetAllNodes()) { | ||
| 1173 | - const auto exec_order = node->attr.sched.exec_order; | ||
| 1174 | - const auto iter = exec_order_set.find(exec_order); | ||
| 1175 | - GE_ASSERT_TRUE(iter == exec_order_set.end(), "Redundant exec_order[%ld].", exec_order); | ||
| 1176 | - exec_order_set.insert(exec_order); | ||
| 1177 | - } | ||
| 1178 | - return true; | ||
| 1179 | -} | ||
| 1180 | - | ||
| 1181 | bool AscGraph::CheckTensorValid() const { | 1157 | bool AscGraph::CheckTensorValid() const { |
| 1182 | for (const auto &node : GetAllNodes()) { | 1158 | for (const auto &node : GetAllNodes()) { |
| 1183 | int32_t output_index = -1; | 1159 | int32_t output_index = -1; |
| @@ -1238,8 +1214,8 @@ TransInfoRoadOfGraph AscGraph::GetAllAxisTransInfo() const { | |||
| 1238 | } | 1214 | } |
| 1239 | 1215 | ||
| 1240 | AscOpOutput AscGraph::CreateContiguousData(const char *name, const ge::DataType &dt, const std::vector<Axis> &axes, | 1216 | AscOpOutput AscGraph::CreateContiguousData(const char *name, const ge::DataType &dt, const std::vector<Axis> &axes, |
| 1241 | - const ge::Format &format) { | 1217 | + const size_t index, const ge::Format &format) { |
| 1242 | - return impl_->CreateContiguousData(name, dt, axes, format); | 1218 | + return impl_->CreateContiguousData(name, dt, axes, index, format); |
| 1243 | } | 1219 | } |
| 1244 | 1220 | ||
| 1245 | AscOpOutput AscGraph::CreateContiguousOut(const char *name, const ge::DataType &dt, const std::vector<Axis> &axes, | 1221 | AscOpOutput AscGraph::CreateContiguousOut(const char *name, const ge::DataType &dt, const std::vector<Axis> &axes, |
| @@ -1466,12 +1442,10 @@ graphStatus AscNodeAttr::SerializeAttr(ascendc_ir::proto::AscNodeAttrGroupsDef & | |||
| 1466 | asc_node_group.set_name(name); | 1442 | asc_node_group.set_name(name); |
| 1467 | asc_node_group.set_type(type); | 1443 | asc_node_group.set_type(type); |
| 1468 | auto sched_def = asc_node_group.mutable_sched(); | 1444 | auto sched_def = asc_node_group.mutable_sched(); |
| 1469 | - sched_def->set_exec_order(sched.exec_order); | ||
| 1470 | for (const int64_t axis_id : sched.axis) { | 1445 | for (const int64_t axis_id : sched.axis) { |
| 1471 | sched_def->add_axis(axis_id); | 1446 | sched_def->add_axis(axis_id); |
| 1472 | } | 1447 | } |
| 1473 | sched_def->set_loop_axis(sched.loop_axis); | 1448 | sched_def->set_loop_axis(sched.loop_axis); |
| 1474 | - sched_def->set_exec_order(sched.exec_order); | ||
| 1475 | sched_def->set_exec_condition(static_cast<int32_t>(sched.exec_condition)); | 1449 | sched_def->set_exec_condition(static_cast<int32_t>(sched.exec_condition)); |
| 1476 | auto api_def = asc_node_group.mutable_api(); | 1450 | auto api_def = asc_node_group.mutable_api(); |
| 1477 | api_def->set_type(static_cast<int32_t>(api.type)); | 1451 | api_def->set_type(static_cast<int32_t>(api.type)); |
| @@ -1509,7 +1483,6 @@ graphStatus AscNodeAttr::DeserializeAttr(const ascendc_ir::proto::AscNodeAttrGro | |||
| 1509 | sched.axis.emplace_back(ax); | 1483 | sched.axis.emplace_back(ax); |
| 1510 | } | 1484 | } |
| 1511 | sched.loop_axis = sched_def.loop_axis(); | 1485 | sched.loop_axis = sched_def.loop_axis(); |
| 1512 | - sched.exec_order = sched_def.exec_order(); | ||
| 1513 | sched.exec_condition = static_cast<ExecuteCondition>(sched_def.exec_condition()); | 1486 | sched.exec_condition = static_cast<ExecuteCondition>(sched_def.exec_condition()); |
| 1514 | const auto &api_def = asc_node_group.api(); | 1487 | const auto &api_def = asc_node_group.api(); |
| 1515 | api.type = static_cast<ApiType>((api_def.type())); | 1488 | api.type = static_cast<ApiType>((api_def.type())); |
| @@ -105,13 +105,11 @@ class AscGraphImpl { | |||
| 105 | std::string GetName() const; | 105 | std::string GetName() const; |
| 106 | 106 | ||
| 107 | AscOpOutput CreateContiguousData(const char *name, const ge::DataType &dt, const std::vector<Axis> &axes, | 107 | AscOpOutput CreateContiguousData(const char *name, const ge::DataType &dt, const std::vector<Axis> &axes, |
| 108 | - const ge::Format &format); | 108 | + const size_t index, const ge::Format &format); |
| 109 | 109 | ||
| 110 | AscOpOutput CreateContiguousOut(const char *name, const ge::DataType &dt, const std::vector<Axis> &axes, | 110 | AscOpOutput CreateContiguousOut(const char *name, const ge::DataType &dt, const std::vector<Axis> &axes, |
| 111 | const ge::Format &format); | 111 | const ge::Format &format); |
| 112 | 112 | ||
| 113 | - void SortByExecOrder(); | ||
| 114 | - | ||
| 115 | const ComputeGraphPtr GetComputeGraph() const; | 113 | const ComputeGraphPtr GetComputeGraph() const; |
| 116 | 114 | ||
| 117 | static bool CopyFrom(const AscGraph &src_graph, AscGraph &dst_graph); | 115 | static bool CopyFrom(const AscGraph &src_graph, AscGraph &dst_graph); |
| @@ -1436,7 +1436,6 @@ class FunctionGenerator { | |||
| 1436 | virtual bool GenConnectInputs(std::stringstream &ss, const bool has_optional_input) const; | 1436 | virtual bool GenConnectInputs(std::stringstream &ss, const bool has_optional_input) const; |
| 1437 | virtual bool GenAttrAssignment(std::stringstream &ss) const; | 1437 | virtual bool GenAttrAssignment(std::stringstream &ss) const; |
| 1438 | virtual void GenSchedInfo(std::stringstream &ss) const { | 1438 | virtual void GenSchedInfo(std::stringstream &ss) const { |
| 1439 | - ss << " op.attr.sched.exec_order = CodeGenUtils::GenNextExecId(op);" << std::endl; | ||
| 1440 | ss << " SET_SCHED_AXIS_IF_IN_CONTEXT(op);" << std::endl; | 1439 | ss << " SET_SCHED_AXIS_IF_IN_CONTEXT(op);" << std::endl; |
| 1441 | } | 1440 | } |
| 1442 | virtual void TryGenOutputsVectorizedAxis(std::stringstream &ss) const { | 1441 | virtual void TryGenOutputsVectorizedAxis(std::stringstream &ss) const { |
| @@ -1645,8 +1644,6 @@ class StoreNodeFuncGenerator : public FunctionGenerator { | |||
| 1645 | ss << " auto &store_op = const_cast<af::Operator &>(store_out.GetOwnerOp());" << std::endl; | 1644 | ss << " auto &store_op = const_cast<af::Operator &>(store_out.GetOwnerOp());" << std::endl; |
| 1646 | ss << " gm_producer.SetInput(0U, store_op, 0U);" << std::endl; | 1645 | ss << " gm_producer.SetInput(0U, store_op, 0U);" << std::endl; |
| 1647 | ss << " AddEdgeForNode(store_op, 0U, gm_producer, 0U);" << std::endl; | 1646 | ss << " AddEdgeForNode(store_op, 0U, gm_producer, 0U);" << std::endl; |
| 1648 | - ss << " auto *gm_producer_attr = CodeGenUtils::GetOwnerOpAscAttr(gm_producer);" << std::endl; | ||
| 1649 | - ss << " gm_producer_attr->sched.exec_order = CodeGenUtils::GenNextExecId(store_op);" << std::endl; | ||
| 1650 | ss << "}" << std::endl; | 1647 | ss << "}" << std::endl; |
| 1651 | } | 1648 | } |
| 1652 | }; | 1649 | }; |
| @@ -94,7 +94,7 @@ std::string DumpAscirGraph::ComputeTypeToString(ComputeType type) { | |||
| 94 | {ComputeType::kComputeElewise, "ELEWISE"}, | 94 | {ComputeType::kComputeElewise, "ELEWISE"}, |
| 95 | {ComputeType::kComputeBroadcast, "BROADCAST"}, | 95 | {ComputeType::kComputeBroadcast, "BROADCAST"}, |
| 96 | {ComputeType::kComputeReduce, "REDUCE"}, | 96 | {ComputeType::kComputeReduce, "REDUCE"}, |
| 97 | - {ComputeType::kComputeTranspose, "TRANPOSE"}, | 97 | + {ComputeType::kComputeTranspose, "TRANSPOSE"}, |
| 98 | {ComputeType::kComputeGather, "GATHER"}, | 98 | {ComputeType::kComputeGather, "GATHER"}, |
| 99 | {ComputeType::kComputeInvalid, "INVALID"}, | 99 | {ComputeType::kComputeInvalid, "INVALID"}, |
| 100 | }; | 100 | }; |
| @@ -108,7 +108,6 @@ std::string DumpAscirGraph::ComputeTypeToString(ComputeType type) { | |||
| 108 | std::stringstream &DumpAscirGraph::AscNodeAttrStr(std::stringstream &ss, AscNodeAttr &attr) { | 108 | std::stringstream &DumpAscirGraph::AscNodeAttrStr(std::stringstream &ss, AscNodeAttr &attr) { |
| 109 | ss << " AscNode: " << std::endl; | 109 | ss << " AscNode: " << std::endl; |
| 110 | ss << " sched: " << std::endl; | 110 | ss << " sched: " << std::endl; |
| 111 | - ss << " exec_order: " << attr.sched.exec_order << std::endl; | ||
| 112 | ss << " axis: "; | 111 | ss << " axis: "; |
| 113 | for (auto axis : attr.sched.axis) { | 112 | for (auto axis : attr.sched.axis) { |
| 114 | ss << axis << ", "; | 113 | ss << axis << ", "; |
| @@ -182,7 +182,8 @@ message ShapeEnvAttrGroupsDef { | |||
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | message SchedInfoDef { | 184 | message SchedInfoDef { |
| 185 | - int64 exec_order = 1; | 185 | + // Deprecated since 2026-07-15. Kept only for compatibility and can be removed after compatibility window. |
| 186 | + int64 exec_order = 1 [deprecated = true]; | ||
| 186 | repeated int64 axis = 2; | 187 | repeated int64 axis = 2; |
| 187 | int64 loop_axis = 3; | 188 | int64 loop_axis = 3; |
| 188 | int32 exec_condition = 4; | 189 | int32 exec_condition = 4; |
| @@ -396,7 +397,7 @@ message GraphDef | |||
| 396 | message ModelDef | 397 | message ModelDef |
| 397 | { | 398 | { |
| 398 | string name = 1; // name | 399 | string name = 1; // name |
| 399 | - uint32 version = 2; // IR Proto verion | 400 | + uint32 version = 2; // IR Proto version |
| 400 | string custom_version = 3; // User model version number, passed in by user | 401 | string custom_version = 3; // User model version number, passed in by user |
| 401 | 402 | ||
| 402 | repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef | 403 | repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef |
| @@ -591,11 +591,10 @@ class AscGraph { | |||
| 591 | bool CheckValid() const; | 591 | bool CheckValid() const; |
| 592 | 592 | ||
| 593 | AscOpOutput CreateContiguousData(const char *name, const ge::DataType &dt, const std::vector<Axis> &axes, | 593 | AscOpOutput CreateContiguousData(const char *name, const ge::DataType &dt, const std::vector<Axis> &axes, |
| 594 | - const ge::Format &format = ge::FORMAT_ND); | 594 | + const size_t index, const ge::Format &format = ge::FORMAT_ND); |
| 595 | 595 | ||
| 596 | AscOpOutput CreateContiguousOut(const char *name, const ge::DataType &dt, const std::vector<Axis> &axes, | 596 | AscOpOutput CreateContiguousOut(const char *name, const ge::DataType &dt, const std::vector<Axis> &axes, |
| 597 | const ge::Format &format = ge::FORMAT_ND); | 597 | const ge::Format &format = ge::FORMAT_ND); |
| 598 | - void SortByExecOrder(); | ||
| 599 | bool CopyFrom(const AscGraph &graph); | 598 | bool CopyFrom(const AscGraph &graph); |
| 600 | bool CopyAttrFrom(const AscGraph &src_graph); | 599 | bool CopyAttrFrom(const AscGraph &src_graph); |
| 601 | static bool CopyAscNodeTensorAttr(const AscNodePtr &src_node, AscNodePtr &dst_node); | 600 | static bool CopyAscNodeTensorAttr(const AscNodePtr &src_node, AscNodePtr &dst_node); |
| @@ -606,7 +605,6 @@ class AscGraph { | |||
| 606 | private: | 605 | private: |
| 607 | bool CheckExprValid() const; | 606 | bool CheckExprValid() const; |
| 608 | bool CheckAxisValid() const; | 607 | bool CheckAxisValid() const; |
| 609 | - bool CheckExecOrderValid() const; | ||
| 610 | bool CheckTensorValid() const; | 608 | bool CheckTensorValid() const; |
| 611 | bool CheckNodeConnectionValid() const; | 609 | bool CheckNodeConnectionValid() const; |
| 612 | std::shared_ptr<AscGraphImpl> impl_; | 610 | std::shared_ptr<AscGraphImpl> impl_; |
| @@ -237,7 +237,7 @@ struct ApiInfo { | |||
| 237 | }; | 237 | }; |
| 238 | 238 | ||
| 239 | struct SchedInfo { | 239 | struct SchedInfo { |
| 240 | - // [HI] 执行序,按值从小到大执行 | 240 | + // [HI] 已废弃(2026-07-15),仅为兼容性保留,经过兼容周期后可删除 |
| 241 | int64_t exec_order{kIdNone}; | 241 | int64_t exec_order{kIdNone}; |
| 242 | 242 | ||
| 243 | // [HI] 节点所处的多层嵌套循环的轴`id`,按循环表示从外层到内层的轴`id` | 243 | // [HI] 节点所处的多层嵌套循环的轴`id`,按循环表示从外层到内层的轴`id` |
| @@ -55,7 +55,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 55 | Axis &s1_axis = graph.CreateAxis("S1", s1); | 55 | Axis &s1_axis = graph.CreateAxis("S1", s1); |
| 56 | 56 | ||
| 57 | ascir_op::Scalar scalar("Scalar", graph); | 57 | ascir_op::Scalar scalar("Scalar", graph); |
| 58 | - scalar.attr.sched.exec_order = 0; | ||
| 59 | scalar.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 58 | scalar.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 60 | scalar.y.dtype = ge::DT_FLOAT16; | 59 | scalar.y.dtype = ge::DT_FLOAT16; |
| 61 | scalar.y.format = ge::FORMAT_ND; | 60 | scalar.y.format = ge::FORMAT_ND; |
| @@ -65,7 +64,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 65 | scalar.ir_attr.SetValue("Test"); | 64 | scalar.ir_attr.SetValue("Test"); |
| 66 | 65 | ||
| 67 | ascir_op::Data data1("data1", graph); | 66 | ascir_op::Data data1("data1", graph); |
| 68 | - data1.attr.sched.exec_order = 0; | ||
| 69 | data1.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 67 | data1.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 70 | data1.y.dtype = ge::DT_FLOAT16; | 68 | data1.y.dtype = ge::DT_FLOAT16; |
| 71 | data1.y.format = ge::FORMAT_ND; | 69 | data1.y.format = ge::FORMAT_ND; |
| @@ -75,7 +73,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 75 | data1.ir_attr.SetIndex(2); | 73 | data1.ir_attr.SetIndex(2); |
| 76 | 74 | ||
| 77 | ascir_op::Data data2("data2", graph); | 75 | ascir_op::Data data2("data2", graph); |
| 78 | - data2.attr.sched.exec_order = 0; | ||
| 79 | data2.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 76 | data2.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 80 | data2.y.dtype = ge::DT_FLOAT16; | 77 | data2.y.dtype = ge::DT_FLOAT16; |
| 81 | data2.y.format = ge::FORMAT_ND; | 78 | data2.y.format = ge::FORMAT_ND; |
| @@ -87,7 +84,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 87 | ascir_op::Add add("add"); | 84 | ascir_op::Add add("add"); |
| 88 | add.x1 = scalar.y; | 85 | add.x1 = scalar.y; |
| 89 | add.x2 = scalar.y; | 86 | add.x2 = scalar.y; |
| 90 | - add.attr.sched.exec_order = 1; | ||
| 91 | add.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 87 | add.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 92 | add.y.dtype = ge::DT_FLOAT16; | 88 | add.y.dtype = ge::DT_FLOAT16; |
| 93 | add.y.format = ge::FORMAT_ND; | 89 | add.y.format = ge::FORMAT_ND; |
| @@ -97,7 +93,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 97 | 93 | ||
| 98 | ascir_op::Exp exp("exp"); | 94 | ascir_op::Exp exp("exp"); |
| 99 | exp.x = scalar.y; | 95 | exp.x = scalar.y; |
| 100 | - exp.attr.sched.exec_order = 2; | ||
| 101 | exp.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 96 | exp.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 102 | exp.y.dtype = ge::DT_FLOAT16; | 97 | exp.y.dtype = ge::DT_FLOAT16; |
| 103 | exp.y.format = ge::FORMAT_ND; | 98 | exp.y.format = ge::FORMAT_ND; |
| @@ -107,7 +102,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 107 | 102 | ||
| 108 | ascir_op::Concat concat("concat"); | 103 | ascir_op::Concat concat("concat"); |
| 109 | concat.x = {add.y, exp.y}; | 104 | concat.x = {add.y, exp.y}; |
| 110 | - concat.attr.sched.exec_order = 3; | ||
| 111 | concat.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 105 | concat.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 112 | concat.y.dtype = ge::DT_FLOAT16; | 106 | concat.y.dtype = ge::DT_FLOAT16; |
| 113 | concat.y.format = ge::FORMAT_ND; | 107 | concat.y.format = ge::FORMAT_ND; |
| @@ -119,7 +113,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 119 | fake_opa.x1 = exp.y; | 113 | fake_opa.x1 = exp.y; |
| 120 | fake_opa.x2 = exp.y; // 可选输入 | 114 | fake_opa.x2 = exp.y; // 可选输入 |
| 121 | fake_opa.x3 = data1.y; | 115 | fake_opa.x3 = data1.y; |
| 122 | - fake_opa.attr.sched.exec_order = 4; | ||
| 123 | fake_opa.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 116 | fake_opa.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 124 | fake_opa.y.dtype = ge::DT_FLOAT16; | 117 | fake_opa.y.dtype = ge::DT_FLOAT16; |
| 125 | fake_opa.y.format = ge::FORMAT_ND; | 118 | fake_opa.y.format = ge::FORMAT_ND; |
| @@ -132,7 +125,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 132 | leaky_relu.ir_attr.SetNegative_slope(1); | 125 | leaky_relu.ir_attr.SetNegative_slope(1); |
| 133 | 126 | ||
| 134 | ascir_op::Output output("output"); | 127 | ascir_op::Output output("output"); |
| 135 | - output.attr.sched.exec_order = 4; | ||
| 136 | output.x = fake_opa.y; | 128 | output.x = fake_opa.y; |
| 137 | output.ir_attr.SetIndex(1); | 129 | output.ir_attr.SetIndex(1); |
| 138 | } | 130 | } |
| @@ -225,7 +217,6 @@ void ConstructWrongAscGraph(AscGraph &graph) { | |||
| 225 | Axis &s1_axis = graph.CreateAxis("S1", s1); | 217 | Axis &s1_axis = graph.CreateAxis("S1", s1); |
| 226 | 218 | ||
| 227 | ascir_op::Data data("data", graph); | 219 | ascir_op::Data data("data", graph); |
| 228 | - data.attr.sched.exec_order = 0; | ||
| 229 | data.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 220 | data.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 230 | data.y.dtype = ge::DT_FLOAT16; | 221 | data.y.dtype = ge::DT_FLOAT16; |
| 231 | data.y.format = ge::FORMAT_ND; | 222 | data.y.format = ge::FORMAT_ND; |
| @@ -236,7 +227,6 @@ void ConstructWrongAscGraph(AscGraph &graph) { | |||
| 236 | 227 | ||
| 237 | ascir_op::Add add("add"); | 228 | ascir_op::Add add("add"); |
| 238 | add.x1 = data.y; | 229 | add.x1 = data.y; |
| 239 | - add.attr.sched.exec_order = 1; | ||
| 240 | add.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 230 | add.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 241 | add.y.dtype = ge::DT_FLOAT16; | 231 | add.y.dtype = ge::DT_FLOAT16; |
| 242 | add.y.format = ge::FORMAT_ND; | 232 | add.y.format = ge::FORMAT_ND; |
| @@ -246,7 +236,6 @@ void ConstructWrongAscGraph(AscGraph &graph) { | |||
| 246 | 236 | ||
| 247 | ascir_op::Exp exp("exp"); | 237 | ascir_op::Exp exp("exp"); |
| 248 | exp.x = add.y; | 238 | exp.x = add.y; |
| 249 | - exp.attr.sched.exec_order = 2; | ||
| 250 | exp.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 239 | exp.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 251 | exp.y.dtype = ge::DT_FLOAT16; | 240 | exp.y.dtype = ge::DT_FLOAT16; |
| 252 | exp.y.format = ge::FORMAT_ND; | 241 | exp.y.format = ge::FORMAT_ND; |
| @@ -257,7 +246,6 @@ void ConstructWrongAscGraph(AscGraph &graph) { | |||
| 257 | add.x2 = exp.y; | 246 | add.x2 = exp.y; |
| 258 | 247 | ||
| 259 | ascir_op::Output output("output"); | 248 | ascir_op::Output output("output"); |
| 260 | - output.attr.sched.exec_order = 4; | ||
| 261 | output.x = add.y; | 249 | output.x = add.y; |
| 262 | output.ir_attr.SetIndex(1); | 250 | output.ir_attr.SetIndex(1); |
| 263 | } | 251 | } |
| @@ -32,10 +32,9 @@ using namespace att; | |||
| 32 | 32 | ||
| 33 | namespace { | 33 | namespace { |
| 34 | template <typename NodeT> | 34 | template <typename NodeT> |
| 35 | -void SetNodeScheduleAndTensor(NodeT &node, int &exec_order, std::initializer_list<int64_t> axis, ge::DataType dtype, | 35 | +void SetNodeScheduleAndTensor(NodeT &node, std::initializer_list<int64_t> axis, ge::DataType dtype, |
| 36 | std::initializer_list<af::Expression> repeats, | 36 | std::initializer_list<af::Expression> repeats, |
| 37 | std::initializer_list<af::Expression> strides) { | 37 | std::initializer_list<af::Expression> strides) { |
| 38 | - node.attr.sched.exec_order = exec_order++; | ||
| 39 | node.attr.sched.axis = axis; | 38 | node.attr.sched.axis = axis; |
| 40 | node.y.dtype = dtype; | 39 | node.y.dtype = dtype; |
| 41 | *node.y.axis = axis; | 40 | *node.y.axis = axis; |
| @@ -44,11 +43,10 @@ void SetNodeScheduleAndTensor(NodeT &node, int &exec_order, std::initializer_lis | |||
| 44 | } | 43 | } |
| 45 | 44 | ||
| 46 | template <typename NodeT, typename InputT> | 45 | template <typename NodeT, typename InputT> |
| 47 | -void InitInputNode(NodeT &node, const InputT &input, int &exec_order, std::initializer_list<int64_t> axis, | 46 | +void InitInputNode(NodeT &node, const InputT &input, std::initializer_list<int64_t> axis, ge::DataType dtype, |
| 48 | - ge::DataType dtype, std::initializer_list<af::Expression> repeats, | 47 | + std::initializer_list<af::Expression> repeats, std::initializer_list<af::Expression> strides) { |
| 49 | - std::initializer_list<af::Expression> strides) { | ||
| 50 | node.x = input; | 48 | node.x = input; |
| 51 | - SetNodeScheduleAndTensor(node, exec_order, axis, dtype, repeats, strides); | 49 | + SetNodeScheduleAndTensor(node, axis, dtype, repeats, strides); |
| 52 | } | 50 | } |
| 53 | 51 | ||
| 54 | template <typename NodeT> | 52 | template <typename NodeT> |
| @@ -71,12 +69,12 @@ void SetQueueNode(const NodeT &node, int &tensor_id, int queue_id, af::Position | |||
| 71 | node->outputs[0].attr.opt.ref_tensor = ascir::ID_NONE; | 69 | node->outputs[0].attr.opt.ref_tensor = ascir::ID_NONE; |
| 72 | } | 70 | } |
| 73 | 71 | ||
| 74 | -void CreateDataAndLoad(Load &load, ascir::HintGraph &graph, const char *data_name, int &exec_order, | 72 | +void CreateDataAndLoad(Load &load, ascir::HintGraph &graph, const char *data_name, std::initializer_list<int64_t> axis, |
| 75 | - std::initializer_list<int64_t> axis, ge::DataType dtype, | 73 | + ge::DataType dtype, std::initializer_list<af::Expression> repeats, |
| 76 | - std::initializer_list<af::Expression> repeats, std::initializer_list<af::Expression> strides) { | 74 | + std::initializer_list<af::Expression> strides) { |
| 77 | Data data(data_name, graph); | 75 | Data data(data_name, graph); |
| 78 | - SetNodeScheduleAndTensor(data, exec_order, axis, dtype, repeats, strides); | 76 | + SetNodeScheduleAndTensor(data, axis, dtype, repeats, strides); |
| 79 | - InitInputNode(load, data.y, exec_order, axis, dtype, repeats, strides); | 77 | + InitInputNode(load, data.y, axis, dtype, repeats, strides); |
| 80 | } | 78 | } |
| 81 | 79 | ||
| 82 | template <typename NodeT> | 80 | template <typename NodeT> |
| @@ -141,55 +139,53 @@ void Add_Layer_Norm_Normal_BeforeAutofuseConstInput(ascir::HintGraph &graph) { | |||
| 141 | auto r = graph.CreateAxis("R", R); | 139 | auto r = graph.CreateAxis("R", R); |
| 142 | auto bl = graph.CreateAxis("BL", BL); | 140 | auto bl = graph.CreateAxis("BL", BL); |
| 143 | const std::initializer_list<int64_t> axes = {a.id, r.id, bl.id}; | 141 | const std::initializer_list<int64_t> axes = {a.id, r.id, bl.id}; |
| 144 | - | ||
| 145 | - int exec_order = 0; | ||
| 146 | Load x1Local("x1Local"); | 142 | Load x1Local("x1Local"); |
| 147 | - CreateDataAndLoad(x1Local, graph, "x1", exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 143 | + CreateDataAndLoad(x1Local, graph, "x1", axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 148 | Load x2Local("x2Local"); | 144 | Load x2Local("x2Local"); |
| 149 | - CreateDataAndLoad(x2Local, graph, "x2", exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 145 | + CreateDataAndLoad(x2Local, graph, "x2", axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 150 | Load biasLocal("biasLocal"); | 146 | Load biasLocal("biasLocal"); |
| 151 | - CreateDataAndLoad(biasLocal, graph, "bias", exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 147 | + CreateDataAndLoad(biasLocal, graph, "bias", axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 152 | 148 | ||
| 153 | Concat mean("mean"); | 149 | Concat mean("mean"); |
| 154 | mean.x = {x1Local.y, x2Local.y, biasLocal.y}; | 150 | mean.x = {x1Local.y, x2Local.y, biasLocal.y}; |
| 155 | - SetNodeScheduleAndTensor(mean, exec_order, axes, ge::DT_FLOAT, {A, R, ONE}, {R, ONE, ZERO}); | 151 | + SetNodeScheduleAndTensor(mean, axes, ge::DT_FLOAT, {A, R, ONE}, {R, ONE, ZERO}); |
| 156 | 152 | ||
| 157 | Store x_out("x_out"); | 153 | Store x_out("x_out"); |
| 158 | - InitInputNode(x_out, mean.y, exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 154 | + InitInputNode(x_out, mean.y, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 159 | Store mean_out("mean_out"); | 155 | Store mean_out("mean_out"); |
| 160 | - InitInputNode(mean_out, mean.y, exec_order, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); | 156 | + InitInputNode(mean_out, mean.y, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); |
| 161 | 157 | ||
| 162 | Data one("one", graph); | 158 | Data one("one", graph); |
| 163 | - SetNodeScheduleAndTensor(one, exec_order, axes, ge::DT_FLOAT, {ONE, ONE, BL}, {ZERO, ZERO, ONE}); | 159 | + SetNodeScheduleAndTensor(one, axes, ge::DT_FLOAT, {ONE, ONE, BL}, {ZERO, ZERO, ONE}); |
| 164 | 160 | ||
| 165 | Concat rstd("rstd"); | 161 | Concat rstd("rstd"); |
| 166 | rstd.x = {mean.y, mean.y, one.y}; | 162 | rstd.x = {mean.y, mean.y, one.y}; |
| 167 | - SetNodeScheduleAndTensor(rstd, exec_order, axes, ge::DT_FLOAT, {A, R, ONE}, {R, ONE, ZERO}); | 163 | + SetNodeScheduleAndTensor(rstd, axes, ge::DT_FLOAT, {A, R, ONE}, {R, ONE, ZERO}); |
| 168 | 164 | ||
| 169 | Store rstd_out("rstd_out"); | 165 | Store rstd_out("rstd_out"); |
| 170 | - InitInputNode(rstd_out, rstd.y, exec_order, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); | 166 | + InitInputNode(rstd_out, rstd.y, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); |
| 171 | 167 | ||
| 172 | Load betaLocal("betaLocal"); | 168 | Load betaLocal("betaLocal"); |
| 173 | - CreateDataAndLoad(betaLocal, graph, "beta", exec_order, axes, ge::DT_FLOAT16, {ONE, R, ONE}, {ZERO, ONE, ZERO}); | 169 | + CreateDataAndLoad(betaLocal, graph, "beta", axes, ge::DT_FLOAT16, {ONE, R, ONE}, {ZERO, ONE, ZERO}); |
| 174 | Load gammaLocal("gammaLocal"); | 170 | Load gammaLocal("gammaLocal"); |
| 175 | - CreateDataAndLoad(gammaLocal, graph, "gamma", exec_order, axes, ge::DT_FLOAT16, {ONE, R, ONE}, {ZERO, ONE, ZERO}); | 171 | + CreateDataAndLoad(gammaLocal, graph, "gamma", axes, ge::DT_FLOAT16, {ONE, R, ONE}, {ZERO, ONE, ZERO}); |
| 176 | 172 | ||
| 177 | Concat y("y"); | 173 | Concat y("y"); |
| 178 | y.attr.api.unit = af::ComputeUnit::kUnitVector; | 174 | y.attr.api.unit = af::ComputeUnit::kUnitVector; |
| 179 | y.x = {rstd.y, betaLocal.y, gammaLocal.y, rstd.y}; | 175 | y.x = {rstd.y, betaLocal.y, gammaLocal.y, rstd.y}; |
| 180 | - SetNodeScheduleAndTensor(y, exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 176 | + SetNodeScheduleAndTensor(y, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 181 | 177 | ||
| 182 | Store y_out("y_out"); | 178 | Store y_out("y_out"); |
| 183 | - InitInputNode(y_out, y.y, exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 179 | + InitInputNode(y_out, y.y, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 184 | 180 | ||
| 185 | Output buf1("buf1"); | 181 | Output buf1("buf1"); |
| 186 | - InitInputNode(buf1, x_out.y, exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 182 | + InitInputNode(buf1, x_out.y, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 187 | Output buf2("buf2"); | 183 | Output buf2("buf2"); |
| 188 | - InitInputNode(buf2, mean_out.y, exec_order, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); | 184 | + InitInputNode(buf2, mean_out.y, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); |
| 189 | Output buf3("buf3"); | 185 | Output buf3("buf3"); |
| 190 | - InitInputNode(buf3, rstd_out.y, exec_order, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); | 186 | + InitInputNode(buf3, rstd_out.y, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); |
| 191 | Output buf("buf"); | 187 | Output buf("buf"); |
| 192 | - InitInputNode(buf, y_out.y, exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 188 | + InitInputNode(buf, y_out.y, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 193 | } | 189 | } |
| 194 | 190 | ||
| 195 | void Add_Layer_Norm_Normal_BeforeAutofuse(ascir::HintGraph &graph, const std::string &ident = "") { | 191 | void Add_Layer_Norm_Normal_BeforeAutofuse(ascir::HintGraph &graph, const std::string &ident = "") { |
| @@ -209,55 +205,53 @@ void Add_Layer_Norm_Normal_BeforeAutofuse(ascir::HintGraph &graph, const std::st | |||
| 209 | auto r = graph.CreateAxis(axis_name2, R); | 205 | auto r = graph.CreateAxis(axis_name2, R); |
| 210 | auto bl = graph.CreateAxis(axis_name3, BL); | 206 | auto bl = graph.CreateAxis(axis_name3, BL); |
| 211 | const std::initializer_list<int64_t> axes = {a.id, r.id, bl.id}; | 207 | const std::initializer_list<int64_t> axes = {a.id, r.id, bl.id}; |
| 212 | - | ||
| 213 | - int exec_order = 0; | ||
| 214 | Load x1Local("x1Local"); | 208 | Load x1Local("x1Local"); |
| 215 | - CreateDataAndLoad(x1Local, graph, "x1", exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 209 | + CreateDataAndLoad(x1Local, graph, "x1", axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 216 | Load x2Local("x2Local"); | 210 | Load x2Local("x2Local"); |
| 217 | - CreateDataAndLoad(x2Local, graph, "x2", exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 211 | + CreateDataAndLoad(x2Local, graph, "x2", axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 218 | Load biasLocal("biasLocal"); | 212 | Load biasLocal("biasLocal"); |
| 219 | - CreateDataAndLoad(biasLocal, graph, "bias", exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 213 | + CreateDataAndLoad(biasLocal, graph, "bias", axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 220 | 214 | ||
| 221 | Concat mean("mean"); | 215 | Concat mean("mean"); |
| 222 | mean.x = {x1Local.y, x2Local.y, biasLocal.y}; | 216 | mean.x = {x1Local.y, x2Local.y, biasLocal.y}; |
| 223 | - SetNodeScheduleAndTensor(mean, exec_order, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); | 217 | + SetNodeScheduleAndTensor(mean, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); |
| 224 | 218 | ||
| 225 | Store x_out("x_out"); | 219 | Store x_out("x_out"); |
| 226 | - InitInputNode(x_out, mean.y, exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 220 | + InitInputNode(x_out, mean.y, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 227 | Store mean_out("mean_out"); | 221 | Store mean_out("mean_out"); |
| 228 | - InitInputNode(mean_out, mean.y, exec_order, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); | 222 | + InitInputNode(mean_out, mean.y, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); |
| 229 | 223 | ||
| 230 | Data one("one", graph); | 224 | Data one("one", graph); |
| 231 | - SetNodeScheduleAndTensor(one, exec_order, axes, ge::DT_FLOAT, {ONE, ONE, BL}, {ZERO, ZERO, ONE}); | 225 | + SetNodeScheduleAndTensor(one, axes, ge::DT_FLOAT, {ONE, ONE, BL}, {ZERO, ZERO, ONE}); |
| 232 | 226 | ||
| 233 | Concat rstd("rstd"); | 227 | Concat rstd("rstd"); |
| 234 | rstd.x = {mean.y, mean.y, one.y}; | 228 | rstd.x = {mean.y, mean.y, one.y}; |
| 235 | - SetNodeScheduleAndTensor(rstd, exec_order, axes, ge::DT_FLOAT, {A, R, ONE}, {R, ONE, ZERO}); | 229 | + SetNodeScheduleAndTensor(rstd, axes, ge::DT_FLOAT, {A, R, ONE}, {R, ONE, ZERO}); |
| 236 | 230 | ||
| 237 | Store rstd_out("rstd_out"); | 231 | Store rstd_out("rstd_out"); |
| 238 | - InitInputNode(rstd_out, rstd.y, exec_order, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); | 232 | + InitInputNode(rstd_out, rstd.y, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); |
| 239 | 233 | ||
| 240 | Load betaLocal("betaLocal"); | 234 | Load betaLocal("betaLocal"); |
| 241 | - CreateDataAndLoad(betaLocal, graph, "beta", exec_order, axes, ge::DT_FLOAT16, {ONE, R, ONE}, {ZERO, ONE, ZERO}); | 235 | + CreateDataAndLoad(betaLocal, graph, "beta", axes, ge::DT_FLOAT16, {ONE, R, ONE}, {ZERO, ONE, ZERO}); |
| 242 | Load gammaLocal("gammaLocal"); | 236 | Load gammaLocal("gammaLocal"); |
| 243 | - CreateDataAndLoad(gammaLocal, graph, "gamma", exec_order, axes, ge::DT_FLOAT16, {ONE, R, ONE}, {ZERO, ONE, ZERO}); | 237 | + CreateDataAndLoad(gammaLocal, graph, "gamma", axes, ge::DT_FLOAT16, {ONE, R, ONE}, {ZERO, ONE, ZERO}); |
| 244 | 238 | ||
| 245 | Concat y("y"); | 239 | Concat y("y"); |
| 246 | y.attr.api.unit = af::ComputeUnit::kUnitVector; | 240 | y.attr.api.unit = af::ComputeUnit::kUnitVector; |
| 247 | y.x = {rstd.y, betaLocal.y, gammaLocal.y, rstd.y}; | 241 | y.x = {rstd.y, betaLocal.y, gammaLocal.y, rstd.y}; |
| 248 | - SetNodeScheduleAndTensor(y, exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 242 | + SetNodeScheduleAndTensor(y, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 249 | 243 | ||
| 250 | Store y_out("y_out"); | 244 | Store y_out("y_out"); |
| 251 | - InitInputNode(y_out, y.y, exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 245 | + InitInputNode(y_out, y.y, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 252 | 246 | ||
| 253 | Output buf1("buf1"); | 247 | Output buf1("buf1"); |
| 254 | - InitInputNode(buf1, x_out.y, exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 248 | + InitInputNode(buf1, x_out.y, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 255 | Output buf2("buf2"); | 249 | Output buf2("buf2"); |
| 256 | - InitInputNode(buf2, mean_out.y, exec_order, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); | 250 | + InitInputNode(buf2, mean_out.y, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); |
| 257 | Output buf3("buf3"); | 251 | Output buf3("buf3"); |
| 258 | - InitInputNode(buf3, rstd_out.y, exec_order, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); | 252 | + InitInputNode(buf3, rstd_out.y, axes, ge::DT_FLOAT, {A, ONE, ONE}, {ONE, ZERO, ZERO}); |
| 259 | Output buf("buf"); | 253 | Output buf("buf"); |
| 260 | - InitInputNode(buf, y_out.y, exec_order, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); | 254 | + InitInputNode(buf, y_out.y, axes, ge::DT_FLOAT16, {A, R, ONE}, {R, ONE, ZERO}); |
| 261 | } | 255 | } |
| 262 | 256 | ||
| 263 | /* | 257 | /* |
| @@ -365,53 +359,51 @@ void Add_Layer_Norm_Slice_BeforeAutofuse(ascir::HintGraph &graph) { | |||
| 365 | auto a = graph.CreateAxis("A", A); | 359 | auto a = graph.CreateAxis("A", A); |
| 366 | auto r = graph.CreateAxis("R", R); | 360 | auto r = graph.CreateAxis("R", R); |
| 367 | const std::initializer_list<int64_t> axes = {a.id, r.id}; | 361 | const std::initializer_list<int64_t> axes = {a.id, r.id}; |
| 368 | - | ||
| 369 | - int exec_order = 0; | ||
| 370 | Load x1Local("x1Local"); | 362 | Load x1Local("x1Local"); |
| 371 | - CreateDataAndLoad(x1Local, graph, "x1", exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 363 | + CreateDataAndLoad(x1Local, graph, "x1", axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 372 | Load x2Local("x2Local"); | 364 | Load x2Local("x2Local"); |
| 373 | - CreateDataAndLoad(x2Local, graph, "x2", exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 365 | + CreateDataAndLoad(x2Local, graph, "x2", axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 374 | Load biasLocal("biasLocal"); | 366 | Load biasLocal("biasLocal"); |
| 375 | - CreateDataAndLoad(biasLocal, graph, "bias", exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 367 | + CreateDataAndLoad(biasLocal, graph, "bias", axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 376 | 368 | ||
| 377 | Concat mean("mean"); | 369 | Concat mean("mean"); |
| 378 | mean.attr.api.unit = af::ComputeUnit::kUnitVector; | 370 | mean.attr.api.unit = af::ComputeUnit::kUnitVector; |
| 379 | mean.x = {x1Local.y, x2Local.y, biasLocal.y}; | 371 | mean.x = {x1Local.y, x2Local.y, biasLocal.y}; |
| 380 | - SetNodeScheduleAndTensor(mean, exec_order, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); | 372 | + SetNodeScheduleAndTensor(mean, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); |
| 381 | 373 | ||
| 382 | Store x_out("x_out"); | 374 | Store x_out("x_out"); |
| 383 | - InitInputNode(x_out, mean.y, exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 375 | + InitInputNode(x_out, mean.y, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 384 | 376 | ||
| 385 | Concat rstd("rstd"); | 377 | Concat rstd("rstd"); |
| 386 | rstd.attr.api.unit = af::ComputeUnit::kUnitVector; | 378 | rstd.attr.api.unit = af::ComputeUnit::kUnitVector; |
| 387 | rstd.x = {mean.y, mean.y}; | 379 | rstd.x = {mean.y, mean.y}; |
| 388 | - SetNodeScheduleAndTensor(rstd, exec_order, axes, ge::DT_FLOAT, {A, R}, {R, ONE}); | 380 | + SetNodeScheduleAndTensor(rstd, axes, ge::DT_FLOAT, {A, R}, {R, ONE}); |
| 389 | 381 | ||
| 390 | Store mean_out("mean_out"); | 382 | Store mean_out("mean_out"); |
| 391 | - InitInputNode(mean_out, mean.y, exec_order, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); | 383 | + InitInputNode(mean_out, mean.y, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); |
| 392 | Store rstd_out("rstd_out"); | 384 | Store rstd_out("rstd_out"); |
| 393 | - InitInputNode(rstd_out, rstd.y, exec_order, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); | 385 | + InitInputNode(rstd_out, rstd.y, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); |
| 394 | 386 | ||
| 395 | Load betaLocal("betaLocal"); | 387 | Load betaLocal("betaLocal"); |
| 396 | - CreateDataAndLoad(betaLocal, graph, "beta", exec_order, axes, ge::DT_FLOAT16, {ONE, R}, {ZERO, ONE}); | 388 | + CreateDataAndLoad(betaLocal, graph, "beta", axes, ge::DT_FLOAT16, {ONE, R}, {ZERO, ONE}); |
| 397 | Load gammaLocal("gammaLocal"); | 389 | Load gammaLocal("gammaLocal"); |
| 398 | - CreateDataAndLoad(gammaLocal, graph, "gamma", exec_order, axes, ge::DT_FLOAT16, {ONE, R}, {ZERO, ONE}); | 390 | + CreateDataAndLoad(gammaLocal, graph, "gamma", axes, ge::DT_FLOAT16, {ONE, R}, {ZERO, ONE}); |
| 399 | 391 | ||
| 400 | Concat y("y"); | 392 | Concat y("y"); |
| 401 | y.attr.api.unit = af::ComputeUnit::kUnitVector; | 393 | y.attr.api.unit = af::ComputeUnit::kUnitVector; |
| 402 | y.x = {rstd.y, betaLocal.y, gammaLocal.y, rstd.y}; | 394 | y.x = {rstd.y, betaLocal.y, gammaLocal.y, rstd.y}; |
| 403 | - SetNodeScheduleAndTensor(y, exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 395 | + SetNodeScheduleAndTensor(y, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 404 | Store y_out("y_out"); | 396 | Store y_out("y_out"); |
| 405 | - InitInputNode(y_out, y.y, exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 397 | + InitInputNode(y_out, y.y, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 406 | 398 | ||
| 407 | Output buf1("buf1"); | 399 | Output buf1("buf1"); |
| 408 | - InitInputNode(buf1, x_out.y, exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 400 | + InitInputNode(buf1, x_out.y, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 409 | Output buf2("buf2"); | 401 | Output buf2("buf2"); |
| 410 | - InitInputNode(buf2, mean_out.y, exec_order, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); | 402 | + InitInputNode(buf2, mean_out.y, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); |
| 411 | Output buf3("buf3"); | 403 | Output buf3("buf3"); |
| 412 | - InitInputNode(buf3, rstd_out.y, exec_order, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); | 404 | + InitInputNode(buf3, rstd_out.y, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); |
| 413 | Output buf("buf"); | 405 | Output buf("buf"); |
| 414 | - InitInputNode(buf, y_out.y, exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 406 | + InitInputNode(buf, y_out.y, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 415 | } | 407 | } |
| 416 | 408 | ||
| 417 | /* | 409 | /* |
| @@ -532,57 +524,55 @@ void Add_Layer_Norm_Welford_BeforeAutofuse(ascir::HintGraph &graph) { | |||
| 532 | auto a = graph.CreateAxis("A", A); | 524 | auto a = graph.CreateAxis("A", A); |
| 533 | auto r = graph.CreateAxis("R", R); | 525 | auto r = graph.CreateAxis("R", R); |
| 534 | const std::initializer_list<int64_t> axes = {a.id, r.id}; | 526 | const std::initializer_list<int64_t> axes = {a.id, r.id}; |
| 535 | - | ||
| 536 | - int exec_order = 0; | ||
| 537 | Load x1Local("x1Local"); | 527 | Load x1Local("x1Local"); |
| 538 | - CreateDataAndLoad(x1Local, graph, "x1", exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 528 | + CreateDataAndLoad(x1Local, graph, "x1", axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 539 | Load x2Local("x2Local"); | 529 | Load x2Local("x2Local"); |
| 540 | - CreateDataAndLoad(x2Local, graph, "x2", exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 530 | + CreateDataAndLoad(x2Local, graph, "x2", axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 541 | Load biasLocal("biasLocal"); | 531 | Load biasLocal("biasLocal"); |
| 542 | - CreateDataAndLoad(biasLocal, graph, "bias", exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 532 | + CreateDataAndLoad(biasLocal, graph, "bias", axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 543 | 533 | ||
| 544 | Concat part1("part1"); | 534 | Concat part1("part1"); |
| 545 | part1.attr.api.unit = af::ComputeUnit::kUnitVector; | 535 | part1.attr.api.unit = af::ComputeUnit::kUnitVector; |
| 546 | part1.x = {x1Local.y, x2Local.y, biasLocal.y}; | 536 | part1.x = {x1Local.y, x2Local.y, biasLocal.y}; |
| 547 | - SetNodeScheduleAndTensor(part1, exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 537 | + SetNodeScheduleAndTensor(part1, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 548 | 538 | ||
| 549 | Store x_out("x_out"); | 539 | Store x_out("x_out"); |
| 550 | - InitInputNode(x_out, part1.y, exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 540 | + InitInputNode(x_out, part1.y, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 551 | Store x_fp32_out("x_fp32_out"); | 541 | Store x_fp32_out("x_fp32_out"); |
| 552 | - InitInputNode(x_fp32_out, part1.y, exec_order, axes, ge::DT_FLOAT, {A, R}, {R, ONE}); | 542 | + InitInputNode(x_fp32_out, part1.y, axes, ge::DT_FLOAT, {A, R}, {R, ONE}); |
| 553 | 543 | ||
| 554 | Concat part1Final("part1Final"); | 544 | Concat part1Final("part1Final"); |
| 555 | part1Final.attr.api.unit = af::ComputeUnit::kUnitVector; | 545 | part1Final.attr.api.unit = af::ComputeUnit::kUnitVector; |
| 556 | part1Final.x = {part1.y, part1.y}; | 546 | part1Final.x = {part1.y, part1.y}; |
| 557 | - SetNodeScheduleAndTensor(part1Final, exec_order, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); | 547 | + SetNodeScheduleAndTensor(part1Final, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); |
| 558 | 548 | ||
| 559 | Store mean_out("mean_out"); | 549 | Store mean_out("mean_out"); |
| 560 | - InitInputNode(mean_out, part1Final.y, exec_order, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); | 550 | + InitInputNode(mean_out, part1Final.y, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); |
| 561 | Store rstd_out("rstd_out"); | 551 | Store rstd_out("rstd_out"); |
| 562 | - InitInputNode(rstd_out, part1Final.y, exec_order, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); | 552 | + InitInputNode(rstd_out, part1Final.y, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); |
| 563 | 553 | ||
| 564 | Load x32("x32"); | 554 | Load x32("x32"); |
| 565 | - InitInputNode(x32, x_fp32_out.y, exec_order, axes, ge::DT_FLOAT, {A, R}, {R, ONE}); | 555 | + InitInputNode(x32, x_fp32_out.y, axes, ge::DT_FLOAT, {A, R}, {R, ONE}); |
| 566 | Load betaLocal("betaLocal"); | 556 | Load betaLocal("betaLocal"); |
| 567 | - CreateDataAndLoad(betaLocal, graph, "beta", exec_order, axes, ge::DT_FLOAT16, {ONE, R}, {ZERO, ONE}); | 557 | + CreateDataAndLoad(betaLocal, graph, "beta", axes, ge::DT_FLOAT16, {ONE, R}, {ZERO, ONE}); |
| 568 | Load gammaLocal("gammaLocal"); | 558 | Load gammaLocal("gammaLocal"); |
| 569 | - CreateDataAndLoad(gammaLocal, graph, "gamma", exec_order, axes, ge::DT_FLOAT16, {ONE, R}, {ZERO, ONE}); | 559 | + CreateDataAndLoad(gammaLocal, graph, "gamma", axes, ge::DT_FLOAT16, {ONE, R}, {ZERO, ONE}); |
| 570 | 560 | ||
| 571 | Concat y("y"); | 561 | Concat y("y"); |
| 572 | y.attr.api.unit = af::ComputeUnit::kUnitVector; | 562 | y.attr.api.unit = af::ComputeUnit::kUnitVector; |
| 573 | y.x = {x32.y, betaLocal.y, gammaLocal.y, x32.y}; | 563 | y.x = {x32.y, betaLocal.y, gammaLocal.y, x32.y}; |
| 574 | - SetNodeScheduleAndTensor(y, exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 564 | + SetNodeScheduleAndTensor(y, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 575 | Store y_out("y_out"); | 565 | Store y_out("y_out"); |
| 576 | - InitInputNode(y_out, y.y, exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 566 | + InitInputNode(y_out, y.y, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 577 | 567 | ||
| 578 | Output buf1("buf1"); | 568 | Output buf1("buf1"); |
| 579 | - InitInputNode(buf1, x_out.y, exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 569 | + InitInputNode(buf1, x_out.y, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 580 | Output buf2("buf2"); | 570 | Output buf2("buf2"); |
| 581 | - InitInputNode(buf2, mean_out.y, exec_order, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); | 571 | + InitInputNode(buf2, mean_out.y, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); |
| 582 | Output buf3("buf3"); | 572 | Output buf3("buf3"); |
| 583 | - InitInputNode(buf3, rstd_out.y, exec_order, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); | 573 | + InitInputNode(buf3, rstd_out.y, axes, ge::DT_FLOAT, {A, ONE}, {ONE, ONE}); |
| 584 | Output buf("buf"); | 574 | Output buf("buf"); |
| 585 | - InitInputNode(buf, y_out.y, exec_order, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); | 575 | + InitInputNode(buf, y_out.y, axes, ge::DT_FLOAT16, {A, R}, {R, ONE}); |
| 586 | } | 576 | } |
| 587 | 577 | ||
| 588 | void Add_Layer_Norm_Welford_AfterScheduler(ascir::HintGraph &graph) { | 578 | void Add_Layer_Norm_Welford_AfterScheduler(ascir::HintGraph &graph) { |
| @@ -434,10 +434,9 @@ struct ConcatNormalAxisInfo { | |||
| 434 | }; | 434 | }; |
| 435 | 435 | ||
| 436 | // 创建Data节点(输入数据)并设置属性 | 436 | // 创建Data节点(输入数据)并设置属性 |
| 437 | -void CreateDataNode(Data &node, ascir::HintGraph &graph, const char *name, int &exec_order, | 437 | +void CreateDataNode(Data &node, ascir::HintGraph &graph, const char *name, const ConcatNormalAxisInfo &ax, |
| 438 | - const ConcatNormalAxisInfo &ax, ge::DataType dtype, const std::vector<af::Expression> &repeats, | 438 | + ge::DataType dtype, const std::vector<af::Expression> &repeats, |
| 439 | const std::vector<af::Expression> &strides) { | 439 | const std::vector<af::Expression> &strides) { |
| 440 | - node.attr.sched.exec_order = exec_order++; | ||
| 441 | node.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; | 440 | node.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; |
| 442 | node.y.dtype = dtype; | 441 | node.y.dtype = dtype; |
| 443 | *node.y.axis = {ax.a_id, ax.r_id, ax.bl_id}; | 442 | *node.y.axis = {ax.a_id, ax.r_id, ax.bl_id}; |
| @@ -446,10 +445,9 @@ void CreateDataNode(Data &node, ascir::HintGraph &graph, const char *name, int & | |||
| 446 | } | 445 | } |
| 447 | 446 | ||
| 448 | // 创建Load节点并设置属性 | 447 | // 创建Load节点并设置属性 |
| 449 | -void CreateLoadNode(Load &node, const Data &src, int &exec_order, const ConcatNormalAxisInfo &ax, ge::DataType dtype, | 448 | +void CreateLoadNode(Load &node, const Data &src, const ConcatNormalAxisInfo &ax, ge::DataType dtype, |
| 450 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { | 449 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { |
| 451 | node.x = src.y; | 450 | node.x = src.y; |
| 452 | - node.attr.sched.exec_order = exec_order++; | ||
| 453 | node.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; | 451 | node.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; |
| 454 | node.y.dtype = dtype; | 452 | node.y.dtype = dtype; |
| 455 | *node.y.axis = {ax.a_id, ax.r_id, ax.bl_id}; | 453 | *node.y.axis = {ax.a_id, ax.r_id, ax.bl_id}; |
| @@ -458,9 +456,8 @@ void CreateLoadNode(Load &node, const Data &src, int &exec_order, const ConcatNo | |||
| 458 | } | 456 | } |
| 459 | 457 | ||
| 460 | // 创建Store节点并设置属性 | 458 | // 创建Store节点并设置属性 |
| 461 | -void CreateStoreNode(Store &node, int &exec_order, const ConcatNormalAxisInfo &ax, ge::DataType dtype, | 459 | +void CreateStoreNode(Store &node, const ConcatNormalAxisInfo &ax, ge::DataType dtype, |
| 462 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { | 460 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { |
| 463 | - node.attr.sched.exec_order = exec_order++; | ||
| 464 | node.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; | 461 | node.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; |
| 465 | node.y.dtype = dtype; | 462 | node.y.dtype = dtype; |
| 466 | *node.y.axis = {ax.a_id, ax.r_id, ax.bl_id}; | 463 | *node.y.axis = {ax.a_id, ax.r_id, ax.bl_id}; |
| @@ -469,22 +466,19 @@ void CreateStoreNode(Store &node, int &exec_order, const ConcatNormalAxisInfo &a | |||
| 469 | } | 466 | } |
| 470 | 467 | ||
| 471 | // 创建Output节点并设置属性 | 468 | // 创建Output节点并设置属性 |
| 472 | -void CreateOutputNode(Output &node, int &exec_order, const ConcatNormalAxisInfo &ax, ge::DataType dtype, | 469 | +void CreateOutputNode(Output &node, const ConcatNormalAxisInfo &ax, ge::DataType dtype, |
| 473 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { | 470 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { |
| 474 | - node.attr.sched.exec_order = exec_order++; | ||
| 475 | node.y.dtype = dtype; | 471 | node.y.dtype = dtype; |
| 476 | *node.y.axis = {ax.a_id, ax.r_id, ax.bl_id}; | 472 | *node.y.axis = {ax.a_id, ax.r_id, ax.bl_id}; |
| 477 | *node.y.repeats = repeats; | 473 | *node.y.repeats = repeats; |
| 478 | *node.y.strides = strides; | 474 | *node.y.strides = strides; |
| 479 | } | 475 | } |
| 480 | 476 | ||
| 481 | -void BuildMeanConcatNode(Concat &mean, int &exec_order, const ConcatNormalAxisInfo &ax, | 477 | +void BuildMeanConcatNode(Concat &mean, const ConcatNormalAxisInfo &ax, const std::vector<af::AscOpOutput> &inputs) { |
| 482 | - const std::vector<af::AscOpOutput> &inputs) { | ||
| 483 | auto aoo = std::vector<af::Expression>{ax.A, ax.ONE, ax.ONE}; | 478 | auto aoo = std::vector<af::Expression>{ax.A, ax.ONE, ax.ONE}; |
| 484 | auto oss_v = std::vector<af::Expression>{ax.ONE, ax.ZERO, ax.ZERO}; | 479 | auto oss_v = std::vector<af::Expression>{ax.ONE, ax.ZERO, ax.ZERO}; |
| 485 | mean.attr.api.unit = af::ComputeUnit::kUnitVector; | 480 | mean.attr.api.unit = af::ComputeUnit::kUnitVector; |
| 486 | mean.x = inputs; | 481 | mean.x = inputs; |
| 487 | - mean.attr.sched.exec_order = exec_order++; | ||
| 488 | mean.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; | 482 | mean.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; |
| 489 | mean.y.dtype = ge::DT_FLOAT; | 483 | mean.y.dtype = ge::DT_FLOAT; |
| 490 | *mean.y.axis = {ax.a_id, ax.r_id, ax.bl_id}; | 484 | *mean.y.axis = {ax.a_id, ax.r_id, ax.bl_id}; |
| @@ -492,7 +486,7 @@ void BuildMeanConcatNode(Concat &mean, int &exec_order, const ConcatNormalAxisIn | |||
| 492 | *mean.y.strides = oss_v; | 486 | *mean.y.strides = oss_v; |
| 493 | } | 487 | } |
| 494 | 488 | ||
| 495 | -void BuildConcatOutputNodes(int &exec_order, const ConcatNormalAxisInfo &ax, const Store &x_out, | 489 | +void BuildConcatOutputNodes(const ConcatNormalAxisInfo &ax, const Store &x_out, |
| 496 | const std::vector<Store> &output_stores) { | 490 | const std::vector<Store> &output_stores) { |
| 497 | auto arb = std::vector<af::Expression>{ax.A, ax.R, ax.ONE}; | 491 | auto arb = std::vector<af::Expression>{ax.A, ax.R, ax.ONE}; |
| 498 | auto rs = std::vector<af::Expression>{ax.R, ax.ONE, ax.ZERO}; | 492 | auto rs = std::vector<af::Expression>{ax.R, ax.ONE, ax.ZERO}; |
| @@ -500,23 +494,22 @@ void BuildConcatOutputNodes(int &exec_order, const ConcatNormalAxisInfo &ax, con | |||
| 500 | auto oss_v = std::vector<af::Expression>{ax.ONE, ax.ZERO, ax.ZERO}; | 494 | auto oss_v = std::vector<af::Expression>{ax.ONE, ax.ZERO, ax.ZERO}; |
| 501 | Output buf1("buf1"); | 495 | Output buf1("buf1"); |
| 502 | buf1.x = x_out.y; | 496 | buf1.x = x_out.y; |
| 503 | - buf1.attr.sched.exec_order = exec_order++; | ||
| 504 | buf1.y.dtype = ge::DT_FLOAT16; | 497 | buf1.y.dtype = ge::DT_FLOAT16; |
| 505 | *buf1.y.axis = {ax.a_id, ax.r_id, ax.bl_id}; | 498 | *buf1.y.axis = {ax.a_id, ax.r_id, ax.bl_id}; |
| 506 | *buf1.y.repeats = arb; | 499 | *buf1.y.repeats = arb; |
| 507 | *buf1.y.strides = rs; | 500 | *buf1.y.strides = rs; |
| 508 | 501 | ||
| 509 | Output buf2("buf2"); | 502 | Output buf2("buf2"); |
| 510 | - CreateOutputNode(buf2, exec_order, ax, ge::DT_FLOAT, aoo, oss_v); | 503 | + CreateOutputNode(buf2, ax, ge::DT_FLOAT, aoo, oss_v); |
| 511 | buf2.x = output_stores[0].y; | 504 | buf2.x = output_stores[0].y; |
| 512 | Output buf3("buf3"); | 505 | Output buf3("buf3"); |
| 513 | - CreateOutputNode(buf3, exec_order, ax, ge::DT_FLOAT, aoo, oss_v); | 506 | + CreateOutputNode(buf3, ax, ge::DT_FLOAT, aoo, oss_v); |
| 514 | buf3.x = output_stores[1].y; | 507 | buf3.x = output_stores[1].y; |
| 515 | Output buf("buf"); | 508 | Output buf("buf"); |
| 516 | - CreateOutputNode(buf, exec_order, ax, ge::DT_FLOAT16, arb, rs); | 509 | + CreateOutputNode(buf, ax, ge::DT_FLOAT16, arb, rs); |
| 517 | buf.x = output_stores[2].y; | 510 | buf.x = output_stores[2].y; |
| 518 | Output buf4("buf4"); | 511 | Output buf4("buf4"); |
| 519 | - CreateOutputNode(buf4, exec_order, ax, ge::DT_FLOAT16, arb, rs); | 512 | + CreateOutputNode(buf4, ax, ge::DT_FLOAT16, arb, rs); |
| 520 | buf4.x = output_stores[3].y; | 513 | buf4.x = output_stores[3].y; |
| 521 | } | 514 | } |
| 522 | 515 | ||
| @@ -527,9 +520,8 @@ struct ConcatVecExprs { | |||
| 527 | std::vector<af::Expression> oss_v; | 520 | std::vector<af::Expression> oss_v; |
| 528 | }; | 521 | }; |
| 529 | 522 | ||
| 530 | -void CreateStoreFp16Node(Store &store, int &exec_order, const ConcatNormalAxisInfo &ax, const af::AscOpOutput &input, | 523 | +void CreateStoreFp16Node(Store &store, const ConcatNormalAxisInfo &ax, const af::AscOpOutput &input, |
| 531 | const ConcatVecExprs &vecs) { | 524 | const ConcatVecExprs &vecs) { |
| 532 | - store.attr.sched.exec_order = exec_order++; | ||
| 533 | store.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; | 525 | store.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; |
| 534 | store.x = input; | 526 | store.x = input; |
| 535 | store.y.dtype = ge::DT_FLOAT16; | 527 | store.y.dtype = ge::DT_FLOAT16; |
| @@ -538,16 +530,15 @@ void CreateStoreFp16Node(Store &store, int &exec_order, const ConcatNormalAxisIn | |||
| 538 | *store.y.strides = vecs.rs; | 530 | *store.y.strides = vecs.rs; |
| 539 | } | 531 | } |
| 540 | 532 | ||
| 541 | -void BuildConcatRstdYAndOutputs(int &exec_order, const ConcatNormalAxisInfo &ax, const ConcatVecExprs &vecs, | 533 | +void BuildConcatRstdYAndOutputs(const ConcatNormalAxisInfo &ax, const ConcatVecExprs &vecs, |
| 542 | const af::AscOpOutput &mean_y, const Store &x_out, const Store &mean_out, | 534 | const af::AscOpOutput &mean_y, const Store &x_out, const Store &mean_out, |
| 543 | ascir::HintGraph &graph, const af::AscOpOutput &x1_out, const af::AscOpOutput &x2_out) { | 535 | ascir::HintGraph &graph, const af::AscOpOutput &x1_out, const af::AscOpOutput &x2_out) { |
| 544 | auto oob = std::vector<af::Expression>{ax.ONE, ax.ONE, ax.BL}; | 536 | auto oob = std::vector<af::Expression>{ax.ONE, ax.ONE, ax.BL}; |
| 545 | auto oso = std::vector<af::Expression>{ax.ZERO, ax.ZERO, ax.ONE}; | 537 | auto oso = std::vector<af::Expression>{ax.ZERO, ax.ZERO, ax.ONE}; |
| 546 | Data one("one", graph); | 538 | Data one("one", graph); |
| 547 | - CreateDataNode(one, graph, "one", exec_order, ax, ge::DT_FLOAT, oob, oso); | 539 | + CreateDataNode(one, graph, "one", ax, ge::DT_FLOAT, oob, oso); |
| 548 | Concat rstd("rstd"); | 540 | Concat rstd("rstd"); |
| 549 | rstd.attr.api.unit = af::ComputeUnit::kUnitVector; | 541 | rstd.attr.api.unit = af::ComputeUnit::kUnitVector; |
| 550 | - rstd.attr.sched.exec_order = exec_order++; | ||
| 551 | rstd.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; | 542 | rstd.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; |
| 552 | rstd.x = {mean_y, mean_y, one.y}; | 543 | rstd.x = {mean_y, mean_y, one.y}; |
| 553 | rstd.y.dtype = ge::DT_FLOAT; | 544 | rstd.y.dtype = ge::DT_FLOAT; |
| @@ -556,23 +547,22 @@ void BuildConcatRstdYAndOutputs(int &exec_order, const ConcatNormalAxisInfo &ax, | |||
| 556 | *rstd.y.strides = vecs.rs; | 547 | *rstd.y.strides = vecs.rs; |
| 557 | 548 | ||
| 558 | Store rstd_out("rstd_out"); | 549 | Store rstd_out("rstd_out"); |
| 559 | - CreateStoreNode(rstd_out, exec_order, ax, ge::DT_FLOAT, vecs.aoo, vecs.oss_v); | 550 | + CreateStoreNode(rstd_out, ax, ge::DT_FLOAT, vecs.aoo, vecs.oss_v); |
| 560 | rstd_out.x = rstd.y; | 551 | rstd_out.x = rstd.y; |
| 561 | 552 | ||
| 562 | auto orb = std::vector<af::Expression>{ax.ONE, ax.R, ax.ONE}; | 553 | auto orb = std::vector<af::Expression>{ax.ONE, ax.R, ax.ONE}; |
| 563 | auto bg_strides = std::vector<af::Expression>{ax.ZERO, ax.ONE, ax.ZERO}; | 554 | auto bg_strides = std::vector<af::Expression>{ax.ZERO, ax.ONE, ax.ZERO}; |
| 564 | Data beta("beta", graph); | 555 | Data beta("beta", graph); |
| 565 | - CreateDataNode(beta, graph, "beta", exec_order, ax, ge::DT_FLOAT16, orb, bg_strides); | 556 | + CreateDataNode(beta, graph, "beta", ax, ge::DT_FLOAT16, orb, bg_strides); |
| 566 | Load betaLocal("betaLocal"); | 557 | Load betaLocal("betaLocal"); |
| 567 | - CreateLoadNode(betaLocal, beta, exec_order, ax, ge::DT_FLOAT16, orb, bg_strides); | 558 | + CreateLoadNode(betaLocal, beta, ax, ge::DT_FLOAT16, orb, bg_strides); |
| 568 | Data gamma("gamma", graph); | 559 | Data gamma("gamma", graph); |
| 569 | - CreateDataNode(gamma, graph, "gamma", exec_order, ax, ge::DT_FLOAT16, orb, bg_strides); | 560 | + CreateDataNode(gamma, graph, "gamma", ax, ge::DT_FLOAT16, orb, bg_strides); |
| 570 | Load gammaLocal("gammaLocal"); | 561 | Load gammaLocal("gammaLocal"); |
| 571 | - CreateLoadNode(gammaLocal, gamma, exec_order, ax, ge::DT_FLOAT16, orb, bg_strides); | 562 | + CreateLoadNode(gammaLocal, gamma, ax, ge::DT_FLOAT16, orb, bg_strides); |
| 572 | 563 | ||
| 573 | Concat y("y"); | 564 | Concat y("y"); |
| 574 | y.attr.api.unit = af::ComputeUnit::kUnitVector; | 565 | y.attr.api.unit = af::ComputeUnit::kUnitVector; |
| 575 | - y.attr.sched.exec_order = exec_order++; | ||
| 576 | y.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; | 566 | y.attr.sched.axis = {ax.a_id, ax.r_id, ax.bl_id}; |
| 577 | y.x = {rstd.y, betaLocal.y, gammaLocal.y, rstd.y}; | 567 | y.x = {rstd.y, betaLocal.y, gammaLocal.y, rstd.y}; |
| 578 | y.y.dtype = ge::DT_FLOAT16; | 568 | y.y.dtype = ge::DT_FLOAT16; |
| @@ -590,13 +580,13 @@ void BuildConcatRstdYAndOutputs(int &exec_order, const ConcatNormalAxisInfo &ax, | |||
| 590 | *concat.y.strides = vecs.rs; | 580 | *concat.y.strides = vecs.rs; |
| 591 | 581 | ||
| 592 | Store y_out("y_out"); | 582 | Store y_out("y_out"); |
| 593 | - CreateStoreFp16Node(y_out, exec_order, ax, y.y, vecs); | 583 | + CreateStoreFp16Node(y_out, ax, y.y, vecs); |
| 594 | Store cat_out("cat_out"); | 584 | Store cat_out("cat_out"); |
| 595 | - CreateStoreFp16Node(cat_out, exec_order, ax, y.y, vecs); | 585 | + CreateStoreFp16Node(cat_out, ax, y.y, vecs); |
| 596 | (void)y_out; | 586 | (void)y_out; |
| 597 | (void)cat_out; | 587 | (void)cat_out; |
| 598 | 588 | ||
| 599 | - BuildConcatOutputNodes(exec_order, ax, x_out, {mean_out, rstd_out, y_out, cat_out}); | 589 | + BuildConcatOutputNodes(ax, x_out, {mean_out, rstd_out, y_out, cat_out}); |
| 600 | } | 590 | } |
| 601 | 591 | ||
| 602 | void Concat_Normal_BeforeAutofuse(ascir::HintGraph &graph) { | 592 | void Concat_Normal_BeforeAutofuse(ascir::HintGraph &graph) { |
| @@ -610,32 +600,31 @@ void Concat_Normal_BeforeAutofuse(ascir::HintGraph &graph) { | |||
| 610 | auto bl = graph.CreateAxis("BL", BL); | 600 | auto bl = graph.CreateAxis("BL", BL); |
| 611 | ConcatNormalAxisInfo ax{A, R, BL, ONE, ZERO, a.id, r.id, bl.id}; | 601 | ConcatNormalAxisInfo ax{A, R, BL, ONE, ZERO, a.id, r.id, bl.id}; |
| 612 | ConcatVecExprs vecs{{A, R, ONE}, {R, ONE, ZERO}, {A, ONE, ONE}, {ONE, ZERO, ZERO}}; | 602 | ConcatVecExprs vecs{{A, R, ONE}, {R, ONE, ZERO}, {A, ONE, ONE}, {ONE, ZERO, ZERO}}; |
| 613 | - int exec_order = 0; | ||
| 614 | 603 | ||
| 615 | auto arb = std::vector<af::Expression>{ax.A, ax.R, ax.ONE}; | 604 | auto arb = std::vector<af::Expression>{ax.A, ax.R, ax.ONE}; |
| 616 | auto rs = std::vector<af::Expression>{ax.R, ax.ONE, ax.ZERO}; | 605 | auto rs = std::vector<af::Expression>{ax.R, ax.ONE, ax.ZERO}; |
| 617 | Data x1("x1", graph); | 606 | Data x1("x1", graph); |
| 618 | - CreateDataNode(x1, graph, "x1", exec_order, ax, ge::DT_FLOAT16, arb, rs); | 607 | + CreateDataNode(x1, graph, "x1", ax, ge::DT_FLOAT16, arb, rs); |
| 619 | Load x1Local("x1Local"); | 608 | Load x1Local("x1Local"); |
| 620 | - CreateLoadNode(x1Local, x1, exec_order, ax, ge::DT_FLOAT16, arb, rs); | 609 | + CreateLoadNode(x1Local, x1, ax, ge::DT_FLOAT16, arb, rs); |
| 621 | Data x2("x2", graph); | 610 | Data x2("x2", graph); |
| 622 | - CreateDataNode(x2, graph, "x2", exec_order, ax, ge::DT_FLOAT16, arb, rs); | 611 | + CreateDataNode(x2, graph, "x2", ax, ge::DT_FLOAT16, arb, rs); |
| 623 | Load x2Local("x2Local"); | 612 | Load x2Local("x2Local"); |
| 624 | - CreateLoadNode(x2Local, x2, exec_order, ax, ge::DT_FLOAT16, arb, rs); | 613 | + CreateLoadNode(x2Local, x2, ax, ge::DT_FLOAT16, arb, rs); |
| 625 | Data bias("bias", graph); | 614 | Data bias("bias", graph); |
| 626 | - CreateDataNode(bias, graph, "bias", exec_order, ax, ge::DT_FLOAT16, arb, rs); | 615 | + CreateDataNode(bias, graph, "bias", ax, ge::DT_FLOAT16, arb, rs); |
| 627 | Load biasLocal("biasLocal"); | 616 | Load biasLocal("biasLocal"); |
| 628 | - CreateLoadNode(biasLocal, bias, exec_order, ax, ge::DT_FLOAT16, arb, rs); | 617 | + CreateLoadNode(biasLocal, bias, ax, ge::DT_FLOAT16, arb, rs); |
| 629 | Concat mean("mean"); | 618 | Concat mean("mean"); |
| 630 | - BuildMeanConcatNode(mean, exec_order, ax, {x1Local.y, x2Local.y, biasLocal.y}); | 619 | + BuildMeanConcatNode(mean, ax, {x1Local.y, x2Local.y, biasLocal.y}); |
| 631 | 620 | ||
| 632 | Store x_out("x_out"); | 621 | Store x_out("x_out"); |
| 633 | - CreateStoreFp16Node(x_out, exec_order, ax, mean.y, vecs); | 622 | + CreateStoreFp16Node(x_out, ax, mean.y, vecs); |
| 634 | Store mean_out("mean_out"); | 623 | Store mean_out("mean_out"); |
| 635 | - CreateStoreNode(mean_out, exec_order, ax, ge::DT_FLOAT, vecs.aoo, vecs.oss_v); | 624 | + CreateStoreNode(mean_out, ax, ge::DT_FLOAT, vecs.aoo, vecs.oss_v); |
| 636 | mean_out.x = mean.y; | 625 | mean_out.x = mean.y; |
| 637 | 626 | ||
| 638 | - BuildConcatRstdYAndOutputs(exec_order, ax, vecs, mean.y, x_out, mean_out, graph, x1Local.y, x2Local.y); | 627 | + BuildConcatRstdYAndOutputs(ax, vecs, mean.y, x_out, mean_out, graph, x1Local.y, x2Local.y); |
| 639 | } | 628 | } |
| 640 | 629 | ||
| 641 | /* | 630 | /* |
| @@ -775,8 +764,8 @@ Status BuildConcatGroupAscendGraphND(af::AscGraph &graph) { | |||
| 775 | auto nd = graph.CreateAxis("nd", ND); | 764 | auto nd = graph.CreateAxis("nd", ND); |
| 776 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 765 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 777 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 766 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 778 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 767 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 779 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 768 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 780 | LOOP(*ndB) { | 769 | LOOP(*ndB) { |
| 781 | LOOP(*ndbT) { | 770 | LOOP(*ndbT) { |
| 782 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 771 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -801,7 +790,7 @@ Status BuildConcatGroupAscendGraphS0S1MultiTiling(af::AscGraph &graph) { | |||
| 801 | auto [s1T, s1t] = graph.TileSplit(s1.id); | 790 | auto [s1T, s1t] = graph.TileSplit(s1.id); |
| 802 | auto s1Ts2T = *graph.MergeAxis({s1T->id, s2T->id}); | 791 | auto s1Ts2T = *graph.MergeAxis({s1T->id, s2T->id}); |
| 803 | auto [s1Ts2TB, s1Ts2Tb] = graph.BlockSplit(s1Ts2T.id); | 792 | auto [s1Ts2TB, s1Ts2Tb] = graph.BlockSplit(s1Ts2T.id); |
| 804 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {s0, s1}); | 793 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {s0, s1}, 0); |
| 805 | LOOP(*s1Ts2TB) { | 794 | LOOP(*s1Ts2TB) { |
| 806 | LOOP(*s1Ts2Tb) { | 795 | LOOP(*s1Ts2Tb) { |
| 807 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 796 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -851,8 +840,8 @@ Status BuildConcatGroupAscendGraphS0S1_Reorder(af::AscGraph &graph) { | |||
| 851 | auto s1 = graph.CreateAxis("s1", S1); | 840 | auto s1 = graph.CreateAxis("s1", S1); |
| 852 | auto [ndB, ndb] = graph.BlockSplit(s0.id); | 841 | auto [ndB, ndb] = graph.BlockSplit(s0.id); |
| 853 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 842 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 854 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {s0}); | 843 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {s0}, 0); |
| 855 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {s1}); | 844 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {s1}, 1); |
| 856 | LOOP(*ndB) { | 845 | LOOP(*ndB) { |
| 857 | LOOP(*ndbT) { | 846 | LOOP(*ndbT) { |
| 858 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 847 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -883,8 +872,8 @@ Status BuildConcatGroupAscendGraphS1S0_Reorder(af::AscGraph &graph) { | |||
| 883 | auto s0 = graph.CreateAxis("s0", S0); | 872 | auto s0 = graph.CreateAxis("s0", S0); |
| 884 | auto [ndB, ndb] = graph.BlockSplit(s1.id); | 873 | auto [ndB, ndb] = graph.BlockSplit(s1.id); |
| 885 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 874 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 886 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {s1}); | 875 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {s1}, 0); |
| 887 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {s0}); | 876 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {s0}, 1); |
| 888 | LOOP(*ndB) { | 877 | LOOP(*ndB) { |
| 889 | LOOP(*ndbT) { | 878 | LOOP(*ndbT) { |
| 890 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 879 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -913,8 +902,8 @@ Status BuildConcatGroupAscendGraphS0(af::AscGraph &graph) { | |||
| 913 | auto z0 = graph.CreateAxis("z0", S0); | 902 | auto z0 = graph.CreateAxis("z0", S0); |
| 914 | auto [z0B, z0b] = graph.BlockSplit(z0.id); | 903 | auto [z0B, z0b] = graph.BlockSplit(z0.id); |
| 915 | auto [z0bT, z0bt] = graph.TileSplit(z0b->id); | 904 | auto [z0bT, z0bt] = graph.TileSplit(z0b->id); |
| 916 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 905 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 917 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}); | 906 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}, 1); |
| 918 | LOOP(*z0B) { | 907 | LOOP(*z0B) { |
| 919 | LOOP(*z0bT) { | 908 | LOOP(*z0bT) { |
| 920 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 909 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -942,8 +931,8 @@ Status BuildConcatGroupAscendGraphND2(af::AscGraph &graph) { | |||
| 942 | auto nd = graph.CreateAxis("nd2", ND); | 931 | auto nd = graph.CreateAxis("nd2", ND); |
| 943 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 932 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 944 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 933 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 945 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 934 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 946 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 935 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 947 | LOOP(*ndB) { | 936 | LOOP(*ndB) { |
| 948 | LOOP(*ndbT) { | 937 | LOOP(*ndbT) { |
| 949 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 938 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -965,8 +954,8 @@ Status BuildConcatGroupAscendGraphND2WithAbs(af::AscGraph &graph) { | |||
| 965 | auto nd = graph.CreateAxis("nd2", ND); | 954 | auto nd = graph.CreateAxis("nd2", ND); |
| 966 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 955 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 967 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 956 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 968 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 957 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 969 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 958 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 970 | LOOP(*ndB) { | 959 | LOOP(*ndB) { |
| 971 | LOOP(*ndbT) { | 960 | LOOP(*ndbT) { |
| 972 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 961 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -989,8 +978,8 @@ Status BuildConcatGroupAscendGraphND2TB(af::AscGraph &graph) { | |||
| 989 | auto nd = graph.CreateAxis("nd2", ND); | 978 | auto nd = graph.CreateAxis("nd2", ND); |
| 990 | auto [ndT, ndt] = graph.TileSplit(nd.id); | 979 | auto [ndT, ndt] = graph.TileSplit(nd.id); |
| 991 | auto [ndTB, ndTb] = graph.BlockSplit(ndT->id); | 980 | auto [ndTB, ndTb] = graph.BlockSplit(ndT->id); |
| 992 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 981 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 993 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 982 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 994 | LOOP(*ndTB) { | 983 | LOOP(*ndTB) { |
| 995 | LOOP(*ndTb) { | 984 | LOOP(*ndTb) { |
| 996 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 985 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -1019,8 +1008,8 @@ Status BuildConcatGroupAscendGraphStatic(af::AscGraph &graph) { | |||
| 1019 | auto nd = graph.CreateAxis("nd", ND); | 1008 | auto nd = graph.CreateAxis("nd", ND); |
| 1020 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 1009 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 1021 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 1010 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 1022 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 1011 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 1023 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 1012 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 1024 | LOOP(*ndB) { | 1013 | LOOP(*ndB) { |
| 1025 | LOOP(*ndbT) { | 1014 | LOOP(*ndbT) { |
| 1026 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 1015 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -1048,8 +1037,8 @@ Status BuildTqueTbufAscendGraph_single_case(af::AscGraph &graph) { | |||
| 1048 | auto nd = graph.CreateAxis("nd", ND); | 1037 | auto nd = graph.CreateAxis("nd", ND); |
| 1049 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 1038 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 1050 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 1039 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 1051 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 1040 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 1052 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 1041 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 1053 | LOOP(*ndB) { | 1042 | LOOP(*ndB) { |
| 1054 | LOOP(*ndbT) { | 1043 | LOOP(*ndbT) { |
| 1055 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 1044 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -1079,10 +1068,10 @@ Status BuildTqueTbufAscendGraphMultiCaseG0(af::AscGraph &graph) { | |||
| 1079 | auto nd = graph.CreateAxis("nd", ND); | 1068 | auto nd = graph.CreateAxis("nd", ND); |
| 1080 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 1069 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 1081 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 1070 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 1082 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 1071 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 1083 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 1072 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 1084 | - auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {nd}); | 1073 | + auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {nd}, 2); |
| 1085 | - auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {nd}); | 1074 | + auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {nd}, 3); |
| 1086 | LOOP(*ndB) { | 1075 | LOOP(*ndB) { |
| 1087 | LOOP(*ndbT) { | 1076 | LOOP(*ndbT) { |
| 1088 | auto load_tque0 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 1077 | auto load_tque0 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -1122,10 +1111,10 @@ Status BuildTqueTbufAscendGraphMultiCaseG1(af::AscGraph &graph) { | |||
| 1122 | auto z0 = graph.CreateAxis("z0", S0); | 1111 | auto z0 = graph.CreateAxis("z0", S0); |
| 1123 | auto [z0B, z0b] = graph.BlockSplit(z0.id); | 1112 | auto [z0B, z0b] = graph.BlockSplit(z0.id); |
| 1124 | auto [z0bT, z0bt] = graph.TileSplit(z0b->id); | 1113 | auto [z0bT, z0bt] = graph.TileSplit(z0b->id); |
| 1125 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 1114 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 1126 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}); | 1115 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}, 1); |
| 1127 | - auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {z0}); | 1116 | + auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {z0}, 2); |
| 1128 | - auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {z0}); | 1117 | + auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {z0}, 3); |
| 1129 | LOOP(*z0B) { | 1118 | LOOP(*z0B) { |
| 1130 | LOOP(*z0bT) { | 1119 | LOOP(*z0bT) { |
| 1131 | auto load_tque0 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 1120 | auto load_tque0 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -1155,10 +1144,10 @@ Status BuildMultiCaseG0(af::AscGraph &graph) { | |||
| 1155 | auto nd = graph.CreateAxis("nd", ND); | 1144 | auto nd = graph.CreateAxis("nd", ND); |
| 1156 | auto [ndT, ndt] = graph.TileSplit(nd.id); | 1145 | auto [ndT, ndt] = graph.TileSplit(nd.id); |
| 1157 | auto [ndTB, ndTb] = graph.BlockSplit(ndT->id); | 1146 | auto [ndTB, ndTb] = graph.BlockSplit(ndT->id); |
| 1158 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 1147 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 1159 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 1148 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 1160 | - auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {nd}); | 1149 | + auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {nd}, 2); |
| 1161 | - auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {nd}); | 1150 | + auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {nd}, 3); |
| 1162 | LOOP(*ndTB) { | 1151 | LOOP(*ndTB) { |
| 1163 | LOOP(*ndTb) { | 1152 | LOOP(*ndTb) { |
| 1164 | auto load_tque0 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 1153 | auto load_tque0 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -1190,10 +1179,10 @@ Status BuildMultiCaseG1(af::AscGraph &graph) { | |||
| 1190 | auto z0 = graph.CreateAxis("z0", S0); | 1179 | auto z0 = graph.CreateAxis("z0", S0); |
| 1191 | auto [z0T, z0t] = graph.TileSplit(z0.id); | 1180 | auto [z0T, z0t] = graph.TileSplit(z0.id); |
| 1192 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); | 1181 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); |
| 1193 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 1182 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 1194 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}); | 1183 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}, 1); |
| 1195 | - auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {z0}); | 1184 | + auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {z0}, 2); |
| 1196 | - auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {z0}); | 1185 | + auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {z0}, 3); |
| 1197 | LOOP(*z0TB) { | 1186 | LOOP(*z0TB) { |
| 1198 | LOOP(*z0Tb) { | 1187 | LOOP(*z0Tb) { |
| 1199 | auto load_tque0 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 1188 | auto load_tque0 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -1224,13 +1213,13 @@ Status BuildSevenInputsMiddleAxisCacheLineConflict(ge::AscGraph &graph) { | |||
| 1224 | auto s1 = graph.CreateAxis("s1", S1); | 1213 | auto s1 = graph.CreateAxis("s1", S1); |
| 1225 | auto [s0B, s0b] = graph.BlockSplit(s0.id); | 1214 | auto [s0B, s0b] = graph.BlockSplit(s0.id); |
| 1226 | auto [s0bT, s0bt] = graph.TileSplit(s0b->id); | 1215 | auto [s0bT, s0bt] = graph.TileSplit(s0b->id); |
| 1227 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {s0, s1}); | 1216 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {s0, s1}, 0); |
| 1228 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {s0, s1}); | 1217 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {s0, s1}, 1); |
| 1229 | - auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {s0, s1}); | 1218 | + auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {s0, s1}, 2); |
| 1230 | - auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {s0, s1}); | 1219 | + auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {s0, s1}, 3); |
| 1231 | - auto data5 = graph.CreateContiguousData("input5", DT_FLOAT, {s0, s1}); | 1220 | + auto data5 = graph.CreateContiguousData("input5", DT_FLOAT, {s0, s1}, 4); |
| 1232 | - auto data6 = graph.CreateContiguousData("input6", DT_FLOAT, {s0, s1}); | 1221 | + auto data6 = graph.CreateContiguousData("input6", DT_FLOAT, {s0, s1}, 5); |
| 1233 | - auto data7 = graph.CreateContiguousData("input7", DT_FLOAT, {s0, s1}); | 1222 | + auto data7 = graph.CreateContiguousData("input7", DT_FLOAT, {s0, s1}, 6); |
| 1234 | LOOP(*s0B) { | 1223 | LOOP(*s0B) { |
| 1235 | LOOP(*s0bT) { | 1224 | LOOP(*s0bT) { |
| 1236 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 1225 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -24,9 +24,8 @@ using namespace ge::ascir_op; | |||
| 24 | 24 | ||
| 25 | namespace { | 25 | namespace { |
| 26 | template <typename NodeT> | 26 | template <typename NodeT> |
| 27 | -void InitNode(NodeT &node, int32_t &exec_order, std::initializer_list<int64_t> axis, ge::DataType dtype, | 27 | +void InitNode(NodeT &node, std::initializer_list<int64_t> axis, ge::DataType dtype, |
| 28 | std::initializer_list<ge::Expression> repeats, std::initializer_list<ge::Expression> strides) { | 28 | std::initializer_list<ge::Expression> repeats, std::initializer_list<ge::Expression> strides) { |
| 29 | - node.attr.sched.exec_order = exec_order++; | ||
| 30 | node.attr.sched.axis = axis; | 29 | node.attr.sched.axis = axis; |
| 31 | node.y.dtype = dtype; | 30 | node.y.dtype = dtype; |
| 32 | *node.y.axis = axis; | 31 | *node.y.axis = axis; |
| @@ -35,11 +34,10 @@ void InitNode(NodeT &node, int32_t &exec_order, std::initializer_list<int64_t> a | |||
| 35 | } | 34 | } |
| 36 | 35 | ||
| 37 | template <typename NodeT, typename InputT> | 36 | template <typename NodeT, typename InputT> |
| 38 | -void InitInputNode(NodeT &node, const InputT &input, int32_t &exec_order, std::initializer_list<int64_t> axis, | 37 | +void InitInputNode(NodeT &node, const InputT &input, std::initializer_list<int64_t> axis, ge::DataType dtype, |
| 39 | - ge::DataType dtype, std::initializer_list<ge::Expression> repeats, | 38 | + std::initializer_list<ge::Expression> repeats, std::initializer_list<ge::Expression> strides) { |
| 40 | - std::initializer_list<ge::Expression> strides) { | ||
| 41 | node.x = input; | 39 | node.x = input; |
| 42 | - InitNode(node, exec_order, axis, dtype, repeats, strides); | 40 | + InitNode(node, axis, dtype, repeats, strides); |
| 43 | } | 41 | } |
| 44 | 42 | ||
| 45 | void ApplySchedulerTransform(ge::AscGraph &graph, const char *name, int64_t z1T, int64_t z1t, int64_t z2T, int64_t z2t, | 43 | void ApplySchedulerTransform(ge::AscGraph &graph, const char *name, int64_t z1T, int64_t z1t, int64_t z2T, int64_t z2t, |
| @@ -113,32 +111,29 @@ void BrcBufBeforeAutoFuse1(ge::AscGraph &graph) { | |||
| 113 | auto z2 = graph.CreateAxis("z2", Z2); | 111 | auto z2 = graph.CreateAxis("z2", Z2); |
| 114 | 112 | ||
| 115 | auto normalAxis = {z0.id, z1.id, z2.id}; | 113 | auto normalAxis = {z0.id, z1.id, z2.id}; |
| 116 | - | ||
| 117 | - int32_t exec_order = 0; | ||
| 118 | Data input_data("input_data", graph); | 114 | Data input_data("input_data", graph); |
| 119 | - InitNode(input_data, exec_order, normalAxis, ge::DT_FLOAT16, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); | 115 | + InitNode(input_data, normalAxis, ge::DT_FLOAT16, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); |
| 120 | 116 | ||
| 121 | Load load("load"); | 117 | Load load("load"); |
| 122 | - InitInputNode(load, input_data.y, exec_order, normalAxis, ge::DT_FLOAT16, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); | 118 | + InitInputNode(load, input_data.y, normalAxis, ge::DT_FLOAT16, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); |
| 123 | 119 | ||
| 124 | Cast cast0("cast0"); | 120 | Cast cast0("cast0"); |
| 125 | - InitInputNode(cast0, load.y, exec_order, normalAxis, ge::DT_FLOAT, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); | 121 | + InitInputNode(cast0, load.y, normalAxis, ge::DT_FLOAT, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); |
| 126 | 122 | ||
| 127 | Broadcast broadcast("broadcast"); | 123 | Broadcast broadcast("broadcast"); |
| 128 | - InitInputNode(broadcast, cast0.y, exec_order, normalAxis, ge::DT_FLOAT, {Z0, Z1, Z2}, {Z1 * Z2, Z2, ONE}); | 124 | + InitInputNode(broadcast, cast0.y, normalAxis, ge::DT_FLOAT, {Z0, Z1, Z2}, {Z1 * Z2, Z2, ONE}); |
| 129 | 125 | ||
| 130 | Sum sum("sum"); | 126 | Sum sum("sum"); |
| 131 | - InitInputNode(sum, broadcast.y, exec_order, normalAxis, ge::DT_FLOAT, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); | 127 | + InitInputNode(sum, broadcast.y, normalAxis, ge::DT_FLOAT, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); |
| 132 | 128 | ||
| 133 | Cast cast1("cast1"); | 129 | Cast cast1("cast1"); |
| 134 | - InitInputNode(cast1, sum.y, exec_order, normalAxis, ge::DT_FLOAT16, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); | 130 | + InitInputNode(cast1, sum.y, normalAxis, ge::DT_FLOAT16, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); |
| 135 | 131 | ||
| 136 | Store store("store"); | 132 | Store store("store"); |
| 137 | - InitInputNode(store, cast1.y, exec_order, normalAxis, ge::DT_FLOAT16, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); | 133 | + InitInputNode(store, cast1.y, normalAxis, ge::DT_FLOAT16, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); |
| 138 | 134 | ||
| 139 | Output output_data("output_data"); | 135 | Output output_data("output_data"); |
| 140 | output_data.x = store.y; | 136 | output_data.x = store.y; |
| 141 | - output_data.attr.sched.exec_order = exec_order++; | ||
| 142 | } | 137 | } |
| 143 | 138 | ||
| 144 | void BrcBufAfterScheduler1(ge::AscGraph &graph) { | 139 | void BrcBufAfterScheduler1(ge::AscGraph &graph) { |
| @@ -197,32 +192,29 @@ void BrcBufBeforeAutoFuse2(ge::AscGraph &graph) { | |||
| 197 | auto z2 = graph.CreateAxis("z2", Z2); | 192 | auto z2 = graph.CreateAxis("z2", Z2); |
| 198 | 193 | ||
| 199 | auto normalAxis = {z0.id, z1.id, z2.id}; | 194 | auto normalAxis = {z0.id, z1.id, z2.id}; |
| 200 | - | ||
| 201 | - int32_t exec_order = 0; | ||
| 202 | Data input_data("input_data", graph); | 195 | Data input_data("input_data", graph); |
| 203 | - InitNode(input_data, exec_order, normalAxis, ge::DT_FLOAT16, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); | 196 | + InitNode(input_data, normalAxis, ge::DT_FLOAT16, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); |
| 204 | 197 | ||
| 205 | Load load("load"); | 198 | Load load("load"); |
| 206 | - InitInputNode(load, input_data.y, exec_order, normalAxis, ge::DT_FLOAT16, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); | 199 | + InitInputNode(load, input_data.y, normalAxis, ge::DT_FLOAT16, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); |
| 207 | 200 | ||
| 208 | Cast cast0("cast0"); | 201 | Cast cast0("cast0"); |
| 209 | - InitInputNode(cast0, load.y, exec_order, normalAxis, ge::DT_FLOAT, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); | 202 | + InitInputNode(cast0, load.y, normalAxis, ge::DT_FLOAT, {Z0, ONE, Z2}, {Z2, ZERO, ONE}); |
| 210 | 203 | ||
| 211 | Broadcast broadcast("broadcast"); | 204 | Broadcast broadcast("broadcast"); |
| 212 | - InitInputNode(broadcast, cast0.y, exec_order, normalAxis, ge::DT_FLOAT, {Z0, Z1, Z2}, {Z1 * Z2, Z2, ONE}); | 205 | + InitInputNode(broadcast, cast0.y, normalAxis, ge::DT_FLOAT, {Z0, Z1, Z2}, {Z1 * Z2, Z2, ONE}); |
| 213 | 206 | ||
| 214 | Sum sum("sum"); | 207 | Sum sum("sum"); |
| 215 | - InitInputNode(sum, broadcast.y, exec_order, normalAxis, ge::DT_FLOAT, {Z0, Z1, ONE}, {Z1, ONE, ZERO}); | 208 | + InitInputNode(sum, broadcast.y, normalAxis, ge::DT_FLOAT, {Z0, Z1, ONE}, {Z1, ONE, ZERO}); |
| 216 | 209 | ||
| 217 | Cast cast1("cast1"); | 210 | Cast cast1("cast1"); |
| 218 | - InitInputNode(cast1, sum.y, exec_order, normalAxis, ge::DT_FLOAT16, {Z0, Z1, ONE}, {Z1, ONE, ZERO}); | 211 | + InitInputNode(cast1, sum.y, normalAxis, ge::DT_FLOAT16, {Z0, Z1, ONE}, {Z1, ONE, ZERO}); |
| 219 | 212 | ||
| 220 | Store store("store"); | 213 | Store store("store"); |
| 221 | - InitInputNode(store, cast1.y, exec_order, normalAxis, ge::DT_FLOAT16, {Z0, Z1, ONE}, {Z1, ONE, ZERO}); | 214 | + InitInputNode(store, cast1.y, normalAxis, ge::DT_FLOAT16, {Z0, Z1, ONE}, {Z1, ONE, ZERO}); |
| 222 | 215 | ||
| 223 | Output output_data("output_data"); | 216 | Output output_data("output_data"); |
| 224 | output_data.x = store.y; | 217 | output_data.x = store.y; |
| 225 | - output_data.attr.sched.exec_order = exec_order++; | ||
| 226 | } | 218 | } |
| 227 | 219 | ||
| 228 | void BrcBufAfterScheduler2(ge::AscGraph &graph) { | 220 | void BrcBufAfterScheduler2(ge::AscGraph &graph) { |
| @@ -51,10 +51,7 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 51 | 51 | ||
| 52 | std::initializer_list<Expr> reduceResRepeat = {ONE, ONE, ONE, S1, ONE, ONE, BL}; | 52 | std::initializer_list<Expr> reduceResRepeat = {ONE, ONE, ONE, S1, ONE, ONE, BL}; |
| 53 | std::initializer_list<Expr> reduceResStride = {ZERO, ZERO, ZERO, BL, ZERO, ZERO, ONE}; | 53 | std::initializer_list<Expr> reduceResStride = {ZERO, ZERO, ZERO, BL, ZERO, ZERO, ONE}; |
| 54 | - | ||
| 55 | - int32_t exec_order = 0; | ||
| 56 | Data query("query", graph); | 54 | Data query("query", graph); |
| 57 | - query.attr.sched.exec_order = exec_order++; | ||
| 58 | query.attr.sched.axis = bmm1ResAxis; | 55 | query.attr.sched.axis = bmm1ResAxis; |
| 59 | query.y.dtype = ge::DT_FLOAT16; | 56 | query.y.dtype = ge::DT_FLOAT16; |
| 60 | *query.y.axis = bmm1ResAxis; | 57 | *query.y.axis = bmm1ResAxis; |
| @@ -64,7 +61,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 64 | query.axis_continuous_map = {{0, 1}, {2}, {3}, {4}, {INT64_MAX}, {5}, {INT64_MAX}}; | 61 | query.axis_continuous_map = {{0, 1}, {2}, {3}, {4}, {INT64_MAX}, {5}, {INT64_MAX}}; |
| 65 | 62 | ||
| 66 | Data key("key", graph); | 63 | Data key("key", graph); |
| 67 | - key.attr.sched.exec_order = exec_order++; | ||
| 68 | key.attr.sched.axis = bmm1ResAxis; | 64 | key.attr.sched.axis = bmm1ResAxis; |
| 69 | key.y.dtype = ge::DT_FLOAT16; | 65 | key.y.dtype = ge::DT_FLOAT16; |
| 70 | *key.y.axis = bmm1ResAxis; | 66 | *key.y.axis = bmm1ResAxis; |
| @@ -76,7 +72,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 76 | MatMul bmm1("bmm1"); | 72 | MatMul bmm1("bmm1"); |
| 77 | bmm1.x1 = query.y; | 73 | bmm1.x1 = query.y; |
| 78 | bmm1.x2 = key.y; | 74 | bmm1.x2 = key.y; |
| 79 | - bmm1.attr.sched.exec_order = exec_order++; | ||
| 80 | bmm1.attr.sched.axis = bmm1ResAxis; | 75 | bmm1.attr.sched.axis = bmm1ResAxis; |
| 81 | bmm1.y.dtype = ge::DT_FLOAT; | 76 | bmm1.y.dtype = ge::DT_FLOAT; |
| 82 | *bmm1.y.axis = bmm1ResAxis; | 77 | *bmm1.y.axis = bmm1ResAxis; |
| @@ -85,7 +80,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 85 | 80 | ||
| 86 | Load load1("load1"); | 81 | Load load1("load1"); |
| 87 | load1.x = bmm1.y; | 82 | load1.x = bmm1.y; |
| 88 | - load1.attr.sched.exec_order = exec_order++; | ||
| 89 | load1.attr.sched.axis = bmm1ResAxis; | 83 | load1.attr.sched.axis = bmm1ResAxis; |
| 90 | load1.y.dtype = ge::DT_FLOAT; | 84 | load1.y.dtype = ge::DT_FLOAT; |
| 91 | *load1.y.axis = bmm1ResAxis; | 85 | *load1.y.axis = bmm1ResAxis; |
| @@ -93,7 +87,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 93 | *load1.y.strides = vec1ResStride; | 87 | *load1.y.strides = vec1ResStride; |
| 94 | 88 | ||
| 95 | Data pse("pse", graph); | 89 | Data pse("pse", graph); |
| 96 | - pse.attr.sched.exec_order = exec_order++; | ||
| 97 | pse.y.dtype = ge::DT_FLOAT16; | 90 | pse.y.dtype = ge::DT_FLOAT16; |
| 98 | *pse.y.axis = bmm1ResAxis; | 91 | *pse.y.axis = bmm1ResAxis; |
| 99 | *pse.y.repeats = vec1ResRepeat; | 92 | *pse.y.repeats = vec1ResRepeat; |
| @@ -101,7 +94,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 101 | 94 | ||
| 102 | Load loadPse("loadPse"); | 95 | Load loadPse("loadPse"); |
| 103 | loadPse.x = pse.y; | 96 | loadPse.x = pse.y; |
| 104 | - loadPse.attr.sched.exec_order = exec_order++; | ||
| 105 | loadPse.attr.sched.axis = bmm1ResAxis; | 97 | loadPse.attr.sched.axis = bmm1ResAxis; |
| 106 | loadPse.y.dtype = ge::DT_FLOAT16; | 98 | loadPse.y.dtype = ge::DT_FLOAT16; |
| 107 | *loadPse.y.axis = bmm1ResAxis; | 99 | *loadPse.y.axis = bmm1ResAxis; |
| @@ -110,7 +102,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 110 | 102 | ||
| 111 | Cast castPse("castPse"); | 103 | Cast castPse("castPse"); |
| 112 | castPse.x = loadPse.y; | 104 | castPse.x = loadPse.y; |
| 113 | - castPse.attr.sched.exec_order = exec_order++; | ||
| 114 | castPse.attr.sched.axis = bmm1ResAxis; | 105 | castPse.attr.sched.axis = bmm1ResAxis; |
| 115 | castPse.y.dtype = ge::DT_FLOAT; | 106 | castPse.y.dtype = ge::DT_FLOAT; |
| 116 | *castPse.y.axis = bmm1ResAxis; | 107 | *castPse.y.axis = bmm1ResAxis; |
| @@ -120,7 +111,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 120 | ge::ascir_op::Add add1("add1"); | 111 | ge::ascir_op::Add add1("add1"); |
| 121 | add1.x1 = load1.y; | 112 | add1.x1 = load1.y; |
| 122 | add1.x2 = castPse.y; | 113 | add1.x2 = castPse.y; |
| 123 | - add1.attr.sched.exec_order = exec_order++; | ||
| 124 | add1.attr.sched.axis = bmm1ResAxis; | 114 | add1.attr.sched.axis = bmm1ResAxis; |
| 125 | add1.y.dtype = ge::DT_FLOAT; | 115 | add1.y.dtype = ge::DT_FLOAT; |
| 126 | *add1.y.axis = bmm1ResAxis; | 116 | *add1.y.axis = bmm1ResAxis; |
| @@ -128,13 +118,11 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 128 | *add1.y.strides = vec1ResStride; | 118 | *add1.y.strides = vec1ResStride; |
| 129 | 119 | ||
| 130 | Data scaleValue("scaleValue", graph); | 120 | Data scaleValue("scaleValue", graph); |
| 131 | - scaleValue.attr.sched.exec_order = exec_order++; | ||
| 132 | scaleValue.y.dtype = ge::DT_FLOAT; | 121 | scaleValue.y.dtype = ge::DT_FLOAT; |
| 133 | 122 | ||
| 134 | ge::ascir_op::Muls mul1("mul1"); | 123 | ge::ascir_op::Muls mul1("mul1"); |
| 135 | mul1.x1 = add1.y; | 124 | mul1.x1 = add1.y; |
| 136 | mul1.x2 = scaleValue.y; | 125 | mul1.x2 = scaleValue.y; |
| 137 | - mul1.attr.sched.exec_order = exec_order++; | ||
| 138 | mul1.attr.sched.axis = bmm1ResAxis; | 126 | mul1.attr.sched.axis = bmm1ResAxis; |
| 139 | mul1.y.dtype = ge::DT_FLOAT; | 127 | mul1.y.dtype = ge::DT_FLOAT; |
| 140 | *mul1.y.axis = bmm1ResAxis; | 128 | *mul1.y.axis = bmm1ResAxis; |
| @@ -142,7 +130,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 142 | *mul1.y.strides = vec1ResStride; | 130 | *mul1.y.strides = vec1ResStride; |
| 143 | 131 | ||
| 144 | Data attenMask("attenMask", graph); | 132 | Data attenMask("attenMask", graph); |
| 145 | - attenMask.attr.sched.exec_order = exec_order++; | ||
| 146 | attenMask.y.dtype = ge::DT_UINT8; | 133 | attenMask.y.dtype = ge::DT_UINT8; |
| 147 | *attenMask.y.axis = bmm1ResAxis; | 134 | *attenMask.y.axis = bmm1ResAxis; |
| 148 | *attenMask.y.repeats = {B, ONE, ONE, S1, S2, ONE, ONE}; | 135 | *attenMask.y.repeats = {B, ONE, ONE, S1, S2, ONE, ONE}; |
| @@ -150,7 +137,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 150 | 137 | ||
| 151 | Load loadAttenMask("loadAttenMask"); | 138 | Load loadAttenMask("loadAttenMask"); |
| 152 | loadAttenMask.x = attenMask.y; | 139 | loadAttenMask.x = attenMask.y; |
| 153 | - loadAttenMask.attr.sched.exec_order = exec_order++; | ||
| 154 | loadAttenMask.attr.sched.axis = bmm1ResAxis; | 140 | loadAttenMask.attr.sched.axis = bmm1ResAxis; |
| 155 | loadAttenMask.y.dtype = ge::DT_UINT8; | 141 | loadAttenMask.y.dtype = ge::DT_UINT8; |
| 156 | *loadAttenMask.y.axis = bmm1ResAxis; | 142 | *loadAttenMask.y.axis = bmm1ResAxis; |
| @@ -160,7 +146,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 160 | Select select("select"); | 146 | Select select("select"); |
| 161 | select.x1 = mul1.y; | 147 | select.x1 = mul1.y; |
| 162 | select.x2 = loadAttenMask.y; | 148 | select.x2 = loadAttenMask.y; |
| 163 | - select.attr.sched.exec_order = exec_order++; | ||
| 164 | select.attr.sched.axis = bmm1ResAxis; | 149 | select.attr.sched.axis = bmm1ResAxis; |
| 165 | select.y.dtype = ge::DT_FLOAT; | 150 | select.y.dtype = ge::DT_FLOAT; |
| 166 | *select.y.axis = bmm1ResAxis; | 151 | *select.y.axis = bmm1ResAxis; |
| @@ -168,7 +153,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 168 | *select.y.strides = vec1ResStride; | 153 | *select.y.strides = vec1ResStride; |
| 169 | 154 | ||
| 170 | TbufData softmaxExp("softmaxExp", graph); | 155 | TbufData softmaxExp("softmaxExp", graph); |
| 171 | - softmaxExp.attr.sched.exec_order = exec_order++; | ||
| 172 | softmaxExp.attr.sched.axis = bmm1ResAxis; | 156 | softmaxExp.attr.sched.axis = bmm1ResAxis; |
| 173 | softmaxExp.y.dtype = ge::DT_FLOAT; | 157 | softmaxExp.y.dtype = ge::DT_FLOAT; |
| 174 | *softmaxExp.y.axis = bmm1ResAxis; | 158 | *softmaxExp.y.axis = bmm1ResAxis; |
| @@ -176,7 +160,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 176 | *softmaxExp.y.strides = reduceResStride; | 160 | *softmaxExp.y.strides = reduceResStride; |
| 177 | 161 | ||
| 178 | TbufData softmaxApiTmpBuf("softmaxApiTmpBuf", graph); | 162 | TbufData softmaxApiTmpBuf("softmaxApiTmpBuf", graph); |
| 179 | - softmaxApiTmpBuf.attr.sched.exec_order = exec_order++; | ||
| 180 | softmaxApiTmpBuf.attr.sched.axis = bmm1ResAxis; | 163 | softmaxApiTmpBuf.attr.sched.axis = bmm1ResAxis; |
| 181 | softmaxApiTmpBuf.y.dtype = ge::DT_FLOAT; | 164 | softmaxApiTmpBuf.y.dtype = ge::DT_FLOAT; |
| 182 | *softmaxApiTmpBuf.y.axis = bmm1ResAxis; | 165 | *softmaxApiTmpBuf.y.axis = bmm1ResAxis; |
| @@ -187,7 +170,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 187 | flashSoftmax.x1 = select.y; | 170 | flashSoftmax.x1 = select.y; |
| 188 | flashSoftmax.x2 = softmaxExp.y; | 171 | flashSoftmax.x2 = softmaxExp.y; |
| 189 | flashSoftmax.x3 = softmaxApiTmpBuf.y; | 172 | flashSoftmax.x3 = softmaxApiTmpBuf.y; |
| 190 | - flashSoftmax.attr.sched.exec_order = exec_order++; | ||
| 191 | flashSoftmax.attr.sched.axis = bmm1ResAxis; | 173 | flashSoftmax.attr.sched.axis = bmm1ResAxis; |
| 192 | flashSoftmax.y1.dtype = ge::DT_FLOAT; | 174 | flashSoftmax.y1.dtype = ge::DT_FLOAT; |
| 193 | *flashSoftmax.y1.axis = bmm1ResAxis; | 175 | *flashSoftmax.y1.axis = bmm1ResAxis; |
| @@ -206,7 +188,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 206 | 188 | ||
| 207 | Store storeSoftmaxMax("storeSoftmaxMax"); | 189 | Store storeSoftmaxMax("storeSoftmaxMax"); |
| 208 | storeSoftmaxMax.x = flashSoftmax.y3; | 190 | storeSoftmaxMax.x = flashSoftmax.y3; |
| 209 | - storeSoftmaxMax.attr.sched.exec_order = exec_order++; | ||
| 210 | storeSoftmaxMax.attr.sched.axis = bmm1ResAxis; | 191 | storeSoftmaxMax.attr.sched.axis = bmm1ResAxis; |
| 211 | storeSoftmaxMax.y.dtype = ge::DT_FLOAT; | 192 | storeSoftmaxMax.y.dtype = ge::DT_FLOAT; |
| 212 | *storeSoftmaxMax.y.axis = bmm1ResAxis; | 193 | *storeSoftmaxMax.y.axis = bmm1ResAxis; |
| @@ -215,10 +196,8 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 215 | 196 | ||
| 216 | Output softmaxMax("softmaxMax"); | 197 | Output softmaxMax("softmaxMax"); |
| 217 | softmaxMax.x = storeSoftmaxMax.y; | 198 | softmaxMax.x = storeSoftmaxMax.y; |
| 218 | - softmaxMax.attr.sched.exec_order = exec_order++; | ||
| 219 | 199 | ||
| 220 | Data dropMask("dropMask", graph); | 200 | Data dropMask("dropMask", graph); |
| 221 | - dropMask.attr.sched.exec_order = exec_order++; | ||
| 222 | dropMask.y.dtype = ge::DT_UINT8; | 201 | dropMask.y.dtype = ge::DT_UINT8; |
| 223 | *dropMask.y.axis = bmm1ResAxis; | 202 | *dropMask.y.axis = bmm1ResAxis; |
| 224 | *dropMask.y.repeats = vec1ResRepeat; | 203 | *dropMask.y.repeats = vec1ResRepeat; |
| @@ -226,7 +205,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 226 | 205 | ||
| 227 | Load loadDropMask("loadDropMask"); | 206 | Load loadDropMask("loadDropMask"); |
| 228 | loadDropMask.x = dropMask.y; | 207 | loadDropMask.x = dropMask.y; |
| 229 | - loadDropMask.attr.sched.exec_order = exec_order++; | ||
| 230 | loadDropMask.attr.sched.axis = bmm1ResAxis; | 208 | loadDropMask.attr.sched.axis = bmm1ResAxis; |
| 231 | loadDropMask.y.dtype = ge::DT_UINT8; | 209 | loadDropMask.y.dtype = ge::DT_UINT8; |
| 232 | *loadDropMask.y.axis = bmm1ResAxis; | 210 | *loadDropMask.y.axis = bmm1ResAxis; |
| @@ -236,7 +214,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 236 | Dropout dropout("dropout"); | 214 | Dropout dropout("dropout"); |
| 237 | dropout.x1 = flashSoftmax.y1; | 215 | dropout.x1 = flashSoftmax.y1; |
| 238 | dropout.x2 = loadDropMask.y; | 216 | dropout.x2 = loadDropMask.y; |
| 239 | - dropout.attr.sched.exec_order = exec_order++; | ||
| 240 | dropout.attr.sched.axis = bmm1ResAxis; | 217 | dropout.attr.sched.axis = bmm1ResAxis; |
| 241 | dropout.y.dtype = ge::DT_FLOAT; | 218 | dropout.y.dtype = ge::DT_FLOAT; |
| 242 | *dropout.y.axis = bmm1ResAxis; | 219 | *dropout.y.axis = bmm1ResAxis; |
| @@ -245,7 +222,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 245 | 222 | ||
| 246 | Cast castVec1Res("castVec1Res"); | 223 | Cast castVec1Res("castVec1Res"); |
| 247 | castVec1Res.x = dropout.y; | 224 | castVec1Res.x = dropout.y; |
| 248 | - castVec1Res.attr.sched.exec_order = exec_order++; | ||
| 249 | castVec1Res.attr.sched.axis = bmm1ResAxis; | 225 | castVec1Res.attr.sched.axis = bmm1ResAxis; |
| 250 | castVec1Res.y.dtype = ge::DT_FLOAT16; | 226 | castVec1Res.y.dtype = ge::DT_FLOAT16; |
| 251 | *castVec1Res.y.axis = bmm1ResAxis; | 227 | *castVec1Res.y.axis = bmm1ResAxis; |
| @@ -254,7 +230,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 254 | 230 | ||
| 255 | Store storeVec1Res("storeVec1Res"); | 231 | Store storeVec1Res("storeVec1Res"); |
| 256 | storeVec1Res.x = castVec1Res.y; | 232 | storeVec1Res.x = castVec1Res.y; |
| 257 | - storeVec1Res.attr.sched.exec_order = exec_order++; | ||
| 258 | storeVec1Res.attr.sched.axis = bmm1ResAxis; | 233 | storeVec1Res.attr.sched.axis = bmm1ResAxis; |
| 259 | storeVec1Res.y.dtype = ge::DT_FLOAT16; | 234 | storeVec1Res.y.dtype = ge::DT_FLOAT16; |
| 260 | *storeVec1Res.y.axis = bmm1ResAxis; | 235 | *storeVec1Res.y.axis = bmm1ResAxis; |
| @@ -262,7 +237,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 262 | *storeVec1Res.y.strides = vec1ResStride; | 237 | *storeVec1Res.y.strides = vec1ResStride; |
| 263 | 238 | ||
| 264 | Data value("value", graph); | 239 | Data value("value", graph); |
| 265 | - value.attr.sched.exec_order = exec_order++; | ||
| 266 | value.attr.sched.axis = bmm2ResAxis; | 240 | value.attr.sched.axis = bmm2ResAxis; |
| 267 | value.y.dtype = ge::DT_FLOAT16; | 241 | value.y.dtype = ge::DT_FLOAT16; |
| 268 | *value.y.axis = bmm2ResAxis; | 242 | *value.y.axis = bmm2ResAxis; |
| @@ -272,7 +246,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 272 | MatMul bmm2("bmm2"); | 246 | MatMul bmm2("bmm2"); |
| 273 | bmm2.x1 = storeVec1Res.y; | 247 | bmm2.x1 = storeVec1Res.y; |
| 274 | bmm2.x2 = value.y; | 248 | bmm2.x2 = value.y; |
| 275 | - bmm2.attr.sched.exec_order = exec_order++; | ||
| 276 | bmm2.attr.sched.axis = bmm2ResAxis; | 249 | bmm2.attr.sched.axis = bmm2ResAxis; |
| 277 | bmm2.y.dtype = ge::DT_FLOAT; | 250 | bmm2.y.dtype = ge::DT_FLOAT; |
| 278 | *bmm2.y.axis = bmm2ResAxis; | 251 | *bmm2.y.axis = bmm2ResAxis; |
| @@ -281,7 +254,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 281 | 254 | ||
| 282 | Load load2("load2"); | 255 | Load load2("load2"); |
| 283 | load2.x = bmm2.y; | 256 | load2.x = bmm2.y; |
| 284 | - load2.attr.sched.exec_order = exec_order++; | ||
| 285 | load2.attr.sched.axis = bmm2ResAxis; | 257 | load2.attr.sched.axis = bmm2ResAxis; |
| 286 | load2.y.dtype = ge::DT_FLOAT; | 258 | load2.y.dtype = ge::DT_FLOAT; |
| 287 | *load2.y.axis = bmm2ResAxis; | 259 | *load2.y.axis = bmm2ResAxis; |
| @@ -289,7 +261,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 289 | *load2.y.strides = vec2ResStride; | 261 | *load2.y.strides = vec2ResStride; |
| 290 | 262 | ||
| 291 | Workspace addResOut("addResOut", graph); | 263 | Workspace addResOut("addResOut", graph); |
| 292 | - addResOut.attr.sched.exec_order = exec_order++; | ||
| 293 | addResOut.attr.sched.axis = bmm2ResAxis; | 264 | addResOut.attr.sched.axis = bmm2ResAxis; |
| 294 | addResOut.y.dtype = ge::DT_FLOAT; | 265 | addResOut.y.dtype = ge::DT_FLOAT; |
| 295 | *addResOut.y.axis = bmm2ResAxis; | 266 | *addResOut.y.axis = bmm2ResAxis; |
| @@ -298,7 +269,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 298 | 269 | ||
| 299 | Load loadAddResOut("loadAddResOut"); | 270 | Load loadAddResOut("loadAddResOut"); |
| 300 | loadAddResOut.x = addResOut.y; | 271 | loadAddResOut.x = addResOut.y; |
| 301 | - loadAddResOut.attr.sched.exec_order = exec_order++; | ||
| 302 | loadAddResOut.attr.sched.axis = bmm2ResAxis; | 272 | loadAddResOut.attr.sched.axis = bmm2ResAxis; |
| 303 | loadAddResOut.y.dtype = ge::DT_FLOAT; | 273 | loadAddResOut.y.dtype = ge::DT_FLOAT; |
| 304 | *loadAddResOut.y.axis = bmm2ResAxis; | 274 | *loadAddResOut.y.axis = bmm2ResAxis; |
| @@ -308,7 +278,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 308 | ge::ascir_op::Mul mulRes("mulRes"); | 278 | ge::ascir_op::Mul mulRes("mulRes"); |
| 309 | mulRes.x1 = loadAddResOut.y; | 279 | mulRes.x1 = loadAddResOut.y; |
| 310 | mulRes.x2 = softmaxExp.y; | 280 | mulRes.x2 = softmaxExp.y; |
| 311 | - mulRes.attr.sched.exec_order = exec_order++; | ||
| 312 | mulRes.attr.sched.axis = bmm2ResAxis; | 281 | mulRes.attr.sched.axis = bmm2ResAxis; |
| 313 | mulRes.y.dtype = ge::DT_FLOAT; | 282 | mulRes.y.dtype = ge::DT_FLOAT; |
| 314 | *mulRes.y.axis = bmm2ResAxis; | 283 | *mulRes.y.axis = bmm2ResAxis; |
| @@ -318,7 +287,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 318 | ge::ascir_op::Add addRes("addRes"); | 287 | ge::ascir_op::Add addRes("addRes"); |
| 319 | addRes.x1 = load2.y; | 288 | addRes.x1 = load2.y; |
| 320 | addRes.x2 = mulRes.y; | 289 | addRes.x2 = mulRes.y; |
| 321 | - addRes.attr.sched.exec_order = exec_order++; | ||
| 322 | addRes.attr.sched.axis = bmm2ResAxis; | 290 | addRes.attr.sched.axis = bmm2ResAxis; |
| 323 | addRes.y.dtype = ge::DT_FLOAT; | 291 | addRes.y.dtype = ge::DT_FLOAT; |
| 324 | *addRes.y.axis = bmm2ResAxis; | 292 | *addRes.y.axis = bmm2ResAxis; |
| @@ -328,7 +296,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 328 | ge::ascir_op::Div div("div"); | 296 | ge::ascir_op::Div div("div"); |
| 329 | div.x1 = addRes.y; | 297 | div.x1 = addRes.y; |
| 330 | div.x2 = flashSoftmax.y3; | 298 | div.x2 = flashSoftmax.y3; |
| 331 | - div.attr.sched.exec_order = exec_order++; | ||
| 332 | div.attr.sched.axis = bmm2ResAxis; | 299 | div.attr.sched.axis = bmm2ResAxis; |
| 333 | div.y.dtype = ge::DT_FLOAT; | 300 | div.y.dtype = ge::DT_FLOAT; |
| 334 | *div.y.axis = bmm2ResAxis; | 301 | *div.y.axis = bmm2ResAxis; |
| @@ -337,7 +304,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 337 | 304 | ||
| 338 | Cast castBmm2Res("castBmm2Res"); | 305 | Cast castBmm2Res("castBmm2Res"); |
| 339 | castBmm2Res.x = div.y; | 306 | castBmm2Res.x = div.y; |
| 340 | - castBmm2Res.attr.sched.exec_order = exec_order++; | ||
| 341 | castBmm2Res.attr.sched.axis = bmm2ResAxis; | 307 | castBmm2Res.attr.sched.axis = bmm2ResAxis; |
| 342 | castBmm2Res.y.dtype = ge::DT_FLOAT16; | 308 | castBmm2Res.y.dtype = ge::DT_FLOAT16; |
| 343 | *castBmm2Res.y.axis = bmm2ResAxis; | 309 | *castBmm2Res.y.axis = bmm2ResAxis; |
| @@ -346,7 +312,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 346 | 312 | ||
| 347 | Store store("store"); | 313 | Store store("store"); |
| 348 | store.x = castBmm2Res.y; | 314 | store.x = castBmm2Res.y; |
| 349 | - store.attr.sched.exec_order = exec_order++; | ||
| 350 | store.attr.sched.axis = bmm2ResAxis; | 315 | store.attr.sched.axis = bmm2ResAxis; |
| 351 | store.y.dtype = ge::DT_FLOAT16; | 316 | store.y.dtype = ge::DT_FLOAT16; |
| 352 | *store.y.axis = bmm2ResAxis; | 317 | *store.y.axis = bmm2ResAxis; |
| @@ -355,7 +320,6 @@ void FaBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 355 | 320 | ||
| 356 | Output buf("buf"); | 321 | Output buf("buf"); |
| 357 | buf.x = store.y; | 322 | buf.x = store.y; |
| 358 | - buf.attr.sched.exec_order = exec_order++; | ||
| 359 | buf.y.dtype = ge::DT_FLOAT16; | 323 | buf.y.dtype = ge::DT_FLOAT16; |
| 360 | *buf.y.axis = bmm2ResAxis; | 324 | *buf.y.axis = bmm2ResAxis; |
| 361 | *buf.y.repeats = vec2ResRepeat; | 325 | *buf.y.repeats = vec2ResRepeat; |
| @@ -136,8 +136,8 @@ Status BuildTransposeAscendGraph(ge::AscGraph &graph, const std::vector<int64_t> | |||
| 136 | auto [z0T, z0t] = graph.TileSplit(z0.id); | 136 | auto [z0T, z0t] = graph.TileSplit(z0.id); |
| 137 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); | 137 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); |
| 138 | 138 | ||
| 139 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z1, z2}, FORMAT_ND); | 139 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z1, z2}, 0, FORMAT_ND); |
| 140 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0, z1, z2}, FORMAT_ND); | 140 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0, z1, z2}, 1, FORMAT_ND); |
| 141 | 141 | ||
| 142 | // 根据原始维度设置repeats和strides | 142 | // 根据原始维度设置repeats和strides |
| 143 | *data1.repeats = {s0, s1, s2}; | 143 | *data1.repeats = {s0, s1, s2}; |
| @@ -209,8 +209,8 @@ Status BuildTransposeSplitAscendGraph(ge::AscGraph &graph) { | |||
| 209 | auto [z0T, z0t] = graph.TileSplit(z0.id); | 209 | auto [z0T, z0t] = graph.TileSplit(z0.id); |
| 210 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); | 210 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); |
| 211 | 211 | ||
| 212 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z1, z2}, FORMAT_ND); | 212 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z1, z2}, 0, FORMAT_ND); |
| 213 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0, z1, z2}, FORMAT_ND); | 213 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0, z1, z2}, 1, FORMAT_ND); |
| 214 | 214 | ||
| 215 | // 根据原始维度设置repeats和strides | 215 | // 根据原始维度设置repeats和strides |
| 216 | *data1.repeats = {s0, s1, s2}; | 216 | *data1.repeats = {s0, s1, s2}; |
| @@ -284,7 +284,7 @@ Status Build4DTransposeAscendGraph(ge::AscGraph &graph, const std::vector<int64_ | |||
| 284 | auto [z0T, z0t] = graph.TileSplit(z0.id); | 284 | auto [z0T, z0t] = graph.TileSplit(z0.id); |
| 285 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); | 285 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); |
| 286 | 286 | ||
| 287 | - auto data = graph.CreateContiguousData("input", DT_FLOAT, {z0, z1, z2, z3}, FORMAT_ND); | 287 | + auto data = graph.CreateContiguousData("input", DT_FLOAT, {z0, z1, z2, z3}, 0, FORMAT_ND); |
| 288 | 288 | ||
| 289 | // 根据原始维度设置repeats和strides | 289 | // 根据原始维度设置repeats和strides |
| 290 | *data.repeats = {s0, s1, s2, s3}; | 290 | *data.repeats = {s0, s1, s2, s3}; |
| @@ -332,8 +332,8 @@ Status BuildFlashSoftmaxAscendGraph(ge::AscGraph &graph) { | |||
| 332 | auto nd = graph.CreateAxis("nd", ND); | 332 | auto nd = graph.CreateAxis("nd", ND); |
| 333 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 333 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 334 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 334 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 335 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 335 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 336 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 336 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 337 | LOOP(*ndB) { | 337 | LOOP(*ndB) { |
| 338 | LOOP(*ndbT) { | 338 | LOOP(*ndbT) { |
| 339 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 339 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -362,8 +362,8 @@ Status BuildWorkSpaceAscendGraph(ge::AscGraph &graph) { | |||
| 362 | auto nd = graph.CreateAxis("nd", ND); | 362 | auto nd = graph.CreateAxis("nd", ND); |
| 363 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 363 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 364 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 364 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 365 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 365 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 366 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 366 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 367 | LOOP(*ndB) { | 367 | LOOP(*ndB) { |
| 368 | LOOP(*ndbT) { | 368 | LOOP(*ndbT) { |
| 369 | auto load1 = Workspace("workspace1", data1).TQue(Position::kPositionVecIn, 1, 1); | 369 | auto load1 = Workspace("workspace1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -395,7 +395,7 @@ Status BuildTilingReduceAscendGraph(ge::AscGraph &graph) { | |||
| 395 | auto [rT, rt] = graph.TileSplit(r.id); | 395 | auto [rT, rt] = graph.TileSplit(r.id); |
| 396 | auto [rTB, rTb] = graph.BlockSplit(rT->id); | 396 | auto [rTB, rTb] = graph.BlockSplit(rT->id); |
| 397 | auto [aT, at] = graph.TileSplit(a.id); | 397 | auto [aT, at] = graph.TileSplit(a.id); |
| 398 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {r, a}); | 398 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {r, a}, 0); |
| 399 | LOOP(*rT) { | 399 | LOOP(*rT) { |
| 400 | LOOP(*rTB) { | 400 | LOOP(*rTB) { |
| 401 | LOOP(*rTb) { | 401 | LOOP(*rTb) { |
| @@ -428,8 +428,8 @@ Status BuildMatMulDemoAscendGraph(ge::AscGraph &graph) { | |||
| 428 | auto nd = graph.CreateAxis("nd", ND); | 428 | auto nd = graph.CreateAxis("nd", ND); |
| 429 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 429 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 430 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 430 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 431 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 431 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 432 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 432 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 433 | LOOP(*ndB) { | 433 | LOOP(*ndB) { |
| 434 | LOOP(*ndbT) { | 434 | LOOP(*ndbT) { |
| 435 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 435 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -25,9 +25,8 @@ using namespace ge::ascir_op; | |||
| 25 | 25 | ||
| 26 | namespace { | 26 | namespace { |
| 27 | template <typename NodeT> | 27 | template <typename NodeT> |
| 28 | -void InitNode(NodeT &node, int32_t &exec_order, std::initializer_list<int64_t> axis, ge::DataType dtype, | 28 | +void InitNode(NodeT &node, std::initializer_list<int64_t> axis, ge::DataType dtype, |
| 29 | std::initializer_list<ge::Expression> repeats, std::initializer_list<ge::Expression> strides) { | 29 | std::initializer_list<ge::Expression> repeats, std::initializer_list<ge::Expression> strides) { |
| 30 | - node.attr.sched.exec_order = exec_order++; | ||
| 31 | node.attr.sched.axis = axis; | 30 | node.attr.sched.axis = axis; |
| 32 | node.y.dtype = dtype; | 31 | node.y.dtype = dtype; |
| 33 | *node.y.axis = axis; | 32 | *node.y.axis = axis; |
| @@ -36,11 +35,10 @@ void InitNode(NodeT &node, int32_t &exec_order, std::initializer_list<int64_t> a | |||
| 36 | } | 35 | } |
| 37 | 36 | ||
| 38 | template <typename NodeT, typename InputT> | 37 | template <typename NodeT, typename InputT> |
| 39 | -void InitInputNode(NodeT &node, const InputT &input, int32_t &exec_order, std::initializer_list<int64_t> axis, | 38 | +void InitInputNode(NodeT &node, const InputT &input, std::initializer_list<int64_t> axis, ge::DataType dtype, |
| 40 | - ge::DataType dtype, std::initializer_list<ge::Expression> repeats, | 39 | + std::initializer_list<ge::Expression> repeats, std::initializer_list<ge::Expression> strides) { |
| 41 | - std::initializer_list<ge::Expression> strides) { | ||
| 42 | node.x = input; | 40 | node.x = input; |
| 43 | - InitNode(node, exec_order, axis, dtype, repeats, strides); | 41 | + InitNode(node, axis, dtype, repeats, strides); |
| 44 | } | 42 | } |
| 45 | 43 | ||
| 46 | void ApplySchedulerTransform(ge::AscGraph &graph, const char *name, int64_t z1T, int64_t z1t, int64_t z0z1T, | 44 | void ApplySchedulerTransform(ge::AscGraph &graph, const char *name, int64_t z1T, int64_t z1t, int64_t z0z1T, |
| @@ -88,30 +86,28 @@ void AutoFuseBeforeAutoFuse(ge::AscGraph &graph) { | |||
| 88 | auto axis_list = {z0.id, z1.id}; | 86 | auto axis_list = {z0.id, z1.id}; |
| 89 | auto repeats = std::initializer_list<Expr>{s0 * s1, s2}; | 87 | auto repeats = std::initializer_list<Expr>{s0 * s1, s2}; |
| 90 | auto strides = std::initializer_list<Expr>{ZERO, ONE}; | 88 | auto strides = std::initializer_list<Expr>{ZERO, ONE}; |
| 91 | - | ||
| 92 | - int32_t exec_order = 0; | ||
| 93 | Data data("data", graph); | 89 | Data data("data", graph); |
| 94 | - InitNode(data, exec_order, axis_list, ge::DT_FLOAT16, repeats, strides); | 90 | + InitNode(data, axis_list, ge::DT_FLOAT16, repeats, strides); |
| 95 | 91 | ||
| 96 | Load load("load"); | 92 | Load load("load"); |
| 97 | - InitInputNode(load, data.y, exec_order, axis_list, ge::DT_FLOAT16, repeats, strides); | 93 | + InitInputNode(load, data.y, axis_list, ge::DT_FLOAT16, repeats, strides); |
| 98 | 94 | ||
| 99 | Data data1("data1", graph); | 95 | Data data1("data1", graph); |
| 100 | - InitNode(data1, exec_order, axis_list, ge::DT_FLOAT16, repeats, strides); | 96 | + InitNode(data1, axis_list, ge::DT_FLOAT16, repeats, strides); |
| 101 | 97 | ||
| 102 | Load load1("load1"); | 98 | Load load1("load1"); |
| 103 | - InitInputNode(load1, data1.y, exec_order, axis_list, ge::DT_FLOAT16, repeats, strides); | 99 | + InitInputNode(load1, data1.y, axis_list, ge::DT_FLOAT16, repeats, strides); |
| 104 | 100 | ||
| 105 | ge::ascir_op::Add add("add"); | 101 | ge::ascir_op::Add add("add"); |
| 106 | add.x1 = load.y; | 102 | add.x1 = load.y; |
| 107 | add.x2 = load1.y; | 103 | add.x2 = load1.y; |
| 108 | - InitNode(add, exec_order, axis_list, ge::DT_FLOAT16, repeats, strides); | 104 | + InitNode(add, axis_list, ge::DT_FLOAT16, repeats, strides); |
| 109 | 105 | ||
| 110 | Store store("store"); | 106 | Store store("store"); |
| 111 | - InitInputNode(store, add.y, exec_order, axis_list, ge::DT_FLOAT16, repeats, strides); | 107 | + InitInputNode(store, add.y, axis_list, ge::DT_FLOAT16, repeats, strides); |
| 112 | 108 | ||
| 113 | Output data_out("out"); | 109 | Output data_out("out"); |
| 114 | - InitInputNode(data_out, store.y, exec_order, axis_list, ge::DT_FLOAT16, repeats, strides); | 110 | + InitInputNode(data_out, store.y, axis_list, ge::DT_FLOAT16, repeats, strides); |
| 115 | std::cout << graph.GetAllAxis()[0]->id << std::endl; | 111 | std::cout << graph.GetAllAxis()[0]->id << std::endl; |
| 116 | std::cout << graph.GetAllAxis()[0]->id << std::endl; | 112 | std::cout << graph.GetAllAxis()[0]->id << std::endl; |
| 117 | std::cout << graph.GetAllAxis()[0]->id << std::endl; | 113 | std::cout << graph.GetAllAxis()[0]->id << std::endl; |
| @@ -172,14 +172,12 @@ TEST_F(TestGenModelInfo, input_check_01) | |||
| 172 | auto g = graph.CreateAxis("g", G, 1, 100000); | 172 | auto g = graph.CreateAxis("g", G, 1, 100000); |
| 173 | 173 | ||
| 174 | Data query("query", graph); | 174 | Data query("query", graph); |
| 175 | - query.attr.sched.exec_order = 0; | ||
| 176 | query.attr.sched.axis = {b.id, n.id, g.id}; | 175 | query.attr.sched.axis = {b.id, n.id, g.id}; |
| 177 | query.y.dtype = ge::DT_FLOAT16; | 176 | query.y.dtype = ge::DT_FLOAT16; |
| 178 | *query.y.axis = {b.id, n.id, g.id}; | 177 | *query.y.axis = {b.id, n.id, g.id}; |
| 179 | *query.y.repeats = {B, N, G}; | 178 | *query.y.repeats = {B, N, G}; |
| 180 | 179 | ||
| 181 | Data key("key", graph); | 180 | Data key("key", graph); |
| 182 | - key.attr.sched.exec_order = 1; | ||
| 183 | key.attr.sched.axis = {b.id, n.id, g.id}; | 181 | key.attr.sched.axis = {b.id, n.id, g.id}; |
| 184 | key.y.dtype = ge::DT_FLOAT16; | 182 | key.y.dtype = ge::DT_FLOAT16; |
| 185 | *key.y.axis = {b.id, n.id, g.id}; | 183 | *key.y.axis = {b.id, n.id, g.id}; |
| @@ -215,14 +213,12 @@ TEST_F(TestGenModelInfo, input_check_02) | |||
| 215 | auto g = graph.CreateAxis("g", G, 1, 100000); | 213 | auto g = graph.CreateAxis("g", G, 1, 100000); |
| 216 | 214 | ||
| 217 | Data query("query", graph); | 215 | Data query("query", graph); |
| 218 | - query.attr.sched.exec_order = 0; | ||
| 219 | query.attr.sched.axis = {b.id, n.id, g.id}; | 216 | query.attr.sched.axis = {b.id, n.id, g.id}; |
| 220 | query.y.dtype = ge::DT_FLOAT16; | 217 | query.y.dtype = ge::DT_FLOAT16; |
| 221 | *query.y.axis = {b.id, n.id, g.id}; | 218 | *query.y.axis = {b.id, n.id, g.id}; |
| 222 | *query.y.repeats = {B, N, G}; | 219 | *query.y.repeats = {B, N, G}; |
| 223 | 220 | ||
| 224 | Data key("key", graph); | 221 | Data key("key", graph); |
| 225 | - key.attr.sched.exec_order = 1; | ||
| 226 | key.attr.sched.axis = {b.id, n.id, g.id}; | 222 | key.attr.sched.axis = {b.id, n.id, g.id}; |
| 227 | key.y.dtype = ge::DT_FLOAT16; | 223 | key.y.dtype = ge::DT_FLOAT16; |
| 228 | *key.y.axis = {b.id, n.id, g.id}; | 224 | *key.y.axis = {b.id, n.id, g.id}; |
| @@ -259,14 +255,12 @@ TEST_F(TestGenModelInfo, input_check_03) | |||
| 259 | auto g = graph.CreateAxis("g", G, 1, 100000); | 255 | auto g = graph.CreateAxis("g", G, 1, 100000); |
| 260 | 256 | ||
| 261 | Data query("query", graph); | 257 | Data query("query", graph); |
| 262 | - query.attr.sched.exec_order = 0; | ||
| 263 | query.attr.sched.axis = {b.id, n.id, g.id}; | 258 | query.attr.sched.axis = {b.id, n.id, g.id}; |
| 264 | query.y.dtype = ge::DT_FLOAT16; | 259 | query.y.dtype = ge::DT_FLOAT16; |
| 265 | *query.y.axis = {b.id, n.id, g.id}; | 260 | *query.y.axis = {b.id, n.id, g.id}; |
| 266 | *query.y.repeats = {B, N, G}; | 261 | *query.y.repeats = {B, N, G}; |
| 267 | 262 | ||
| 268 | Data key("key", graph); | 263 | Data key("key", graph); |
| 269 | - key.attr.sched.exec_order = 1; | ||
| 270 | key.attr.sched.axis = {b.id, n.id, g.id}; | 264 | key.attr.sched.axis = {b.id, n.id, g.id}; |
| 271 | key.y.dtype = ge::DT_FLOAT16; | 265 | key.y.dtype = ge::DT_FLOAT16; |
| 272 | *key.y.axis = {b.id, n.id, g.id}; | 266 | *key.y.axis = {b.id, n.id, g.id}; |
| @@ -303,14 +297,12 @@ TEST_F(TestGenModelInfo, input_check_04) | |||
| 303 | auto g = graph.CreateAxis("g", G, 1, 100000); | 297 | auto g = graph.CreateAxis("g", G, 1, 100000); |
| 304 | 298 | ||
| 305 | Data query("query", graph); | 299 | Data query("query", graph); |
| 306 | - query.attr.sched.exec_order = 0; | ||
| 307 | query.attr.sched.axis = {b.id, n.id, g.id}; | 300 | query.attr.sched.axis = {b.id, n.id, g.id}; |
| 308 | query.y.dtype = ge::DT_FLOAT16; | 301 | query.y.dtype = ge::DT_FLOAT16; |
| 309 | *query.y.axis = {b.id, n.id, g.id}; | 302 | *query.y.axis = {b.id, n.id, g.id}; |
| 310 | *query.y.repeats = {B, N, G}; | 303 | *query.y.repeats = {B, N, G}; |
| 311 | 304 | ||
| 312 | Data key("key", graph); | 305 | Data key("key", graph); |
| 313 | - key.attr.sched.exec_order = 1; | ||
| 314 | key.attr.sched.axis = {b.id, n.id, g.id}; | 306 | key.attr.sched.axis = {b.id, n.id, g.id}; |
| 315 | key.y.dtype = ge::DT_FLOAT16; | 307 | key.y.dtype = ge::DT_FLOAT16; |
| 316 | *key.y.axis = {b.id, n.id, g.id}; | 308 | *key.y.axis = {b.id, n.id, g.id}; |
| @@ -347,14 +339,12 @@ TEST_F(TestGenModelInfo, input_check_05) | |||
| 347 | auto g = graph.CreateAxis("g", G, 1, 100000); | 339 | auto g = graph.CreateAxis("g", G, 1, 100000); |
| 348 | 340 | ||
| 349 | Data query("query", graph); | 341 | Data query("query", graph); |
| 350 | - query.attr.sched.exec_order = 0; | ||
| 351 | query.attr.sched.axis = {b.id, n.id, g.id}; | 342 | query.attr.sched.axis = {b.id, n.id, g.id}; |
| 352 | query.y.dtype = ge::DT_FLOAT16; | 343 | query.y.dtype = ge::DT_FLOAT16; |
| 353 | *query.y.axis = {b.id, n.id, g.id}; | 344 | *query.y.axis = {b.id, n.id, g.id}; |
| 354 | *query.y.repeats = {B, N, G}; | 345 | *query.y.repeats = {B, N, G}; |
| 355 | 346 | ||
| 356 | Data key("key", graph); | 347 | Data key("key", graph); |
| 357 | - key.attr.sched.exec_order = 1; | ||
| 358 | key.attr.sched.axis = {b.id, n.id, g.id}; | 348 | key.attr.sched.axis = {b.id, n.id, g.id}; |
| 359 | key.y.dtype = ge::DT_FLOAT16; | 349 | key.y.dtype = ge::DT_FLOAT16; |
| 360 | *key.y.axis = {b.id, n.id, g.id}; | 350 | *key.y.axis = {b.id, n.id, g.id}; |
| @@ -397,14 +387,12 @@ TEST_F(TestGenModelInfo, input_check_06) | |||
| 397 | auto m = graph.CreateAxis("g", M, 1, 100000); | 387 | auto m = graph.CreateAxis("g", M, 1, 100000); |
| 398 | 388 | ||
| 399 | Data query("query", graph); | 389 | Data query("query", graph); |
| 400 | - query.attr.sched.exec_order = 0; | ||
| 401 | query.attr.sched.axis = {b.id, n.id, g.id}; | 390 | query.attr.sched.axis = {b.id, n.id, g.id}; |
| 402 | query.y.dtype = ge::DT_FLOAT16; | 391 | query.y.dtype = ge::DT_FLOAT16; |
| 403 | *query.y.axis = {b.id, n.id, g.id}; | 392 | *query.y.axis = {b.id, n.id, g.id}; |
| 404 | *query.y.repeats = {B, N, G}; | 393 | *query.y.repeats = {B, N, G}; |
| 405 | 394 | ||
| 406 | Data key("key", graph); | 395 | Data key("key", graph); |
| 407 | - key.attr.sched.exec_order = 1; | ||
| 408 | key.attr.sched.axis = {b.id, n.id, g.id}; | 396 | key.attr.sched.axis = {b.id, n.id, g.id}; |
| 409 | key.y.dtype = ge::DT_FLOAT16; | 397 | key.y.dtype = ge::DT_FLOAT16; |
| 410 | *key.y.axis = {b.id, n.id, g.id}; | 398 | *key.y.axis = {b.id, n.id, g.id}; |
| @@ -58,9 +58,7 @@ void OriGraphBasicBlock(ge::AscGraph &graph) { | |||
| 58 | auto axis_list = {z0.id, z1.id}; | 58 | auto axis_list = {z0.id, z1.id}; |
| 59 | std::initializer_list<Expr> repeats = {s0, s1}; | 59 | std::initializer_list<Expr> repeats = {s0, s1}; |
| 60 | std::initializer_list<Expr> strides = {s1, ONE}; | 60 | std::initializer_list<Expr> strides = {s1, ONE}; |
| 61 | - int32_t exec_order = 0; | ||
| 62 | Data data("data", graph); | 61 | Data data("data", graph); |
| 63 | - data.attr.sched.exec_order = exec_order++; | ||
| 64 | data.attr.sched.axis = axis_list; | 62 | data.attr.sched.axis = axis_list; |
| 65 | data.y.dtype = ge::DT_FLOAT16; | 63 | data.y.dtype = ge::DT_FLOAT16; |
| 66 | *data.y.axis = axis_list; | 64 | *data.y.axis = axis_list; |
| @@ -69,7 +67,6 @@ void OriGraphBasicBlock(ge::AscGraph &graph) { | |||
| 69 | 67 | ||
| 70 | Load load("load"); | 68 | Load load("load"); |
| 71 | load.x = data.y; | 69 | load.x = data.y; |
| 72 | - load.attr.sched.exec_order = exec_order++; | ||
| 73 | load.attr.sched.axis = axis_list; | 70 | load.attr.sched.axis = axis_list; |
| 74 | load.y.dtype = ge::DT_FLOAT16; | 71 | load.y.dtype = ge::DT_FLOAT16; |
| 75 | *load.y.axis = axis_list; | 72 | *load.y.axis = axis_list; |
| @@ -78,7 +75,6 @@ void OriGraphBasicBlock(ge::AscGraph &graph) { | |||
| 78 | 75 | ||
| 79 | Output data_out("out"); | 76 | Output data_out("out"); |
| 80 | data_out.x = load.y; | 77 | data_out.x = load.y; |
| 81 | - data_out.attr.sched.exec_order = exec_order++; | ||
| 82 | data_out.y.dtype = ge::DT_FLOAT16; | 78 | data_out.y.dtype = ge::DT_FLOAT16; |
| 83 | *data_out.y.axis = axis_list; | 79 | *data_out.y.axis = axis_list; |
| 84 | *data_out.y.repeats = repeats; | 80 | *data_out.y.repeats = repeats; |
| @@ -130,9 +126,7 @@ void OriGraphReduceScalar(ge::AscGraph &graph) { | |||
| 130 | auto axis_list = {z0.id, z1.id}; | 126 | auto axis_list = {z0.id, z1.id}; |
| 131 | std::initializer_list<Expr> repeats = {s0, s1}; | 127 | std::initializer_list<Expr> repeats = {s0, s1}; |
| 132 | std::initializer_list<Expr> strides = {s1, ONE}; | 128 | std::initializer_list<Expr> strides = {s1, ONE}; |
| 133 | - int32_t exec_order = 0; | ||
| 134 | Data data("data", graph); | 129 | Data data("data", graph); |
| 135 | - data.attr.sched.exec_order = exec_order++; | ||
| 136 | data.attr.sched.axis = axis_list; | 130 | data.attr.sched.axis = axis_list; |
| 137 | data.y.dtype = ge::DT_FLOAT16; | 131 | data.y.dtype = ge::DT_FLOAT16; |
| 138 | *data.y.axis = axis_list; | 132 | *data.y.axis = axis_list; |
| @@ -141,7 +135,6 @@ void OriGraphReduceScalar(ge::AscGraph &graph) { | |||
| 141 | 135 | ||
| 142 | Load load("load"); | 136 | Load load("load"); |
| 143 | load.x = data.y; | 137 | load.x = data.y; |
| 144 | - load.attr.sched.exec_order = exec_order++; | ||
| 145 | load.attr.sched.axis = axis_list; | 138 | load.attr.sched.axis = axis_list; |
| 146 | load.y.dtype = ge::DT_FLOAT16; | 139 | load.y.dtype = ge::DT_FLOAT16; |
| 147 | *load.y.axis = axis_list; | 140 | *load.y.axis = axis_list; |
| @@ -150,7 +143,6 @@ void OriGraphReduceScalar(ge::AscGraph &graph) { | |||
| 150 | 143 | ||
| 151 | Sum reduce_sum("reduce_sum"); | 144 | Sum reduce_sum("reduce_sum"); |
| 152 | reduce_sum.x = load.y; | 145 | reduce_sum.x = load.y; |
| 153 | - reduce_sum.attr.sched.exec_order = exec_order++; | ||
| 154 | reduce_sum.attr.sched.axis = axis_list; | 146 | reduce_sum.attr.sched.axis = axis_list; |
| 155 | reduce_sum.y.dtype = ge::DT_FLOAT16; | 147 | reduce_sum.y.dtype = ge::DT_FLOAT16; |
| 156 | *reduce_sum.y.axis = axis_list; | 148 | *reduce_sum.y.axis = axis_list; |
| @@ -159,7 +151,6 @@ void OriGraphReduceScalar(ge::AscGraph &graph) { | |||
| 159 | 151 | ||
| 160 | Output data_out("out"); | 152 | Output data_out("out"); |
| 161 | data_out.x = reduce_sum.y; | 153 | data_out.x = reduce_sum.y; |
| 162 | - data_out.attr.sched.exec_order = exec_order++; | ||
| 163 | data_out.y.dtype = ge::DT_FLOAT16; | 154 | data_out.y.dtype = ge::DT_FLOAT16; |
| 164 | *data_out.y.axis = axis_list; | 155 | *data_out.y.axis = axis_list; |
| 165 | *data_out.y.repeats = repeats; | 156 | *data_out.y.repeats = repeats; |
| @@ -243,4 +234,4 @@ TEST_F(TestSchedule, case0) { | |||
| 243 | EXPECT_EQ(ret, 0); | 234 | EXPECT_EQ(ret, 0); |
| 244 | 235 | ||
| 245 | ret = std::system("./tiling_func_main_special"); | 236 | ret = std::system("./tiling_func_main_special"); |
| 246 | -} | 237 | +} |
| @@ -22,7 +22,7 @@ Status ConstructSimpleLoadStoreOp(af::AscGraph &graph) { | |||
| 22 | auto nd = graph.CreateAxis("nd", ND); | 22 | auto nd = graph.CreateAxis("nd", ND); |
| 23 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 23 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 24 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 24 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 25 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 25 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 26 | LOOP(*ndB) { | 26 | LOOP(*ndB) { |
| 27 | LOOP(*ndbT) { | 27 | LOOP(*ndbT) { |
| 28 | auto load1 = Load("load", data1).TQue(Position::kPositionVecIn, 1, 1); | 28 | auto load1 = Load("load", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -54,7 +54,7 @@ Status BuildConcatGroupAscendGraphS0S1ReduceMultiTiling(af::AscGraph &graph) { | |||
| 54 | auto [s1T, s1t] = graph.TileSplit(s1.id); | 54 | auto [s1T, s1t] = graph.TileSplit(s1.id); |
| 55 | auto s1Ts0T = *graph.MergeAxis({s1T->id, s0T->id}); | 55 | auto s1Ts0T = *graph.MergeAxis({s1T->id, s0T->id}); |
| 56 | auto [s1Ts0TB, s1Ts0Tb] = graph.BlockSplit(s1Ts0T.id); | 56 | auto [s1Ts0TB, s1Ts0Tb] = graph.BlockSplit(s1Ts0T.id); |
| 57 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {s0, s1}); | 57 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {s0, s1}, 0); |
| 58 | LOOP(*s1Ts0TB) { | 58 | LOOP(*s1Ts0TB) { |
| 59 | LOOP(*s1Ts0Tb) { | 59 | LOOP(*s1Ts0Tb) { |
| 60 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 60 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -2,10 +2,10 @@ | |||
| 2 | # -*- coding: utf-8 -*- | 2 | # -*- coding: utf-8 -*- |
| 3 | # ----------------------------------------------------------------------------------------------------------- | 3 | # ----------------------------------------------------------------------------------------------------------- |
| 4 | # Copyright (c) 2025 Huawei Technologies Co., Ltd. | 4 | # Copyright (c) 2025 Huawei Technologies Co., Ltd. |
| 5 | -# This program is free software, you can redistribute it and/or modify it under the terms and conditions of | 5 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 6 | # CANN Open Software License Agreement Version 2.0 (the "License"). | 6 | # CANN Open Software License Agreement Version 2.0 (the "License"). |
| 7 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 7 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 8 | -# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 8 | +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 9 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 9 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| 10 | # See LICENSE in the root of the software repository for the full text of the License. | 10 | # See LICENSE in the root of the software repository for the full text of the License. |
| 11 | # ----------------------------------------------------------------------------------------------------------- | 11 | # ----------------------------------------------------------------------------------------------------------- |
| @@ -13,7 +13,8 @@ | |||
| 13 | # Python code to construct AscGraph | 13 | # Python code to construct AscGraph |
| 14 | from autofuse.pyautofuse import ascir | 14 | from autofuse.pyautofuse import ascir |
| 15 | from autofuse.pyautofuse import Autofuser, AutofuserOptions | 15 | from autofuse.pyautofuse import Autofuser, AutofuserOptions |
| 16 | -NpuKernel0Graph = ascir.HintGraph('fused_graph_0_arar') | 16 | + |
| 17 | +NpuKernel0Graph = ascir.HintGraph("fused_graph_0_arar") | ||
| 17 | A0 = ascir.SizeExpr(2) | 18 | A0 = ascir.SizeExpr(2) |
| 18 | R0 = ascir.SizeExpr(1000) | 19 | R0 = ascir.SizeExpr(1000) |
| 19 | A1 = ascir.SizeExpr(50) | 20 | A1 = ascir.SizeExpr(50) |
| @@ -22,43 +23,37 @@ buf8_a0 = NpuKernel0Graph.create_axis("buf8_z0", A0) | |||
| 22 | buf8_r0 = NpuKernel0Graph.create_axis("buf8_z1", R0) | 23 | buf8_r0 = NpuKernel0Graph.create_axis("buf8_z1", R0) |
| 23 | buf8_a1 = NpuKernel0Graph.create_axis("buf8_z2", A1) | 24 | buf8_a1 = NpuKernel0Graph.create_axis("buf8_z2", A1) |
| 24 | buf8_r1 = NpuKernel0Graph.create_axis("buf8_z3", R1) | 25 | buf8_r1 = NpuKernel0Graph.create_axis("buf8_z3", R1) |
| 25 | -arg2_1 = ascir.ops.Data('arg2_1', NpuKernel0Graph) | 26 | +arg2_1 = ascir.ops.Data("arg2_1", NpuKernel0Graph) |
| 26 | -#arg2_1.attr.sched.exec_order = 0 | ||
| 27 | arg2_1.y.dtype = ascir.dtypes.float32 | 27 | arg2_1.y.dtype = ascir.dtypes.float32 |
| 28 | -load = ascir.ops.Load('load', NpuKernel0Graph) | 28 | +load = ascir.ops.Load("load", NpuKernel0Graph) |
| 29 | -#load.attr.sched.exec_order = 1 | ||
| 30 | load.attr.sched.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] | 29 | load.attr.sched.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] |
| 31 | load.x = arg2_1.y | 30 | load.x = arg2_1.y |
| 32 | load.y.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] | 31 | load.y.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] |
| 33 | load.y.strides = [R0 * A1 * R1, A1 * R1, R1, ascir.SizeExpr(1)] | 32 | load.y.strides = [R0 * A1 * R1, A1 * R1, R1, ascir.SizeExpr(1)] |
| 34 | load.y.size = [A0, R0, A1, R1] | 33 | load.y.size = [A0, R0, A1, R1] |
| 35 | load.y.dtype = ascir.dtypes.float32 | 34 | load.y.dtype = ascir.dtypes.float32 |
| 36 | -abs = ascir.ops.Abs('abs', NpuKernel0Graph) | 35 | +abs = ascir.ops.Abs("abs1", NpuKernel0Graph) |
| 37 | -#abs.attr.sched.exec_order = 2 | ||
| 38 | abs.attr.sched.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] | 36 | abs.attr.sched.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] |
| 39 | abs.x = load.y | 37 | abs.x = load.y |
| 40 | abs.y.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] | 38 | abs.y.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] |
| 41 | abs.y.strides = [R0 * A1 * R1, A1 * R1, R1, ascir.SizeExpr(1)] | 39 | abs.y.strides = [R0 * A1 * R1, A1 * R1, R1, ascir.SizeExpr(1)] |
| 42 | abs.y.size = [A0, R0, A1, R1] | 40 | abs.y.size = [A0, R0, A1, R1] |
| 43 | abs.y.dtype = ascir.dtypes.float32 | 41 | abs.y.dtype = ascir.dtypes.float32 |
| 44 | -sum = ascir.ops.Sum('sum', NpuKernel0Graph) | 42 | +sum = ascir.ops.Sum("sum1", NpuKernel0Graph) |
| 45 | -#sum.attr.sched.exec_order = 3 | ||
| 46 | sum.attr.sched.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] | 43 | sum.attr.sched.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] |
| 47 | sum.x = abs.y | 44 | sum.x = abs.y |
| 48 | sum.y.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] | 45 | sum.y.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] |
| 49 | sum.y.strides = [A1, 0, 1, 0] | 46 | sum.y.strides = [A1, 0, 1, 0] |
| 50 | sum.y.size = [A0, 1, A1, 1] | 47 | sum.y.size = [A0, 1, A1, 1] |
| 51 | sum.y.dtype = ascir.dtypes.float32 | 48 | sum.y.dtype = ascir.dtypes.float32 |
| 52 | -store8 = ascir.ops.Store('store8', NpuKernel0Graph) | 49 | +store8 = ascir.ops.Store("store8", NpuKernel0Graph) |
| 53 | -#store8.attr.sched.exec_order = 4 | ||
| 54 | store8.attr.sched.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] | 50 | store8.attr.sched.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] |
| 55 | store8.x = sum.y | 51 | store8.x = sum.y |
| 56 | store8.y.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] | 52 | store8.y.axis = [buf8_a0, buf8_r0, buf8_a1, buf8_r1] |
| 57 | store8.y.strides = [A1, 0, 1, 0] | 53 | store8.y.strides = [A1, 0, 1, 0] |
| 58 | store8.y.size = [A0, 1, A1, 1] | 54 | store8.y.size = [A0, 1, A1, 1] |
| 59 | store8.y.dtype = ascir.dtypes.float32 | 55 | store8.y.dtype = ascir.dtypes.float32 |
| 60 | -buf8 = ascir.ops.Output('buf8', NpuKernel0Graph) | 56 | +buf8 = ascir.ops.Output("buf8", NpuKernel0Graph) |
| 61 | -#buf8.attr.sched.exec_order = 5 | ||
| 62 | buf8.x = store8.y | 57 | buf8.x = store8.y |
| 63 | buf8.y.dtype = ascir.dtypes.float32 | 58 | buf8.y.dtype = ascir.dtypes.float32 |
| 64 | 59 | ||
| @@ -66,4 +61,4 @@ fuser = Autofuser(AutofuserOptions()) | |||
| 66 | fused_NpuKernel0Graph = fuser.schedule(NpuKernel0Graph) | 61 | fused_NpuKernel0Graph = fuser.schedule(NpuKernel0Graph) |
| 67 | tiling_def, host_impl, device_impl = fuser.codegen(fused_NpuKernel0Graph) | 62 | tiling_def, host_impl, device_impl = fuser.codegen(fused_NpuKernel0Graph) |
| 68 | print("=================================") | 63 | print("=================================") |
| 69 | -print(device_impl) | 64 | +print(device_impl) |
| @@ -55,7 +55,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 55 | Axis &s1_axis = graph.CreateAxis("S1", s1); | 55 | Axis &s1_axis = graph.CreateAxis("S1", s1); |
| 56 | 56 | ||
| 57 | ascir_op::Scalar scalar("Scalar", graph); | 57 | ascir_op::Scalar scalar("Scalar", graph); |
| 58 | - scalar.attr.sched.exec_order = 0; | ||
| 59 | scalar.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 58 | scalar.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 60 | scalar.y.dtype = af::DT_FLOAT16; | 59 | scalar.y.dtype = af::DT_FLOAT16; |
| 61 | scalar.y.format = af::FORMAT_ND; | 60 | scalar.y.format = af::FORMAT_ND; |
| @@ -65,7 +64,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 65 | scalar.ir_attr.SetValue("Test"); | 64 | scalar.ir_attr.SetValue("Test"); |
| 66 | 65 | ||
| 67 | ascir_op::Data data1("data1", graph); | 66 | ascir_op::Data data1("data1", graph); |
| 68 | - data1.attr.sched.exec_order = 0; | ||
| 69 | data1.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 67 | data1.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 70 | data1.y.dtype = af::DT_FLOAT16; | 68 | data1.y.dtype = af::DT_FLOAT16; |
| 71 | data1.y.format = af::FORMAT_ND; | 69 | data1.y.format = af::FORMAT_ND; |
| @@ -75,7 +73,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 75 | data1.ir_attr.SetIndex(2); | 73 | data1.ir_attr.SetIndex(2); |
| 76 | 74 | ||
| 77 | ascir_op::Data data2("data2", graph); | 75 | ascir_op::Data data2("data2", graph); |
| 78 | - data2.attr.sched.exec_order = 0; | ||
| 79 | data2.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 76 | data2.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 80 | data2.y.dtype = af::DT_FLOAT16; | 77 | data2.y.dtype = af::DT_FLOAT16; |
| 81 | data2.y.format = af::FORMAT_ND; | 78 | data2.y.format = af::FORMAT_ND; |
| @@ -87,7 +84,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 87 | ascir_op::Add add("add"); | 84 | ascir_op::Add add("add"); |
| 88 | add.x1 = scalar.y; | 85 | add.x1 = scalar.y; |
| 89 | add.x2 = scalar.y; | 86 | add.x2 = scalar.y; |
| 90 | - add.attr.sched.exec_order = 1; | ||
| 91 | add.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 87 | add.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 92 | add.y.dtype = af::DT_FLOAT16; | 88 | add.y.dtype = af::DT_FLOAT16; |
| 93 | add.y.format = af::FORMAT_ND; | 89 | add.y.format = af::FORMAT_ND; |
| @@ -97,7 +93,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 97 | 93 | ||
| 98 | ascir_op::Exp exp("exp"); | 94 | ascir_op::Exp exp("exp"); |
| 99 | exp.x = scalar.y; | 95 | exp.x = scalar.y; |
| 100 | - exp.attr.sched.exec_order = 2; | ||
| 101 | exp.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 96 | exp.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 102 | exp.y.dtype = af::DT_FLOAT16; | 97 | exp.y.dtype = af::DT_FLOAT16; |
| 103 | exp.y.format = af::FORMAT_ND; | 98 | exp.y.format = af::FORMAT_ND; |
| @@ -107,7 +102,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 107 | 102 | ||
| 108 | ascir_op::Concat concat("concat"); | 103 | ascir_op::Concat concat("concat"); |
| 109 | concat.x = {add.y, exp.y}; | 104 | concat.x = {add.y, exp.y}; |
| 110 | - concat.attr.sched.exec_order = 3; | ||
| 111 | concat.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 105 | concat.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 112 | concat.y.dtype = af::DT_FLOAT16; | 106 | concat.y.dtype = af::DT_FLOAT16; |
| 113 | concat.y.format = af::FORMAT_ND; | 107 | concat.y.format = af::FORMAT_ND; |
| @@ -119,7 +113,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 119 | fake_opa.x1 = exp.y; | 113 | fake_opa.x1 = exp.y; |
| 120 | fake_opa.x2 = exp.y; // 可选输入 | 114 | fake_opa.x2 = exp.y; // 可选输入 |
| 121 | fake_opa.x3 = data1.y; | 115 | fake_opa.x3 = data1.y; |
| 122 | - fake_opa.attr.sched.exec_order = 4; | ||
| 123 | fake_opa.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 116 | fake_opa.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 124 | fake_opa.y.dtype = af::DT_FLOAT16; | 117 | fake_opa.y.dtype = af::DT_FLOAT16; |
| 125 | fake_opa.y.format = af::FORMAT_ND; | 118 | fake_opa.y.format = af::FORMAT_ND; |
| @@ -132,7 +125,6 @@ void ConstructAscGraph(AscGraph &graph) { | |||
| 132 | leaky_relu.ir_attr.SetNegative_slope(1); | 125 | leaky_relu.ir_attr.SetNegative_slope(1); |
| 133 | 126 | ||
| 134 | ascir_op::Output output("output"); | 127 | ascir_op::Output output("output"); |
| 135 | - output.attr.sched.exec_order = 4; | ||
| 136 | output.x = fake_opa.y; | 128 | output.x = fake_opa.y; |
| 137 | output.ir_attr.SetIndex(1); | 129 | output.ir_attr.SetIndex(1); |
| 138 | } | 130 | } |
| @@ -225,7 +217,6 @@ void ConstructWrongAscGraph(AscGraph &graph) { | |||
| 225 | Axis &s1_axis = graph.CreateAxis("S1", s1); | 217 | Axis &s1_axis = graph.CreateAxis("S1", s1); |
| 226 | 218 | ||
| 227 | ascir_op::Data data("data", graph); | 219 | ascir_op::Data data("data", graph); |
| 228 | - data.attr.sched.exec_order = 0; | ||
| 229 | data.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 220 | data.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 230 | data.y.dtype = af::DT_FLOAT16; | 221 | data.y.dtype = af::DT_FLOAT16; |
| 231 | data.y.format = af::FORMAT_ND; | 222 | data.y.format = af::FORMAT_ND; |
| @@ -236,7 +227,6 @@ void ConstructWrongAscGraph(AscGraph &graph) { | |||
| 236 | 227 | ||
| 237 | ascir_op::Add add("add"); | 228 | ascir_op::Add add("add"); |
| 238 | add.x1 = data.y; | 229 | add.x1 = data.y; |
| 239 | - add.attr.sched.exec_order = 1; | ||
| 240 | add.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 230 | add.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 241 | add.y.dtype = af::DT_FLOAT16; | 231 | add.y.dtype = af::DT_FLOAT16; |
| 242 | add.y.format = af::FORMAT_ND; | 232 | add.y.format = af::FORMAT_ND; |
| @@ -246,7 +236,6 @@ void ConstructWrongAscGraph(AscGraph &graph) { | |||
| 246 | 236 | ||
| 247 | ascir_op::Exp exp("exp"); | 237 | ascir_op::Exp exp("exp"); |
| 248 | exp.x = add.y; | 238 | exp.x = add.y; |
| 249 | - exp.attr.sched.exec_order = 2; | ||
| 250 | exp.attr.sched.axis = {s0_axis.id, s1_axis.id}; | 239 | exp.attr.sched.axis = {s0_axis.id, s1_axis.id}; |
| 251 | exp.y.dtype = af::DT_FLOAT16; | 240 | exp.y.dtype = af::DT_FLOAT16; |
| 252 | exp.y.format = af::FORMAT_ND; | 241 | exp.y.format = af::FORMAT_ND; |
| @@ -257,7 +246,6 @@ void ConstructWrongAscGraph(AscGraph &graph) { | |||
| 257 | add.x2 = exp.y; | 246 | add.x2 = exp.y; |
| 258 | 247 | ||
| 259 | ascir_op::Output output("output"); | 248 | ascir_op::Output output("output"); |
| 260 | - output.attr.sched.exec_order = 4; | ||
| 261 | output.x = add.y; | 249 | output.x = add.y; |
| 262 | output.ir_attr.SetIndex(1); | 250 | output.ir_attr.SetIndex(1); |
| 263 | } | 251 | } |
| @@ -29,7 +29,6 @@ void MakeGraph0Normal(af::AscGraph &graph) { | |||
| 29 | auto z2 = graph.CreateAxis("z2", s2); | 29 | auto z2 = graph.CreateAxis("z2", s2); |
| 30 | 30 | ||
| 31 | Data x("x", graph); | 31 | Data x("x", graph); |
| 32 | - x.attr.sched.exec_order = 0; | ||
| 33 | x.attr.sched.axis = {z0.id, z1.id, z2.id}; | 32 | x.attr.sched.axis = {z0.id, z1.id, z2.id}; |
| 34 | 33 | ||
| 35 | x.y.dtype = af::DT_FLOAT16; | 34 | x.y.dtype = af::DT_FLOAT16; |
| @@ -39,7 +38,6 @@ void MakeGraph0Normal(af::AscGraph &graph) { | |||
| 39 | 38 | ||
| 40 | Load load("load"); | 39 | Load load("load"); |
| 41 | load.x = x.y; | 40 | load.x = x.y; |
| 42 | - load.attr.sched.exec_order = 1; | ||
| 43 | load.attr.sched.axis = {z0.id, z1.id, z2.id}; | 41 | load.attr.sched.axis = {z0.id, z1.id, z2.id}; |
| 44 | 42 | ||
| 45 | load.y.dtype = af::DT_FLOAT16; | 43 | load.y.dtype = af::DT_FLOAT16; |
| @@ -48,7 +46,6 @@ void MakeGraph0Normal(af::AscGraph &graph) { | |||
| 48 | *load.y.strides = {s1 * s2, s2, ONE}; | 46 | *load.y.strides = {s1 * s2, s2, ONE}; |
| 49 | Abs abs("abs"); | 47 | Abs abs("abs"); |
| 50 | abs.x = load.y; | 48 | abs.x = load.y; |
| 51 | - abs.attr.sched.exec_order = 2; | ||
| 52 | abs.attr.sched.axis = {z0.id, z1.id, z2.id}; | 49 | abs.attr.sched.axis = {z0.id, z1.id, z2.id}; |
| 53 | 50 | ||
| 54 | abs.y.dtype = af::DT_FLOAT16; | 51 | abs.y.dtype = af::DT_FLOAT16; |
| @@ -57,7 +54,6 @@ void MakeGraph0Normal(af::AscGraph &graph) { | |||
| 57 | *abs.y.strides = {s1 * s2, s2, ONE}; | 54 | *abs.y.strides = {s1 * s2, s2, ONE}; |
| 58 | Store store("store"); | 55 | Store store("store"); |
| 59 | store.x = abs.y; | 56 | store.x = abs.y; |
| 60 | - store.attr.sched.exec_order = 3; | ||
| 61 | store.attr.sched.axis = {z0.id, z1.id, z2.id}; | 57 | store.attr.sched.axis = {z0.id, z1.id, z2.id}; |
| 62 | 58 | ||
| 63 | store.y.dtype = af::DT_FLOAT16; | 59 | store.y.dtype = af::DT_FLOAT16; |
| @@ -66,7 +62,6 @@ void MakeGraph0Normal(af::AscGraph &graph) { | |||
| 66 | *store.y.strides = {s1 * s2, s2, ONE}; | 62 | *store.y.strides = {s1 * s2, s2, ONE}; |
| 67 | Output y("y"); | 63 | Output y("y"); |
| 68 | y.x = store.y; | 64 | y.x = store.y; |
| 69 | - y.attr.sched.exec_order = 4; | ||
| 70 | y.attr.sched.axis = {z0.id, z1.id, z2.id}; | 65 | y.attr.sched.axis = {z0.id, z1.id, z2.id}; |
| 71 | 66 | ||
| 72 | y.y.dtype = af::DT_FLOAT16; | 67 | y.y.dtype = af::DT_FLOAT16; |
| @@ -88,7 +83,6 @@ void MakeGraph0ByCg(af::AscGraph &graph) { | |||
| 88 | LOOP(z1) { | 83 | LOOP(z1) { |
| 89 | LOOP(z2) { | 84 | LOOP(z2) { |
| 90 | // 当前作用域内的所有的节点自动设置为sched.axis设置为{z0, z1, z2} | 85 | // 当前作用域内的所有的节点自动设置为sched.axis设置为{z0, z1, z2} |
| 91 | - // 执行序exec_order根据创建的节点顺序自动生成 | ||
| 92 | auto x = | 86 | auto x = |
| 93 | cg::ContiguousData("x", graph, af::DT_FLOAT16, axis); // 因为是连续tensor, 由axis推导出repeats, strides | 87 | cg::ContiguousData("x", graph, af::DT_FLOAT16, axis); // 因为是连续tensor, 由axis推导出repeats, strides |
| 94 | auto load = ascir::cg::Load( | 88 | auto load = ascir::cg::Load( |
| @@ -183,28 +183,4 @@ TEST(AscirOps_FlashSoftmaxInferDataType, Ok) { | |||
| 183 | EXPECT_EQ(fs->outputs[1].attr.dtype, af::DT_INT32); | 183 | EXPECT_EQ(fs->outputs[1].attr.dtype, af::DT_INT32); |
| 184 | EXPECT_EQ(fs->outputs[2].attr.dtype, af::DT_INT32); | 184 | EXPECT_EQ(fs->outputs[2].attr.dtype, af::DT_INT32); |
| 185 | } | 185 | } |
| 186 | -TEST(AscirOps, ExecOrderIncreaseOk) { | ||
| 187 | - af::AscGraph graph("test_graph"); | ||
| 188 | - auto A = af::Symbol("A"); | ||
| 189 | - auto B = af::Symbol("B"); | ||
| 190 | - auto C = af::Symbol("C"); | ||
| 191 | - auto a = graph.CreateAxis("a", A); | ||
| 192 | - auto b = graph.CreateAxis("b", B); | ||
| 193 | - auto c = graph.CreateAxis("c", C); | ||
| 194 | - | ||
| 195 | - auto data0 = ascir::cg::ContiguousData("data0", graph, af::DT_INT32, {a, b, c}); | ||
| 196 | - auto data1 = ascir::cg::ContiguousData("data1", graph, af::DT_FLOAT16, {a, b, c}); | ||
| 197 | - auto data2 = ascir::cg::ContiguousData("data2", graph, af::DT_FLOAT16, {a, b, c}); | ||
| 198 | - | ||
| 199 | - ascir::cg::FlashSoftmax("fs", data0, data1, data2); | ||
| 200 | - | ||
| 201 | - auto data0_node = graph.FindNode("data0"); | ||
| 202 | - auto data1_node = graph.FindNode("data1"); | ||
| 203 | - auto data2_node = graph.FindNode("data2"); | ||
| 204 | - auto fs_node = graph.FindNode("fs"); | ||
| 205 | - EXPECT_EQ(static_cast<int64_t>(data0_node->attr.sched.exec_order), 0); | ||
| 206 | - EXPECT_EQ(static_cast<int64_t>(data1_node->attr.sched.exec_order), 1); | ||
| 207 | - EXPECT_EQ(static_cast<int64_t>(data2_node->attr.sched.exec_order), 2); | ||
| 208 | - EXPECT_EQ(static_cast<int64_t>(fs_node->attr.sched.exec_order), 3); | ||
| 209 | -} | ||
| 210 | }; // namespace af | 186 | }; // namespace af |
| @@ -15,9 +15,8 @@ using namespace att; | |||
| 15 | using namespace af::ascir_op; | 15 | using namespace af::ascir_op; |
| 16 | namespace { | 16 | namespace { |
| 17 | template <typename T> | 17 | template <typename T> |
| 18 | -void InitGraphNode(T &node, int32_t &exec_order, std::initializer_list<int64_t> axis, af::DataType dtype, | 18 | +void InitGraphNode(T &node, std::initializer_list<int64_t> axis, af::DataType dtype, |
| 19 | std::initializer_list<Expr> repeats, std::initializer_list<Expr> strides) { | 19 | std::initializer_list<Expr> repeats, std::initializer_list<Expr> strides) { |
| 20 | - node.attr.sched.exec_order = exec_order++; | ||
| 21 | node.attr.sched.axis = axis; | 20 | node.attr.sched.axis = axis; |
| 22 | node.y.dtype = dtype; | 21 | node.y.dtype = dtype; |
| 23 | *node.y.axis = axis; | 22 | *node.y.axis = axis; |
| @@ -106,31 +105,29 @@ void BrcBufBeforeAutoFuse1(af::AscGraph &graph) { | |||
| 106 | auto normalS = std::initializer_list<Expr>{Z1 * Z2, Z2, ONE}; | 105 | auto normalS = std::initializer_list<Expr>{Z1 * Z2, Z2, ONE}; |
| 107 | auto beforeR = std::initializer_list<Expr>{Z0, ONE, Z2}; | 106 | auto beforeR = std::initializer_list<Expr>{Z0, ONE, Z2}; |
| 108 | auto beforeS = std::initializer_list<Expr>{Z2, ZERO, ONE}; | 107 | auto beforeS = std::initializer_list<Expr>{Z2, ZERO, ONE}; |
| 109 | - int32_t exec_order = 0; | ||
| 110 | 108 | ||
| 111 | Data input_data("input_data", graph); | 109 | Data input_data("input_data", graph); |
| 112 | - InitGraphNode(input_data, exec_order, axis, af::DT_FLOAT16, beforeR, beforeS); | 110 | + InitGraphNode(input_data, axis, af::DT_FLOAT16, beforeR, beforeS); |
| 113 | Load load("load"); | 111 | Load load("load"); |
| 114 | load.x = input_data.y; | 112 | load.x = input_data.y; |
| 115 | - InitGraphNode(load, exec_order, axis, af::DT_FLOAT16, beforeR, beforeS); | 113 | + InitGraphNode(load, axis, af::DT_FLOAT16, beforeR, beforeS); |
| 116 | Cast cast0("cast0"); | 114 | Cast cast0("cast0"); |
| 117 | cast0.x = load.y; | 115 | cast0.x = load.y; |
| 118 | - InitGraphNode(cast0, exec_order, axis, af::DT_FLOAT, beforeR, beforeS); | 116 | + InitGraphNode(cast0, axis, af::DT_FLOAT, beforeR, beforeS); |
| 119 | Broadcast broadcast("broadcast"); | 117 | Broadcast broadcast("broadcast"); |
| 120 | broadcast.x = cast0.y; | 118 | broadcast.x = cast0.y; |
| 121 | - InitGraphNode(broadcast, exec_order, axis, af::DT_FLOAT, normalR, normalS); | 119 | + InitGraphNode(broadcast, axis, af::DT_FLOAT, normalR, normalS); |
| 122 | Sum sum("sum"); | 120 | Sum sum("sum"); |
| 123 | sum.x = broadcast.y; | 121 | sum.x = broadcast.y; |
| 124 | - InitGraphNode(sum, exec_order, axis, af::DT_FLOAT, beforeR, beforeS); | 122 | + InitGraphNode(sum, axis, af::DT_FLOAT, beforeR, beforeS); |
| 125 | Cast cast1("cast1"); | 123 | Cast cast1("cast1"); |
| 126 | cast1.x = sum.y; | 124 | cast1.x = sum.y; |
| 127 | - InitGraphNode(cast1, exec_order, axis, af::DT_FLOAT16, beforeR, beforeS); | 125 | + InitGraphNode(cast1, axis, af::DT_FLOAT16, beforeR, beforeS); |
| 128 | Store store("store"); | 126 | Store store("store"); |
| 129 | store.x = cast1.y; | 127 | store.x = cast1.y; |
| 130 | - InitGraphNode(store, exec_order, axis, af::DT_FLOAT16, beforeR, beforeS); | 128 | + InitGraphNode(store, axis, af::DT_FLOAT16, beforeR, beforeS); |
| 131 | Output output_data("output_data"); | 129 | Output output_data("output_data"); |
| 132 | output_data.x = store.y; | 130 | output_data.x = store.y; |
| 133 | - output_data.attr.sched.exec_order = exec_order++; | ||
| 134 | } | 131 | } |
| 135 | 132 | ||
| 136 | void BrcBufAfterScheduler1(af::AscGraph &graph) { | 133 | void BrcBufAfterScheduler1(af::AscGraph &graph) { |
| @@ -194,31 +191,29 @@ void BrcBufBeforeAutoFuse2(af::AscGraph &graph) { | |||
| 194 | auto beforeS = std::initializer_list<Expr>{Z2, ZERO, ONE}; | 191 | auto beforeS = std::initializer_list<Expr>{Z2, ZERO, ONE}; |
| 195 | auto reduceR = std::initializer_list<Expr>{Z0, Z1, ONE}; | 192 | auto reduceR = std::initializer_list<Expr>{Z0, Z1, ONE}; |
| 196 | auto reduceS = std::initializer_list<Expr>{Z1, ONE, ZERO}; | 193 | auto reduceS = std::initializer_list<Expr>{Z1, ONE, ZERO}; |
| 197 | - int32_t exec_order = 0; | ||
| 198 | 194 | ||
| 199 | Data input_data("input_data", graph); | 195 | Data input_data("input_data", graph); |
| 200 | - InitGraphNode(input_data, exec_order, axis, af::DT_FLOAT16, beforeR, beforeS); | 196 | + InitGraphNode(input_data, axis, af::DT_FLOAT16, beforeR, beforeS); |
| 201 | Load load("load"); | 197 | Load load("load"); |
| 202 | load.x = input_data.y; | 198 | load.x = input_data.y; |
| 203 | - InitGraphNode(load, exec_order, axis, af::DT_FLOAT16, beforeR, beforeS); | 199 | + InitGraphNode(load, axis, af::DT_FLOAT16, beforeR, beforeS); |
| 204 | Cast cast0("cast0"); | 200 | Cast cast0("cast0"); |
| 205 | cast0.x = load.y; | 201 | cast0.x = load.y; |
| 206 | - InitGraphNode(cast0, exec_order, axis, af::DT_FLOAT, beforeR, beforeS); | 202 | + InitGraphNode(cast0, axis, af::DT_FLOAT, beforeR, beforeS); |
| 207 | Broadcast broadcast("broadcast"); | 203 | Broadcast broadcast("broadcast"); |
| 208 | broadcast.x = cast0.y; | 204 | broadcast.x = cast0.y; |
| 209 | - InitGraphNode(broadcast, exec_order, axis, af::DT_FLOAT, normalR, normalS); | 205 | + InitGraphNode(broadcast, axis, af::DT_FLOAT, normalR, normalS); |
| 210 | Sum sum("sum"); | 206 | Sum sum("sum"); |
| 211 | sum.x = broadcast.y; | 207 | sum.x = broadcast.y; |
| 212 | - InitGraphNode(sum, exec_order, axis, af::DT_FLOAT, reduceR, reduceS); | 208 | + InitGraphNode(sum, axis, af::DT_FLOAT, reduceR, reduceS); |
| 213 | Cast cast1("cast1"); | 209 | Cast cast1("cast1"); |
| 214 | cast1.x = sum.y; | 210 | cast1.x = sum.y; |
| 215 | - InitGraphNode(cast1, exec_order, axis, af::DT_FLOAT16, reduceR, reduceS); | 211 | + InitGraphNode(cast1, axis, af::DT_FLOAT16, reduceR, reduceS); |
| 216 | Store store("store"); | 212 | Store store("store"); |
| 217 | store.x = cast1.y; | 213 | store.x = cast1.y; |
| 218 | - InitGraphNode(store, exec_order, axis, af::DT_FLOAT16, reduceR, reduceS); | 214 | + InitGraphNode(store, axis, af::DT_FLOAT16, reduceR, reduceS); |
| 219 | Output output_data("output_data"); | 215 | Output output_data("output_data"); |
| 220 | output_data.x = store.y; | 216 | output_data.x = store.y; |
| 221 | - output_data.attr.sched.exec_order = exec_order++; | ||
| 222 | } | 217 | } |
| 223 | 218 | ||
| 224 | void BrcBufBeforeAutoFuse3(af::AscGraph &graph) { | 219 | void BrcBufBeforeAutoFuse3(af::AscGraph &graph) { |
| @@ -236,28 +231,26 @@ void BrcBufBeforeAutoFuse3(af::AscGraph &graph) { | |||
| 236 | auto normalS = std::initializer_list<Expr>{Z1 * Z2, Z2, ONE}; | 231 | auto normalS = std::initializer_list<Expr>{Z1 * Z2, Z2, ONE}; |
| 237 | auto beforeR = std::initializer_list<Expr>{Z0, ONE, Z2}; | 232 | auto beforeR = std::initializer_list<Expr>{Z0, ONE, Z2}; |
| 238 | auto beforeS = std::initializer_list<Expr>{Z2, ZERO, ONE}; | 233 | auto beforeS = std::initializer_list<Expr>{Z2, ZERO, ONE}; |
| 239 | - int32_t exec_order = 0; | ||
| 240 | 234 | ||
| 241 | Data input_data("input_data", graph); | 235 | Data input_data("input_data", graph); |
| 242 | - InitGraphNode(input_data, exec_order, axis, af::DT_FLOAT16, beforeR, beforeS); | 236 | + InitGraphNode(input_data, axis, af::DT_FLOAT16, beforeR, beforeS); |
| 243 | Load load("load"); | 237 | Load load("load"); |
| 244 | load.x = input_data.y; | 238 | load.x = input_data.y; |
| 245 | - InitGraphNode(load, exec_order, axis, af::DT_FLOAT16, beforeR, beforeS); | 239 | + InitGraphNode(load, axis, af::DT_FLOAT16, beforeR, beforeS); |
| 246 | Cast cast0("cast0"); | 240 | Cast cast0("cast0"); |
| 247 | cast0.x = load.y; | 241 | cast0.x = load.y; |
| 248 | - InitGraphNode(cast0, exec_order, axis, af::DT_FLOAT, beforeR, beforeS); | 242 | + InitGraphNode(cast0, axis, af::DT_FLOAT, beforeR, beforeS); |
| 249 | Broadcast broadcast("broadcast"); | 243 | Broadcast broadcast("broadcast"); |
| 250 | broadcast.x = cast0.y; | 244 | broadcast.x = cast0.y; |
| 251 | - InitGraphNode(broadcast, exec_order, axis, af::DT_FLOAT, normalR, normalS); | 245 | + InitGraphNode(broadcast, axis, af::DT_FLOAT, normalR, normalS); |
| 252 | Cast cast1("cast1"); | 246 | Cast cast1("cast1"); |
| 253 | cast1.x = broadcast.y; | 247 | cast1.x = broadcast.y; |
| 254 | - InitGraphNode(cast1, exec_order, axis, af::DT_FLOAT16, normalR, normalS); | 248 | + InitGraphNode(cast1, axis, af::DT_FLOAT16, normalR, normalS); |
| 255 | Store store("store"); | 249 | Store store("store"); |
| 256 | store.x = cast1.y; | 250 | store.x = cast1.y; |
| 257 | - InitGraphNode(store, exec_order, axis, af::DT_FLOAT16, normalR, normalS); | 251 | + InitGraphNode(store, axis, af::DT_FLOAT16, normalR, normalS); |
| 258 | Output output_data("output_data"); | 252 | Output output_data("output_data"); |
| 259 | output_data.x = store.y; | 253 | output_data.x = store.y; |
| 260 | - output_data.attr.sched.exec_order = exec_order++; | ||
| 261 | } | 254 | } |
| 262 | 255 | ||
| 263 | void BrcBufAfterScheduler3(af::AscGraph &graph) { | 256 | void BrcBufAfterScheduler3(af::AscGraph &graph) { |
| @@ -318,28 +311,26 @@ void BrcBufBeforeAutoFuse4(af::AscGraph &graph) { | |||
| 318 | auto normalS = std::initializer_list<Expr>{Z1 * Z2, Z2, ONE}; | 311 | auto normalS = std::initializer_list<Expr>{Z1 * Z2, Z2, ONE}; |
| 319 | auto beforeR = std::initializer_list<Expr>{Z0, ONE, Z2}; | 312 | auto beforeR = std::initializer_list<Expr>{Z0, ONE, Z2}; |
| 320 | auto beforeS = std::initializer_list<Expr>{Z2, ZERO, ONE}; | 313 | auto beforeS = std::initializer_list<Expr>{Z2, ZERO, ONE}; |
| 321 | - int32_t exec_order = 0; | ||
| 322 | 314 | ||
| 323 | Data input_data("input_data", graph); | 315 | Data input_data("input_data", graph); |
| 324 | - InitGraphNode(input_data, exec_order, axis, af::DT_FLOAT16, beforeR, beforeS); | 316 | + InitGraphNode(input_data, axis, af::DT_FLOAT16, beforeR, beforeS); |
| 325 | Load load("load"); | 317 | Load load("load"); |
| 326 | load.x = input_data.y; | 318 | load.x = input_data.y; |
| 327 | - InitGraphNode(load, exec_order, axis, af::DT_FLOAT16, beforeR, beforeS); | 319 | + InitGraphNode(load, axis, af::DT_FLOAT16, beforeR, beforeS); |
| 328 | Cast cast0("cast0"); | 320 | Cast cast0("cast0"); |
| 329 | cast0.x = load.y; | 321 | cast0.x = load.y; |
| 330 | - InitGraphNode(cast0, exec_order, axis, af::DT_FLOAT, beforeR, beforeS); | 322 | + InitGraphNode(cast0, axis, af::DT_FLOAT, beforeR, beforeS); |
| 331 | Sum sum("sum"); | 323 | Sum sum("sum"); |
| 332 | sum.x = cast0.y; | 324 | sum.x = cast0.y; |
| 333 | - InitGraphNode(sum, exec_order, axis, af::DT_FLOAT, beforeR, beforeS); | 325 | + InitGraphNode(sum, axis, af::DT_FLOAT, beforeR, beforeS); |
| 334 | Cast cast1("cast1"); | 326 | Cast cast1("cast1"); |
| 335 | cast1.x = sum.y; | 327 | cast1.x = sum.y; |
| 336 | - InitGraphNode(cast1, exec_order, axis, af::DT_FLOAT16, beforeR, beforeS); | 328 | + InitGraphNode(cast1, axis, af::DT_FLOAT16, beforeR, beforeS); |
| 337 | Store store("store"); | 329 | Store store("store"); |
| 338 | store.x = cast1.y; | 330 | store.x = cast1.y; |
| 339 | - InitGraphNode(store, exec_order, axis, af::DT_FLOAT16, beforeR, beforeS); | 331 | + InitGraphNode(store, axis, af::DT_FLOAT16, beforeR, beforeS); |
| 340 | Output output_data("output_data"); | 332 | Output output_data("output_data"); |
| 341 | output_data.x = store.y; | 333 | output_data.x = store.y; |
| 342 | - output_data.attr.sched.exec_order = exec_order++; | ||
| 343 | } | 334 | } |
| 344 | 335 | ||
| 345 | void BrcBufAfterScheduler4(af::AscGraph &graph) { | 336 | void BrcBufAfterScheduler4(af::AscGraph &graph) { |
| @@ -21,9 +21,8 @@ | |||
| 21 | 21 | ||
| 22 | using namespace af::ascir_op; | 22 | using namespace af::ascir_op; |
| 23 | namespace { | 23 | namespace { |
| 24 | -void InitDataNode(Data &node, int &exec_order, const std::vector<int64_t> &axis, af::DataType dtype, | 24 | +void InitDataNode(Data &node, const std::vector<int64_t> &axis, af::DataType dtype, |
| 25 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { | 25 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { |
| 26 | - node.attr.sched.exec_order = exec_order++; | ||
| 27 | node.attr.sched.axis = axis; | 26 | node.attr.sched.axis = axis; |
| 28 | node.y.dtype = dtype; | 27 | node.y.dtype = dtype; |
| 29 | *node.y.axis = axis; | 28 | *node.y.axis = axis; |
| @@ -31,9 +30,8 @@ void InitDataNode(Data &node, int &exec_order, const std::vector<int64_t> &axis, | |||
| 31 | *node.y.strides = strides; | 30 | *node.y.strides = strides; |
| 32 | } | 31 | } |
| 33 | 32 | ||
| 34 | -void InitLoadNode(Load &node, int &exec_order, const std::vector<int64_t> &axis, af::DataType dtype, | 33 | +void InitLoadNode(Load &node, const std::vector<int64_t> &axis, af::DataType dtype, |
| 35 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { | 34 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { |
| 36 | - node.attr.sched.exec_order = exec_order++; | ||
| 37 | node.attr.sched.axis = axis; | 35 | node.attr.sched.axis = axis; |
| 38 | node.y.dtype = dtype; | 36 | node.y.dtype = dtype; |
| 39 | *node.y.axis = axis; | 37 | *node.y.axis = axis; |
| @@ -41,9 +39,8 @@ void InitLoadNode(Load &node, int &exec_order, const std::vector<int64_t> &axis, | |||
| 41 | *node.y.strides = strides; | 39 | *node.y.strides = strides; |
| 42 | } | 40 | } |
| 43 | 41 | ||
| 44 | -void InitStoreNode(Store &node, int &exec_order, const std::vector<int64_t> &axis, af::DataType dtype, | 42 | +void InitStoreNode(Store &node, const std::vector<int64_t> &axis, af::DataType dtype, |
| 45 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { | 43 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { |
| 46 | - node.attr.sched.exec_order = exec_order++; | ||
| 47 | node.attr.sched.axis = axis; | 44 | node.attr.sched.axis = axis; |
| 48 | node.y.dtype = dtype; | 45 | node.y.dtype = dtype; |
| 49 | *node.y.axis = axis; | 46 | *node.y.axis = axis; |
| @@ -51,9 +48,8 @@ void InitStoreNode(Store &node, int &exec_order, const std::vector<int64_t> &axi | |||
| 51 | *node.y.strides = strides; | 48 | *node.y.strides = strides; |
| 52 | } | 49 | } |
| 53 | 50 | ||
| 54 | -void InitOutputNode(Output &node, int &exec_order, const std::vector<int64_t> &axis, af::DataType dtype, | 51 | +void InitOutputNode(Output &node, const std::vector<int64_t> &axis, af::DataType dtype, |
| 55 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { | 52 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { |
| 56 | - node.attr.sched.exec_order = exec_order++; | ||
| 57 | node.y.dtype = dtype; | 53 | node.y.dtype = dtype; |
| 58 | *node.y.axis = axis; | 54 | *node.y.axis = axis; |
| 59 | *node.y.repeats = repeats; | 55 | *node.y.repeats = repeats; |
| @@ -104,9 +100,8 @@ std::string RemoveAutoFuseTilingHeadGuards(const std::string &input) { | |||
| 104 | 100 | ||
| 105 | return oss.str(); | 101 | return oss.str(); |
| 106 | } | 102 | } |
| 107 | -void InitConcatAxes(Concat &node, int &exec_order, const std::vector<int64_t> &axis, af::DataType dtype, | 103 | +void InitConcatAxes(Concat &node, const std::vector<int64_t> &axis, af::DataType dtype, |
| 108 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { | 104 | const std::vector<af::Expression> &repeats, const std::vector<af::Expression> &strides) { |
| 109 | - node.attr.sched.exec_order = exec_order++; | ||
| 110 | node.attr.sched.axis = axis; | 105 | node.attr.sched.axis = axis; |
| 111 | node.y.dtype = dtype; | 106 | node.y.dtype = dtype; |
| 112 | *node.y.axis = axis; | 107 | *node.y.axis = axis; |
| @@ -123,59 +118,57 @@ void Concat_Normal_BeforeAutofuse(ascir::HintGraph &graph) { | |||
| 123 | auto str_ar = std::vector<af::Expression>{R, ONE, ZERO}; | 118 | auto str_ar = std::vector<af::Expression>{R, ONE, ZERO}; |
| 124 | auto rep_a = std::vector<af::Expression>{A, ONE, ONE}; | 119 | auto rep_a = std::vector<af::Expression>{A, ONE, ONE}; |
| 125 | auto str_a = std::vector<af::Expression>{ONE, ZERO, ZERO}; | 120 | auto str_a = std::vector<af::Expression>{ONE, ZERO, ZERO}; |
| 126 | - int exec_order = 0; | ||
| 127 | 121 | ||
| 128 | Data x1("x1", graph); | 122 | Data x1("x1", graph); |
| 129 | - InitDataNode(x1, exec_order, axis, af::DT_FLOAT16, rep_ar, str_ar); | 123 | + InitDataNode(x1, axis, af::DT_FLOAT16, rep_ar, str_ar); |
| 130 | Load x1L("x1Local"); | 124 | Load x1L("x1Local"); |
| 131 | x1L.x = x1.y; | 125 | x1L.x = x1.y; |
| 132 | - InitLoadNode(x1L, exec_order, axis, af::DT_FLOAT16, rep_ar, str_ar); | 126 | + InitLoadNode(x1L, axis, af::DT_FLOAT16, rep_ar, str_ar); |
| 133 | Data x2("x2", graph); | 127 | Data x2("x2", graph); |
| 134 | - InitDataNode(x2, exec_order, axis, af::DT_FLOAT16, rep_ar, str_ar); | 128 | + InitDataNode(x2, axis, af::DT_FLOAT16, rep_ar, str_ar); |
| 135 | Load x2L("x2Local"); | 129 | Load x2L("x2Local"); |
| 136 | x2L.x = x2.y; | 130 | x2L.x = x2.y; |
| 137 | - InitLoadNode(x2L, exec_order, axis, af::DT_FLOAT16, rep_ar, str_ar); | 131 | + InitLoadNode(x2L, axis, af::DT_FLOAT16, rep_ar, str_ar); |
| 138 | Data bias("bias", graph); | 132 | Data bias("bias", graph); |
| 139 | - InitDataNode(bias, exec_order, axis, af::DT_FLOAT16, rep_ar, str_ar); | 133 | + InitDataNode(bias, axis, af::DT_FLOAT16, rep_ar, str_ar); |
| 140 | Load biasL("biasLocal"); | 134 | Load biasL("biasLocal"); |
| 141 | biasL.x = bias.y; | 135 | biasL.x = bias.y; |
| 142 | - InitLoadNode(biasL, exec_order, axis, af::DT_FLOAT16, rep_ar, str_ar); | 136 | + InitLoadNode(biasL, axis, af::DT_FLOAT16, rep_ar, str_ar); |
| 143 | 137 | ||
| 144 | Concat mean("mean"); | 138 | Concat mean("mean"); |
| 145 | mean.x = {x1L.y, x2L.y, biasL.y}; | 139 | mean.x = {x1L.y, x2L.y, biasL.y}; |
| 146 | - InitConcatAxes(mean, exec_order, axis, af::DT_FLOAT, rep_ar, str_ar); | 140 | + InitConcatAxes(mean, axis, af::DT_FLOAT, rep_ar, str_ar); |
| 147 | Store x_out("x_out"); | 141 | Store x_out("x_out"); |
| 148 | x_out.x = mean.y; | 142 | x_out.x = mean.y; |
| 149 | - InitStoreNode(x_out, exec_order, axis, af::DT_FLOAT16, rep_ar, str_ar); | 143 | + InitStoreNode(x_out, axis, af::DT_FLOAT16, rep_ar, str_ar); |
| 150 | Store mean_out("mean_out"); | 144 | Store mean_out("mean_out"); |
| 151 | mean_out.x = mean.y; | 145 | mean_out.x = mean.y; |
| 152 | - InitStoreNode(mean_out, exec_order, axis, af::DT_FLOAT, rep_a, str_a); | 146 | + InitStoreNode(mean_out, axis, af::DT_FLOAT, rep_a, str_a); |
| 153 | 147 | ||
| 154 | Data one("one", graph); | 148 | Data one("one", graph); |
| 155 | - InitDataNode(one, exec_order, axis, af::DT_FLOAT, {ONE, ONE, BL}, {ZERO, ZERO, ONE}); | 149 | + InitDataNode(one, axis, af::DT_FLOAT, {ONE, ONE, BL}, {ZERO, ZERO, ONE}); |
| 156 | Concat rstd("rstd"); | 150 | Concat rstd("rstd"); |
| 157 | rstd.x = {mean.y, mean.y, one.y}; | 151 | rstd.x = {mean.y, mean.y, one.y}; |
| 158 | - InitConcatAxes(rstd, exec_order, axis, af::DT_FLOAT, rep_ar, str_ar); | 152 | + InitConcatAxes(rstd, axis, af::DT_FLOAT, rep_ar, str_ar); |
| 159 | Store rstd_out("rstd_out"); | 153 | Store rstd_out("rstd_out"); |
| 160 | rstd_out.x = rstd.y; | 154 | rstd_out.x = rstd.y; |
| 161 | - InitStoreNode(rstd_out, exec_order, axis, af::DT_FLOAT, rep_a, str_a); | 155 | + InitStoreNode(rstd_out, axis, af::DT_FLOAT, rep_a, str_a); |
| 162 | 156 | ||
| 163 | auto rep_r = std::vector<af::Expression>{ONE, R, ONE}; | 157 | auto rep_r = std::vector<af::Expression>{ONE, R, ONE}; |
| 164 | auto str_r = std::vector<af::Expression>{ZERO, ONE, ZERO}; | 158 | auto str_r = std::vector<af::Expression>{ZERO, ONE, ZERO}; |
| 165 | Data beta("beta", graph); | 159 | Data beta("beta", graph); |
| 166 | - InitDataNode(beta, exec_order, axis, af::DT_FLOAT16, rep_r, str_r); | 160 | + InitDataNode(beta, axis, af::DT_FLOAT16, rep_r, str_r); |
| 167 | Load betaL("betaLocal"); | 161 | Load betaL("betaLocal"); |
| 168 | betaL.x = beta.y; | 162 | betaL.x = beta.y; |
| 169 | - InitLoadNode(betaL, exec_order, axis, af::DT_FLOAT16, rep_r, str_r); | 163 | + InitLoadNode(betaL, axis, af::DT_FLOAT16, rep_r, str_r); |
| 170 | Data gamma("gamma", graph); | 164 | Data gamma("gamma", graph); |
| 171 | - InitDataNode(gamma, exec_order, axis, af::DT_FLOAT16, rep_r, str_r); | 165 | + InitDataNode(gamma, axis, af::DT_FLOAT16, rep_r, str_r); |
| 172 | Load gammaL("gammaLocal"); | 166 | Load gammaL("gammaLocal"); |
| 173 | gammaL.x = gamma.y; | 167 | gammaL.x = gamma.y; |
| 174 | - InitLoadNode(gammaL, exec_order, axis, af::DT_FLOAT16, rep_r, str_r); | 168 | + InitLoadNode(gammaL, axis, af::DT_FLOAT16, rep_r, str_r); |
| 175 | 169 | ||
| 176 | Concat y("y"); | 170 | Concat y("y"); |
| 177 | y.attr.api.unit = af::ComputeUnit::kUnitVector; | 171 | y.attr.api.unit = af::ComputeUnit::kUnitVector; |
| 178 | - y.attr.sched.exec_order = exec_order++; | ||
| 179 | y.attr.sched.axis = axis; | 172 | y.attr.sched.axis = axis; |
| 180 | y.x = {rstd.y, betaL.y, gammaL.y, rstd.y}; | 173 | y.x = {rstd.y, betaL.y, gammaL.y, rstd.y}; |
| 181 | y.y.dtype = af::DT_FLOAT16; | 174 | y.y.dtype = af::DT_FLOAT16; |
| @@ -187,26 +180,26 @@ void Concat_Normal_BeforeAutofuse(ascir::HintGraph &graph) { | |||
| 187 | *concat.y.axis = axis, *concat.y.repeats = rep_ar, *concat.y.strides = str_ar; | 180 | *concat.y.axis = axis, *concat.y.repeats = rep_ar, *concat.y.strides = str_ar; |
| 188 | Store cat_out("cat_out"); | 181 | Store cat_out("cat_out"); |
| 189 | cat_out.x = y.y; | 182 | cat_out.x = y.y; |
| 190 | - InitStoreNode(cat_out, exec_order, axis, af::DT_FLOAT16, rep_ar, str_ar); | 183 | + InitStoreNode(cat_out, axis, af::DT_FLOAT16, rep_ar, str_ar); |
| 191 | Store y_out("y_out"); | 184 | Store y_out("y_out"); |
| 192 | y_out.x = y.y; | 185 | y_out.x = y.y; |
| 193 | - InitStoreNode(y_out, exec_order, axis, af::DT_FLOAT16, rep_ar, str_ar); | 186 | + InitStoreNode(y_out, axis, af::DT_FLOAT16, rep_ar, str_ar); |
| 194 | 187 | ||
| 195 | Output buf1("buf1"); | 188 | Output buf1("buf1"); |
| 196 | buf1.x = x_out.y; | 189 | buf1.x = x_out.y; |
| 197 | - InitOutputNode(buf1, exec_order, axis, af::DT_FLOAT16, rep_ar, str_ar); | 190 | + InitOutputNode(buf1, axis, af::DT_FLOAT16, rep_ar, str_ar); |
| 198 | Output buf2("buf2"); | 191 | Output buf2("buf2"); |
| 199 | buf2.x = mean_out.y; | 192 | buf2.x = mean_out.y; |
| 200 | - InitOutputNode(buf2, exec_order, axis, af::DT_FLOAT, rep_a, str_a); | 193 | + InitOutputNode(buf2, axis, af::DT_FLOAT, rep_a, str_a); |
| 201 | Output buf3("buf3"); | 194 | Output buf3("buf3"); |
| 202 | buf3.x = rstd_out.y; | 195 | buf3.x = rstd_out.y; |
| 203 | - InitOutputNode(buf3, exec_order, axis, af::DT_FLOAT, rep_a, str_a); | 196 | + InitOutputNode(buf3, axis, af::DT_FLOAT, rep_a, str_a); |
| 204 | Output buf("buf"); | 197 | Output buf("buf"); |
| 205 | buf.x = y_out.y; | 198 | buf.x = y_out.y; |
| 206 | - InitOutputNode(buf, exec_order, axis, af::DT_FLOAT16, rep_ar, str_ar); | 199 | + InitOutputNode(buf, axis, af::DT_FLOAT16, rep_ar, str_ar); |
| 207 | Output buf4("buf4"); | 200 | Output buf4("buf4"); |
| 208 | buf4.x = cat_out.y; | 201 | buf4.x = cat_out.y; |
| 209 | - InitOutputNode(buf4, exec_order, axis, af::DT_FLOAT16, rep_ar, str_ar); | 202 | + InitOutputNode(buf4, axis, af::DT_FLOAT16, rep_ar, str_ar); |
| 210 | } | 203 | } |
| 211 | 204 | ||
| 212 | /* | 205 | /* |
| @@ -449,8 +442,8 @@ Status BuildTqueTbufAscendGraph_single_case(af::AscGraph &graph, bool reuse_temp | |||
| 449 | auto nd = graph.CreateAxis("nd", ND); | 442 | auto nd = graph.CreateAxis("nd", ND); |
| 450 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 443 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 451 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 444 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 452 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 445 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 453 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 446 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 454 | LOOP(*ndB) { | 447 | LOOP(*ndB) { |
| 455 | LOOP(*ndbT) { | 448 | LOOP(*ndbT) { |
| 456 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 449 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -480,10 +473,10 @@ Status BuildTqueTbufAscendGraph_multi_case_g0(af::AscGraph &graph) { | |||
| 480 | auto nd = graph.CreateAxis("nd", ND); | 473 | auto nd = graph.CreateAxis("nd", ND); |
| 481 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 474 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 482 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 475 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 483 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 476 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 484 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 477 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 485 | - auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {nd}); | 478 | + auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {nd}, 2); |
| 486 | - auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {nd}); | 479 | + auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {nd}, 3); |
| 487 | LOOP(*ndB) { | 480 | LOOP(*ndB) { |
| 488 | LOOP(*ndbT) { | 481 | LOOP(*ndbT) { |
| 489 | auto load_tque0 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 482 | auto load_tque0 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -523,10 +516,10 @@ Status BuildTqueTbufAscendGraph_multi_case_g1(af::AscGraph &graph) { | |||
| 523 | auto z0 = graph.CreateAxis("z0", S0); | 516 | auto z0 = graph.CreateAxis("z0", S0); |
| 524 | auto [z0B, z0b] = graph.BlockSplit(z0.id); | 517 | auto [z0B, z0b] = graph.BlockSplit(z0.id); |
| 525 | auto [z0bT, z0bt] = graph.TileSplit(z0b->id); | 518 | auto [z0bT, z0bt] = graph.TileSplit(z0b->id); |
| 526 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 519 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 527 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}); | 520 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}, 1); |
| 528 | - auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {z0}); | 521 | + auto data3 = graph.CreateContiguousData("input3", DT_FLOAT, {z0}, 2); |
| 529 | - auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {z0}); | 522 | + auto data4 = graph.CreateContiguousData("input4", DT_FLOAT, {z0}, 3); |
| 530 | LOOP(*z0B) { | 523 | LOOP(*z0B) { |
| 531 | LOOP(*z0bT) { | 524 | LOOP(*z0bT) { |
| 532 | auto load_tque0 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 525 | auto load_tque0 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -14,9 +14,8 @@ namespace att { | |||
| 14 | using namespace att; | 14 | using namespace att; |
| 15 | using namespace af::ascir_op; | 15 | using namespace af::ascir_op; |
| 16 | namespace { | 16 | namespace { |
| 17 | -void InitDataNode(Data &node, int32_t &exec_order, std::initializer_list<int64_t> axis, af::DataType dtype, | 17 | +void InitDataNode(Data &node, std::initializer_list<int64_t> axis, af::DataType dtype, |
| 18 | std::initializer_list<Expr> repeats, std::initializer_list<Expr> strides) { | 18 | std::initializer_list<Expr> repeats, std::initializer_list<Expr> strides) { |
| 19 | - node.attr.sched.exec_order = exec_order++; | ||
| 20 | node.attr.sched.axis = axis; | 19 | node.attr.sched.axis = axis; |
| 21 | node.y.dtype = dtype; | 20 | node.y.dtype = dtype; |
| 22 | *node.y.axis = axis; | 21 | *node.y.axis = axis; |
| @@ -24,9 +23,8 @@ void InitDataNode(Data &node, int32_t &exec_order, std::initializer_list<int64_t | |||
| 24 | *node.y.strides = strides; | 23 | *node.y.strides = strides; |
| 25 | } | 24 | } |
| 26 | 25 | ||
| 27 | -void InitLoadNode(Load &node, int32_t &exec_order, std::initializer_list<int64_t> axis, af::DataType dtype, | 26 | +void InitLoadNode(Load &node, std::initializer_list<int64_t> axis, af::DataType dtype, |
| 28 | std::initializer_list<Expr> repeats, std::initializer_list<Expr> strides) { | 27 | std::initializer_list<Expr> repeats, std::initializer_list<Expr> strides) { |
| 29 | - node.attr.sched.exec_order = exec_order++; | ||
| 30 | node.attr.sched.axis = axis; | 28 | node.attr.sched.axis = axis; |
| 31 | node.y.dtype = dtype; | 29 | node.y.dtype = dtype; |
| 32 | *node.y.axis = axis; | 30 | *node.y.axis = axis; |
| @@ -34,9 +32,8 @@ void InitLoadNode(Load &node, int32_t &exec_order, std::initializer_list<int64_t | |||
| 34 | *node.y.strides = strides; | 32 | *node.y.strides = strides; |
| 35 | } | 33 | } |
| 36 | 34 | ||
| 37 | -void InitStoreNode(Store &node, int32_t &exec_order, std::initializer_list<int64_t> axis, af::DataType dtype, | 35 | +void InitStoreNode(Store &node, std::initializer_list<int64_t> axis, af::DataType dtype, |
| 38 | std::initializer_list<Expr> repeats, std::initializer_list<Expr> strides) { | 36 | std::initializer_list<Expr> repeats, std::initializer_list<Expr> strides) { |
| 39 | - node.attr.sched.exec_order = exec_order++; | ||
| 40 | node.attr.sched.axis = axis; | 37 | node.attr.sched.axis = axis; |
| 41 | node.y.dtype = dtype; | 38 | node.y.dtype = dtype; |
| 42 | *node.y.axis = axis; | 39 | *node.y.axis = axis; |
| @@ -44,9 +41,8 @@ void InitStoreNode(Store &node, int32_t &exec_order, std::initializer_list<int64 | |||
| 44 | *node.y.strides = strides; | 41 | *node.y.strides = strides; |
| 45 | } | 42 | } |
| 46 | 43 | ||
| 47 | -void InitOutputNode(Output &node, int32_t &exec_order, std::initializer_list<int64_t> axis, af::DataType dtype, | 44 | +void InitOutputNode(Output &node, std::initializer_list<int64_t> axis, af::DataType dtype, |
| 48 | std::initializer_list<Expr> repeats, std::initializer_list<Expr> strides) { | 45 | std::initializer_list<Expr> repeats, std::initializer_list<Expr> strides) { |
| 49 | - node.attr.sched.exec_order = exec_order++; | ||
| 50 | node.y.dtype = dtype; | 46 | node.y.dtype = dtype; |
| 51 | *node.y.axis = axis; | 47 | *node.y.axis = axis; |
| 52 | *node.y.repeats = repeats; | 48 | *node.y.repeats = repeats; |
| @@ -54,9 +50,8 @@ void InitOutputNode(Output &node, int32_t &exec_order, std::initializer_list<int | |||
| 54 | } | 50 | } |
| 55 | 51 | ||
| 56 | template <typename T> | 52 | template <typename T> |
| 57 | -void InitUnaryNode(T &node, int32_t &exec_order, std::initializer_list<int64_t> axis, af::DataType dtype, | 53 | +void InitUnaryNode(T &node, std::initializer_list<int64_t> axis, af::DataType dtype, |
| 58 | std::initializer_list<Expr> repeats, std::initializer_list<Expr> strides) { | 54 | std::initializer_list<Expr> repeats, std::initializer_list<Expr> strides) { |
| 59 | - node.attr.sched.exec_order = exec_order++; | ||
| 60 | node.attr.sched.axis = axis; | 55 | node.attr.sched.axis = axis; |
| 61 | node.y.dtype = dtype; | 56 | node.y.dtype = dtype; |
| 62 | *node.y.axis = axis; | 57 | *node.y.axis = axis; |
| @@ -212,44 +207,43 @@ void ApplyVec2NodesSched(af::AscGraph &graph, const SchedAxis &a) { | |||
| 212 | } | 207 | } |
| 213 | } // namespace | 208 | } // namespace |
| 214 | 209 | ||
| 215 | -void FaBeforeAutoFuseBmm1(af::AscGraph &graph, int32_t &exec_order, const std::initializer_list<int64_t> &bmmAxis, | 210 | +void FaBeforeAutoFuseBmm1(af::AscGraph &graph, const std::initializer_list<int64_t> &bmmAxis, |
| 216 | const std::initializer_list<Expr> &vec1R, const std::initializer_list<Expr> &vec1S, | 211 | const std::initializer_list<Expr> &vec1R, const std::initializer_list<Expr> &vec1S, |
| 217 | const Expr &B, const Expr &N, const Expr &G, const Expr &S1, const Expr &S2, const Expr &D, | 212 | const Expr &B, const Expr &N, const Expr &G, const Expr &S1, const Expr &S2, const Expr &D, |
| 218 | const Expr &ONE, const Expr &ZERO, Add &out_mul1) { | 213 | const Expr &ONE, const Expr &ZERO, Add &out_mul1) { |
| 219 | Data query("query", graph); | 214 | Data query("query", graph); |
| 220 | - InitDataNode(query, exec_order, bmmAxis, af::DT_FLOAT16, {B, N, G, S1, ONE, D, ONE}, | 215 | + InitDataNode(query, bmmAxis, af::DT_FLOAT16, {B, N, G, S1, ONE, D, ONE}, |
| 221 | {N * G * S1 * D, G * S1 * D, S1 * D, D, ZERO, ONE, ZERO}); | 216 | {N * G * S1 * D, G * S1 * D, S1 * D, D, ZERO, ONE, ZERO}); |
| 222 | Data key("key", graph); | 217 | Data key("key", graph); |
| 223 | - InitDataNode(key, exec_order, bmmAxis, af::DT_FLOAT16, {B, N, G, ONE, S2, D, ONE}, | 218 | + InitDataNode(key, bmmAxis, af::DT_FLOAT16, {B, N, G, ONE, S2, D, ONE}, |
| 224 | {N * S1 * D, S2 * D, S2 * D, ZERO, D, ONE, ZERO}); | 219 | {N * S1 * D, S2 * D, S2 * D, ZERO, D, ONE, ZERO}); |
| 225 | Add bmm1("bmm1"); | 220 | Add bmm1("bmm1"); |
| 226 | bmm1.x1 = query.y; | 221 | bmm1.x1 = query.y; |
| 227 | bmm1.x2 = key.y; | 222 | bmm1.x2 = key.y; |
| 228 | - InitUnaryNode(bmm1, exec_order, bmmAxis, af::DT_FLOAT, vec1R, vec1S); | 223 | + InitUnaryNode(bmm1, bmmAxis, af::DT_FLOAT, vec1R, vec1S); |
| 229 | Load load1("load1"); | 224 | Load load1("load1"); |
| 230 | load1.x = bmm1.y; | 225 | load1.x = bmm1.y; |
| 231 | - InitLoadNode(load1, exec_order, bmmAxis, af::DT_FLOAT, vec1R, vec1S); | 226 | + InitLoadNode(load1, bmmAxis, af::DT_FLOAT, vec1R, vec1S); |
| 232 | Data pse("pse", graph); | 227 | Data pse("pse", graph); |
| 233 | - InitDataNode(pse, exec_order, bmmAxis, af::DT_FLOAT16, vec1R, vec1S); | 228 | + InitDataNode(pse, bmmAxis, af::DT_FLOAT16, vec1R, vec1S); |
| 234 | Load loadPse("loadPse"); | 229 | Load loadPse("loadPse"); |
| 235 | loadPse.x = pse.y; | 230 | loadPse.x = pse.y; |
| 236 | - InitLoadNode(loadPse, exec_order, bmmAxis, af::DT_FLOAT16, vec1R, vec1S); | 231 | + InitLoadNode(loadPse, bmmAxis, af::DT_FLOAT16, vec1R, vec1S); |
| 237 | Cast castPse("castPse"); | 232 | Cast castPse("castPse"); |
| 238 | castPse.x = loadPse.y; | 233 | castPse.x = loadPse.y; |
| 239 | - InitUnaryNode(castPse, exec_order, bmmAxis, af::DT_FLOAT, vec1R, vec1S); | 234 | + InitUnaryNode(castPse, bmmAxis, af::DT_FLOAT, vec1R, vec1S); |
| 240 | Add add1("add1"); | 235 | Add add1("add1"); |
| 241 | add1.x1 = load1.y; | 236 | add1.x1 = load1.y; |
| 242 | add1.x2 = castPse.y; | 237 | add1.x2 = castPse.y; |
| 243 | - InitUnaryNode(add1, exec_order, bmmAxis, af::DT_FLOAT, vec1R, vec1S); | 238 | + InitUnaryNode(add1, bmmAxis, af::DT_FLOAT, vec1R, vec1S); |
| 244 | Data scaleValue("scaleValue", graph); | 239 | Data scaleValue("scaleValue", graph); |
| 245 | - scaleValue.attr.sched.exec_order = exec_order++; | ||
| 246 | scaleValue.y.dtype = af::DT_FLOAT; | 240 | scaleValue.y.dtype = af::DT_FLOAT; |
| 247 | out_mul1.x1 = add1.y; | 241 | out_mul1.x1 = add1.y; |
| 248 | out_mul1.x2 = scaleValue.y; | 242 | out_mul1.x2 = scaleValue.y; |
| 249 | - InitUnaryNode(out_mul1, exec_order, bmmAxis, af::DT_FLOAT, vec1R, vec1S); | 243 | + InitUnaryNode(out_mul1, bmmAxis, af::DT_FLOAT, vec1R, vec1S); |
| 250 | } | 244 | } |
| 251 | 245 | ||
| 252 | -void FaBeforeAutoFuseVec1(af::AscGraph &graph, int32_t &exec_order, const std::initializer_list<int64_t> &bmmAxis, | 246 | +void FaBeforeAutoFuseVec1(af::AscGraph &graph, const std::initializer_list<int64_t> &bmmAxis, |
| 253 | const std::initializer_list<Expr> &vec1R, const std::initializer_list<Expr> &vec1S, | 247 | const std::initializer_list<Expr> &vec1R, const std::initializer_list<Expr> &vec1S, |
| 254 | const std::initializer_list<Expr> &reduceR, const std::initializer_list<Expr> &reduceS, | 248 | const std::initializer_list<Expr> &reduceR, const std::initializer_list<Expr> &reduceS, |
| 255 | const Expr &B, const Expr &N, const Expr &G, const Expr &S1, const Expr &S2, const Expr &BL, | 249 | const Expr &B, const Expr &N, const Expr &G, const Expr &S1, const Expr &S2, const Expr &BL, |
| @@ -258,59 +252,57 @@ void FaBeforeAutoFuseVec1(af::AscGraph &graph, int32_t &exec_order, const std::i | |||
| 258 | auto maskR = std::initializer_list<Expr>{B, ONE, ONE, S1, S2, ONE, ONE}; | 252 | auto maskR = std::initializer_list<Expr>{B, ONE, ONE, S1, S2, ONE, ONE}; |
| 259 | auto maskS = std::initializer_list<Expr>{S1 * S2, S1 * S2, S1 * S2, S2, ONE, ZERO, ZERO}; | 253 | auto maskS = std::initializer_list<Expr>{S1 * S2, S1 * S2, S1 * S2, S2, ONE, ZERO, ZERO}; |
| 260 | Data attenMask("attenMask", graph); | 254 | Data attenMask("attenMask", graph); |
| 261 | - InitDataNode(attenMask, exec_order, bmmAxis, af::DT_UINT8, maskR, maskS); | 255 | + InitDataNode(attenMask, bmmAxis, af::DT_UINT8, maskR, maskS); |
| 262 | Load loadAttenMask("loadAttenMask"); | 256 | Load loadAttenMask("loadAttenMask"); |
| 263 | loadAttenMask.x = attenMask.y; | 257 | loadAttenMask.x = attenMask.y; |
| 264 | - InitLoadNode(loadAttenMask, exec_order, bmmAxis, af::DT_UINT8, maskR, maskS); | 258 | + InitLoadNode(loadAttenMask, bmmAxis, af::DT_UINT8, maskR, maskS); |
| 265 | Select select("select"); | 259 | Select select("select"); |
| 266 | select.x1 = mul1.y; | 260 | select.x1 = mul1.y; |
| 267 | select.x2 = loadAttenMask.y; | 261 | select.x2 = loadAttenMask.y; |
| 268 | - InitUnaryNode(select, exec_order, bmmAxis, af::DT_FLOAT, vec1R, vec1S); | 262 | + InitUnaryNode(select, bmmAxis, af::DT_FLOAT, vec1R, vec1S); |
| 269 | - InitDataNode(out_softmaxExp, exec_order, bmmAxis, af::DT_FLOAT, reduceR, reduceS); | 263 | + InitDataNode(out_softmaxExp, bmmAxis, af::DT_FLOAT, reduceR, reduceS); |
| 270 | Data softmaxApiTmpBuf("softmaxApiTmpBuf", graph); | 264 | Data softmaxApiTmpBuf("softmaxApiTmpBuf", graph); |
| 271 | - InitDataNode(softmaxApiTmpBuf, exec_order, bmmAxis, af::DT_FLOAT, {ONE, ONE, ONE, S1, S2, ONE, ONE}, | 265 | + InitDataNode(softmaxApiTmpBuf, bmmAxis, af::DT_FLOAT, {ONE, ONE, ONE, S1, S2, ONE, ONE}, |
| 272 | {ZERO, ZERO, ZERO, S2, ONE, ZERO, ZERO}); | 266 | {ZERO, ZERO, ZERO, S2, ONE, ZERO, ZERO}); |
| 273 | out_flashSoftmax.x = {select.y, out_softmaxExp.y, softmaxApiTmpBuf.y}; | 267 | out_flashSoftmax.x = {select.y, out_softmaxExp.y, softmaxApiTmpBuf.y}; |
| 274 | - InitUnaryNode(out_flashSoftmax, exec_order, bmmAxis, af::DT_FLOAT, vec1R, vec1S); | 268 | + InitUnaryNode(out_flashSoftmax, bmmAxis, af::DT_FLOAT, vec1R, vec1S); |
| 275 | Store storeSoftmaxMax("storeSoftmaxMax"); | 269 | Store storeSoftmaxMax("storeSoftmaxMax"); |
| 276 | storeSoftmaxMax.x = out_flashSoftmax.y; | 270 | storeSoftmaxMax.x = out_flashSoftmax.y; |
| 277 | - InitStoreNode(storeSoftmaxMax, exec_order, bmmAxis, af::DT_FLOAT, {B, N, G, S1, S2, ONE, BL}, | 271 | + InitStoreNode(storeSoftmaxMax, bmmAxis, af::DT_FLOAT, {B, N, G, S1, S2, ONE, BL}, |
| 278 | {N * G * S1 * BL, G * S1 * BL, S1 * BL, BL, ZERO, ZERO, ONE}); | 272 | {N * G * S1 * BL, G * S1 * BL, S1 * BL, BL, ZERO, ZERO, ONE}); |
| 279 | Output softmaxMax("softmaxMax"); | 273 | Output softmaxMax("softmaxMax"); |
| 280 | softmaxMax.x = storeSoftmaxMax.y; | 274 | softmaxMax.x = storeSoftmaxMax.y; |
| 281 | - softmaxMax.attr.sched.exec_order = exec_order++; | ||
| 282 | Data dropMask("dropMask", graph); | 275 | Data dropMask("dropMask", graph); |
| 283 | - InitDataNode(dropMask, exec_order, bmmAxis, af::DT_UINT8, vec1R, vec1S); | 276 | + InitDataNode(dropMask, bmmAxis, af::DT_UINT8, vec1R, vec1S); |
| 284 | Load loadDropMask("loadDropMask"); | 277 | Load loadDropMask("loadDropMask"); |
| 285 | loadDropMask.x = dropMask.y; | 278 | loadDropMask.x = dropMask.y; |
| 286 | - InitLoadNode(loadDropMask, exec_order, bmmAxis, af::DT_UINT8, vec1R, vec1S); | 279 | + InitLoadNode(loadDropMask, bmmAxis, af::DT_UINT8, vec1R, vec1S); |
| 287 | Add dropout("dropout"); | 280 | Add dropout("dropout"); |
| 288 | dropout.x1 = out_flashSoftmax.y; | 281 | dropout.x1 = out_flashSoftmax.y; |
| 289 | dropout.x2 = loadDropMask.y; | 282 | dropout.x2 = loadDropMask.y; |
| 290 | - InitUnaryNode(dropout, exec_order, bmmAxis, af::DT_FLOAT, vec1R, vec1S); | 283 | + InitUnaryNode(dropout, bmmAxis, af::DT_FLOAT, vec1R, vec1S); |
| 291 | Cast castVec1Res("castVec1Res"); | 284 | Cast castVec1Res("castVec1Res"); |
| 292 | castVec1Res.x = dropout.y; | 285 | castVec1Res.x = dropout.y; |
| 293 | - InitUnaryNode(castVec1Res, exec_order, bmmAxis, af::DT_FLOAT16, vec1R, vec1S); | 286 | + InitUnaryNode(castVec1Res, bmmAxis, af::DT_FLOAT16, vec1R, vec1S); |
| 294 | out_storeVec1Res.x = castVec1Res.y; | 287 | out_storeVec1Res.x = castVec1Res.y; |
| 295 | - InitStoreNode(out_storeVec1Res, exec_order, bmmAxis, af::DT_FLOAT16, vec1R, vec1R); | 288 | + InitStoreNode(out_storeVec1Res, bmmAxis, af::DT_FLOAT16, vec1R, vec1R); |
| 296 | } | 289 | } |
| 297 | 290 | ||
| 298 | -void FaBeforeAutoFuseBmm2(af::AscGraph &graph, int32_t &exec_order, const std::initializer_list<int64_t> &bmmAxis, | 291 | +void FaBeforeAutoFuseBmm2(af::AscGraph &graph, const std::initializer_list<int64_t> &bmmAxis, |
| 299 | const std::initializer_list<Expr> &vec2R, const std::initializer_list<Expr> &vec2S, | 292 | const std::initializer_list<Expr> &vec2R, const std::initializer_list<Expr> &vec2S, |
| 300 | const Expr &B, const Expr &N, const Expr &G, const Expr &S2, const Expr &D, const Expr &ONE, | 293 | const Expr &B, const Expr &N, const Expr &G, const Expr &S2, const Expr &D, const Expr &ONE, |
| 301 | const Expr &ZERO, Store &storeVec1Res, Data &softmaxExp, Concat &flashSoftmax) { | 294 | const Expr &ZERO, Store &storeVec1Res, Data &softmaxExp, Concat &flashSoftmax) { |
| 302 | Data value("value", graph); | 295 | Data value("value", graph); |
| 303 | - InitDataNode(value, exec_order, bmmAxis, af::DT_FLOAT16, {B, N, G, ONE, S2, D, ONE}, | 296 | + InitDataNode(value, bmmAxis, af::DT_FLOAT16, {B, N, G, ONE, S2, D, ONE}, |
| 304 | {N * S2 * D, S2 * D, S2 * D, ZERO, D, ONE, ZERO}); | 297 | {N * S2 * D, S2 * D, S2 * D, ZERO, D, ONE, ZERO}); |
| 305 | Add bmm2("bmm2"); | 298 | Add bmm2("bmm2"); |
| 306 | bmm2.x1 = storeVec1Res.y; | 299 | bmm2.x1 = storeVec1Res.y; |
| 307 | bmm2.x2 = value.y; | 300 | bmm2.x2 = value.y; |
| 308 | - InitUnaryNode(bmm2, exec_order, bmmAxis, af::DT_FLOAT, vec2R, vec2S); | 301 | + InitUnaryNode(bmm2, bmmAxis, af::DT_FLOAT, vec2R, vec2S); |
| 309 | Load load2("load2"); | 302 | Load load2("load2"); |
| 310 | load2.x = bmm2.y; | 303 | load2.x = bmm2.y; |
| 311 | - InitLoadNode(load2, exec_order, bmmAxis, af::DT_FLOAT, vec2R, vec2S); | 304 | + InitLoadNode(load2, bmmAxis, af::DT_FLOAT, vec2R, vec2S); |
| 312 | Workspace addResOut("addResOut"); | 305 | Workspace addResOut("addResOut"); |
| 313 | - addResOut.attr.sched.exec_order = exec_order++; | ||
| 314 | addResOut.attr.sched.axis = bmmAxis; | 306 | addResOut.attr.sched.axis = bmmAxis; |
| 315 | addResOut.x = load2.y; | 307 | addResOut.x = load2.y; |
| 316 | addResOut.y.dtype = af::DT_FLOAT; | 308 | addResOut.y.dtype = af::DT_FLOAT; |
| @@ -319,28 +311,28 @@ void FaBeforeAutoFuseBmm2(af::AscGraph &graph, int32_t &exec_order, const std::i | |||
| 319 | *addResOut.y.strides = vec2S; | 311 | *addResOut.y.strides = vec2S; |
| 320 | Load loadAddResOut("loadAddResOut"); | 312 | Load loadAddResOut("loadAddResOut"); |
| 321 | loadAddResOut.x = addResOut.y; | 313 | loadAddResOut.x = addResOut.y; |
| 322 | - InitLoadNode(loadAddResOut, exec_order, bmmAxis, af::DT_FLOAT, vec2R, vec2S); | 314 | + InitLoadNode(loadAddResOut, bmmAxis, af::DT_FLOAT, vec2R, vec2S); |
| 323 | Mul mulRes("mulRes"); | 315 | Mul mulRes("mulRes"); |
| 324 | mulRes.x1 = loadAddResOut.y; | 316 | mulRes.x1 = loadAddResOut.y; |
| 325 | mulRes.x2 = softmaxExp.y; | 317 | mulRes.x2 = softmaxExp.y; |
| 326 | - InitUnaryNode(mulRes, exec_order, bmmAxis, af::DT_FLOAT, vec2R, vec2S); | 318 | + InitUnaryNode(mulRes, bmmAxis, af::DT_FLOAT, vec2R, vec2S); |
| 327 | Add addRes("addRes"); | 319 | Add addRes("addRes"); |
| 328 | addRes.x1 = load2.y; | 320 | addRes.x1 = load2.y; |
| 329 | addRes.x2 = mulRes.y; | 321 | addRes.x2 = mulRes.y; |
| 330 | - InitUnaryNode(addRes, exec_order, bmmAxis, af::DT_FLOAT, vec2R, vec2S); | 322 | + InitUnaryNode(addRes, bmmAxis, af::DT_FLOAT, vec2R, vec2S); |
| 331 | Div div("div"); | 323 | Div div("div"); |
| 332 | div.x1 = addRes.y; | 324 | div.x1 = addRes.y; |
| 333 | div.x2 = flashSoftmax.y; | 325 | div.x2 = flashSoftmax.y; |
| 334 | - InitUnaryNode(div, exec_order, bmmAxis, af::DT_FLOAT, vec2R, vec2S); | 326 | + InitUnaryNode(div, bmmAxis, af::DT_FLOAT, vec2R, vec2S); |
| 335 | Cast castBmm2Res("castBmm2Res"); | 327 | Cast castBmm2Res("castBmm2Res"); |
| 336 | castBmm2Res.x = div.y; | 328 | castBmm2Res.x = div.y; |
| 337 | - InitUnaryNode(castBmm2Res, exec_order, bmmAxis, af::DT_FLOAT16, vec2R, vec2S); | 329 | + InitUnaryNode(castBmm2Res, bmmAxis, af::DT_FLOAT16, vec2R, vec2S); |
| 338 | Store store("store"); | 330 | Store store("store"); |
| 339 | store.x = castBmm2Res.y; | 331 | store.x = castBmm2Res.y; |
| 340 | - InitStoreNode(store, exec_order, bmmAxis, af::DT_FLOAT16, vec2R, vec2S); | 332 | + InitStoreNode(store, bmmAxis, af::DT_FLOAT16, vec2R, vec2S); |
| 341 | Output buf("buf"); | 333 | Output buf("buf"); |
| 342 | buf.x = store.y; | 334 | buf.x = store.y; |
| 343 | - InitOutputNode(buf, exec_order, bmmAxis, af::DT_FLOAT16, vec2R, vec2S); | 335 | + InitOutputNode(buf, bmmAxis, af::DT_FLOAT16, vec2R, vec2S); |
| 344 | } | 336 | } |
| 345 | 337 | ||
| 346 | void FaBeforeAutoFuse(af::AscGraph &graph) { | 338 | void FaBeforeAutoFuse(af::AscGraph &graph) { |
| @@ -367,16 +359,14 @@ void FaBeforeAutoFuse(af::AscGraph &graph) { | |||
| 367 | auto vec2S = std::initializer_list<Expr>{N * G * S1 * D, G * S1 * D, S1 * D, D, ZERO, ONE, ZERO}; | 359 | auto vec2S = std::initializer_list<Expr>{N * G * S1 * D, G * S1 * D, S1 * D, D, ZERO, ONE, ZERO}; |
| 368 | auto reduceR = std::initializer_list<Expr>{ONE, ONE, ONE, S1, ONE, ONE, BL}; | 360 | auto reduceR = std::initializer_list<Expr>{ONE, ONE, ONE, S1, ONE, ONE, BL}; |
| 369 | auto reduceS = std::initializer_list<Expr>{ZERO, ZERO, ZERO, BL, ZERO, ZERO, ONE}; | 361 | auto reduceS = std::initializer_list<Expr>{ZERO, ZERO, ZERO, BL, ZERO, ZERO, ONE}; |
| 370 | - int32_t exec_order = 0; | ||
| 371 | Add mul1("mul1"); | 362 | Add mul1("mul1"); |
| 372 | - FaBeforeAutoFuseBmm1(graph, exec_order, bmmAxis, vec1R, vec1S, B, N, G, S1, S2, D, ONE, ZERO, mul1); | 363 | + FaBeforeAutoFuseBmm1(graph, bmmAxis, vec1R, vec1S, B, N, G, S1, S2, D, ONE, ZERO, mul1); |
| 373 | Data softmaxExp("softmaxExp", graph); | 364 | Data softmaxExp("softmaxExp", graph); |
| 374 | Concat flashSoftmax("flashSoftmax"); | 365 | Concat flashSoftmax("flashSoftmax"); |
| 375 | Store storeVec1Res("storeVec1Res"); | 366 | Store storeVec1Res("storeVec1Res"); |
| 376 | - FaBeforeAutoFuseVec1(graph, exec_order, bmmAxis, vec1R, vec1S, reduceR, reduceS, B, N, G, S1, S2, BL, ONE, ZERO, mul1, | 367 | + FaBeforeAutoFuseVec1(graph, bmmAxis, vec1R, vec1S, reduceR, reduceS, B, N, G, S1, S2, BL, ONE, ZERO, mul1, softmaxExp, |
| 377 | - softmaxExp, flashSoftmax, storeVec1Res); | 368 | + flashSoftmax, storeVec1Res); |
| 378 | - FaBeforeAutoFuseBmm2(graph, exec_order, bmmAxis, vec2R, vec2S, B, N, G, S2, D, ONE, ZERO, storeVec1Res, softmaxExp, | 369 | + FaBeforeAutoFuseBmm2(graph, bmmAxis, vec2R, vec2S, B, N, G, S2, D, ONE, ZERO, storeVec1Res, softmaxExp, flashSoftmax); |
| 379 | - flashSoftmax); | ||
| 380 | } | 370 | } |
| 381 | 371 | ||
| 382 | void FaAfterApiInfo(af::AscGraph &graph) { | 372 | void FaAfterApiInfo(af::AscGraph &graph) { |
| @@ -512,16 +502,15 @@ void UnknownGraph(af::AscGraph &graph) { | |||
| 512 | auto resAxis = {x.id, y.id}; | 502 | auto resAxis = {x.id, y.id}; |
| 513 | auto resRepeat = std::initializer_list<Expr>{X, Y}; | 503 | auto resRepeat = std::initializer_list<Expr>{X, Y}; |
| 514 | auto resStride = std::initializer_list<Expr>{Y, ONE}; | 504 | auto resStride = std::initializer_list<Expr>{Y, ONE}; |
| 515 | - int32_t exec_order = 0; | ||
| 516 | 505 | ||
| 517 | Data input("input", graph); | 506 | Data input("input", graph); |
| 518 | - InitDataNode(input, exec_order, resAxis, af::DT_UINT32, resRepeat, resStride); | 507 | + InitDataNode(input, resAxis, af::DT_UINT32, resRepeat, resStride); |
| 519 | SetApiAttr(graph.FindNode("input"), af::ApiType::kAPITypeBuffer, af::ComputeUnit::kUnitNone); | 508 | SetApiAttr(graph.FindNode("input"), af::ApiType::kAPITypeBuffer, af::ComputeUnit::kUnitNone); |
| 520 | SetNodeMemAttr(graph.FindNode("input"), tensorID, {"input", 0, 0, 0, -1, -1, false, false}); | 509 | SetNodeMemAttr(graph.FindNode("input"), tensorID, {"input", 0, 0, 0, -1, -1, false, false}); |
| 521 | 510 | ||
| 522 | Load load("load"); | 511 | Load load("load"); |
| 523 | load.x = input.y; | 512 | load.x = input.y; |
| 524 | - InitLoadNode(load, exec_order, resAxis, af::DT_UINT32, resRepeat, resStride); | 513 | + InitLoadNode(load, resAxis, af::DT_UINT32, resRepeat, resStride); |
| 525 | auto load_node = graph.FindNode("load"); | 514 | auto load_node = graph.FindNode("load"); |
| 526 | SetApiAttr(load_node, af::ApiType::kAPITypeCompute, af::ComputeUnit::kUnitNone); | 515 | SetApiAttr(load_node, af::ApiType::kAPITypeCompute, af::ComputeUnit::kUnitNone); |
| 527 | load_node->attr.sched.loop_axis = x.id; | 516 | load_node->attr.sched.loop_axis = x.id; |
| @@ -530,7 +519,7 @@ void UnknownGraph(af::AscGraph &graph) { | |||
| 530 | 519 | ||
| 531 | Nop unknown("unknown"); | 520 | Nop unknown("unknown"); |
| 532 | unknown.x = load.y; | 521 | unknown.x = load.y; |
| 533 | - InitUnaryNode(unknown, exec_order, resAxis, af::DT_UINT32, resRepeat, resStride); | 522 | + InitUnaryNode(unknown, resAxis, af::DT_UINT32, resRepeat, resStride); |
| 534 | auto unknown_node = graph.FindNode("unknown"); | 523 | auto unknown_node = graph.FindNode("unknown"); |
| 535 | SetApiAttr(unknown_node, af::ApiType::kAPITypeBuffer, af::ComputeUnit::kUnitVector); | 524 | SetApiAttr(unknown_node, af::ApiType::kAPITypeBuffer, af::ComputeUnit::kUnitVector); |
| 536 | unknown_node->attr.sched.loop_axis = x.id; | 525 | unknown_node->attr.sched.loop_axis = x.id; |
| @@ -539,7 +528,7 @@ void UnknownGraph(af::AscGraph &graph) { | |||
| 539 | 528 | ||
| 540 | Store store("store"); | 529 | Store store("store"); |
| 541 | store.x = unknown.y; | 530 | store.x = unknown.y; |
| 542 | - InitStoreNode(store, exec_order, resAxis, af::DT_UINT32, resRepeat, resStride); | 531 | + InitStoreNode(store, resAxis, af::DT_UINT32, resRepeat, resStride); |
| 543 | auto store_node = graph.FindNode("store"); | 532 | auto store_node = graph.FindNode("store"); |
| 544 | SetApiAttr(store_node, af::ApiType::kAPITypeCompute, af::ComputeUnit::kUnitNone); | 533 | SetApiAttr(store_node, af::ApiType::kAPITypeCompute, af::ComputeUnit::kUnitNone); |
| 545 | store_node->attr.sched.loop_axis = x.id; | 534 | store_node->attr.sched.loop_axis = x.id; |
| @@ -548,7 +537,7 @@ void UnknownGraph(af::AscGraph &graph) { | |||
| 548 | 537 | ||
| 549 | Output output("output"); | 538 | Output output("output"); |
| 550 | output.x = store.y; | 539 | output.x = store.y; |
| 551 | - InitOutputNode(output, exec_order, resAxis, af::DT_UINT32, resRepeat, resStride); | 540 | + InitOutputNode(output, resAxis, af::DT_UINT32, resRepeat, resStride); |
| 552 | SetApiAttr(graph.FindNode("output"), af::ApiType::kAPITypeBuffer, af::ComputeUnit::kUnitNone); | 541 | SetApiAttr(graph.FindNode("output"), af::ApiType::kAPITypeBuffer, af::ComputeUnit::kUnitNone); |
| 553 | SetNodeMemAttr(graph.FindNode("output"), tensorID, {"output", 0, 0, 0, -1, -1, false, false}); | 542 | SetNodeMemAttr(graph.FindNode("output"), tensorID, {"output", 0, 0, 0, -1, -1, false, false}); |
| 554 | } | 543 | } |
| @@ -129,8 +129,8 @@ Status Build2DTransposeAscendGraph(af::AscGraph &graph, const std::vector<int64_ | |||
| 129 | 129 | ||
| 130 | auto [z0T, z0t] = graph.TileSplit(z0.id); | 130 | auto [z0T, z0t] = graph.TileSplit(z0.id); |
| 131 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); | 131 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); |
| 132 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z1}, FORMAT_ND); | 132 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z1}, 0, FORMAT_ND); |
| 133 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0, z1}, FORMAT_ND); | 133 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0, z1}, 1, FORMAT_ND); |
| 134 | *data1.repeats = {s0, s1}; | 134 | *data1.repeats = {s0, s1}; |
| 135 | *data2.repeats = {s0, s1}; | 135 | *data2.repeats = {s0, s1}; |
| 136 | *data1.strides = {s1, One}; | 136 | *data1.strides = {s1, One}; |
| @@ -177,8 +177,8 @@ Status Build2DPadAscendGraph(af::AscGraph &graph, const std::vector<int64_t> &pe | |||
| 177 | 177 | ||
| 178 | auto [z0T, z0t] = graph.TileSplit(z0.id); | 178 | auto [z0T, z0t] = graph.TileSplit(z0.id); |
| 179 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); | 179 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); |
| 180 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z1}, FORMAT_ND); | 180 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z1}, 0, FORMAT_ND); |
| 181 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0, z1}, FORMAT_ND); | 181 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0, z1}, 1, FORMAT_ND); |
| 182 | *data1.repeats = {s0, s1}; | 182 | *data1.repeats = {s0, s1}; |
| 183 | *data2.repeats = {s0, s1}; | 183 | *data2.repeats = {s0, s1}; |
| 184 | *data1.strides = {s1, One}; | 184 | *data1.strides = {s1, One}; |
| @@ -222,8 +222,8 @@ Status BuildTransposeSplitAscendGraph(af::AscGraph &graph) { | |||
| 222 | 222 | ||
| 223 | auto [z0T, z0t] = graph.TileSplit(z0.id); | 223 | auto [z0T, z0t] = graph.TileSplit(z0.id); |
| 224 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); | 224 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); |
| 225 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z1, z2}, FORMAT_ND); | 225 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z1, z2}, 0, FORMAT_ND); |
| 226 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0, z1, z2}, FORMAT_ND); | 226 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0, z1, z2}, 1, FORMAT_ND); |
| 227 | *data1.repeats = {s0, s1, s2}; | 227 | *data1.repeats = {s0, s1, s2}; |
| 228 | *data2.repeats = {s0, s1, s2}; | 228 | *data2.repeats = {s0, s1, s2}; |
| 229 | *data1.strides = {s1 * s2, s2, One}; | 229 | *data1.strides = {s1 * s2, s2, One}; |
| @@ -272,8 +272,8 @@ Status BuildTransposeAscendGraph(af::AscGraph &graph, const std::vector<int64_t> | |||
| 272 | 272 | ||
| 273 | auto [z0T, z0t] = graph.TileSplit(z0.id); | 273 | auto [z0T, z0t] = graph.TileSplit(z0.id); |
| 274 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); | 274 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); |
| 275 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z1, z2}, FORMAT_ND); | 275 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z1, z2}, 0, FORMAT_ND); |
| 276 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0, z1, z2}, FORMAT_ND); | 276 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0, z1, z2}, 1, FORMAT_ND); |
| 277 | *data1.repeats = {s0, s1, s2}; | 277 | *data1.repeats = {s0, s1, s2}; |
| 278 | *data2.repeats = {s0, s1, s2}; | 278 | *data2.repeats = {s0, s1, s2}; |
| 279 | *data1.strides = {s1 * s2, s2, One}; | 279 | *data1.strides = {s1 * s2, s2, One}; |
| @@ -324,7 +324,7 @@ Status Build4DTransposeAscendGraph(af::AscGraph &graph, const std::vector<int64_ | |||
| 324 | 324 | ||
| 325 | auto [z0T, z0t] = graph.TileSplit(z0.id); | 325 | auto [z0T, z0t] = graph.TileSplit(z0.id); |
| 326 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); | 326 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); |
| 327 | - auto data = graph.CreateContiguousData("input", DT_FLOAT, {z0, z1, z2, z3}, FORMAT_ND); | 327 | + auto data = graph.CreateContiguousData("input", DT_FLOAT, {z0, z1, z2, z3}, 0, FORMAT_ND); |
| 328 | *data.repeats = {s0, s1, s2, s3}; | 328 | *data.repeats = {s0, s1, s2, s3}; |
| 329 | *data.strides = {s1 * s2 * s3, s2 * s3, s3, One}; | 329 | *data.strides = {s1 * s2 * s3, s2 * s3, s3, One}; |
| 330 | 330 | ||
| @@ -360,8 +360,8 @@ Status BuildFlashSoftmaxAscendGraph(af::AscGraph &graph) { | |||
| 360 | auto nd = graph.CreateAxis("nd", ND); | 360 | auto nd = graph.CreateAxis("nd", ND); |
| 361 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 361 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 362 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 362 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 363 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 363 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 364 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 364 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 365 | LOOP(*ndB) { | 365 | LOOP(*ndB) { |
| 366 | LOOP(*ndbT) { | 366 | LOOP(*ndbT) { |
| 367 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 367 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -391,8 +391,8 @@ Status BuildWorkSpaceAscendGraph(af::AscGraph &graph) { | |||
| 391 | auto nd = graph.CreateAxis("nd", ND); | 391 | auto nd = graph.CreateAxis("nd", ND); |
| 392 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 392 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 393 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 393 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 394 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 394 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 395 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 395 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 396 | LOOP(*ndB) { | 396 | LOOP(*ndB) { |
| 397 | LOOP(*ndbT) { | 397 | LOOP(*ndbT) { |
| 398 | auto load1 = Workspace("workspace1", data1).TQue(Position::kPositionVecIn, 1, 1); | 398 | auto load1 = Workspace("workspace1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -424,7 +424,7 @@ Status BuildTilingBroadcastAscendGraph(af::AscGraph &graph) { | |||
| 424 | auto [rT, rt] = graph.TileSplit(r.id); | 424 | auto [rT, rt] = graph.TileSplit(r.id); |
| 425 | auto [rTB, rTb] = graph.BlockSplit(rT->id); | 425 | auto [rTB, rTb] = graph.BlockSplit(rT->id); |
| 426 | auto [aT, at] = graph.TileSplit(a.id); | 426 | auto [aT, at] = graph.TileSplit(a.id); |
| 427 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {r, a}); | 427 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {r, a}, 0); |
| 428 | LOOP(*rT) { | 428 | LOOP(*rT) { |
| 429 | LOOP(*rTB) { | 429 | LOOP(*rTB) { |
| 430 | LOOP(*rTb) { | 430 | LOOP(*rTb) { |
| @@ -460,7 +460,7 @@ Status BuildHeavyOpTilingAscendGraph(af::AscGraph &graph) { | |||
| 460 | auto [rT, rt] = graph.TileSplit(r.id); | 460 | auto [rT, rt] = graph.TileSplit(r.id); |
| 461 | auto [rTB, rTb] = graph.BlockSplit(rT->id); | 461 | auto [rTB, rTb] = graph.BlockSplit(rT->id); |
| 462 | auto [aT, at] = graph.TileSplit(a.id); | 462 | auto [aT, at] = graph.TileSplit(a.id); |
| 463 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {r, a}); | 463 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {r, a}, 0); |
| 464 | LOOP(*rT) { | 464 | LOOP(*rT) { |
| 465 | LOOP(*rTB) { | 465 | LOOP(*rTB) { |
| 466 | LOOP(*rTb) { | 466 | LOOP(*rTb) { |
| @@ -494,8 +494,8 @@ Status BuildMatMulDemoAscendGraph(af::AscGraph &graph) { | |||
| 494 | auto nd = graph.CreateAxis("nd", ND); | 494 | auto nd = graph.CreateAxis("nd", ND); |
| 495 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 495 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 496 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 496 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 497 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 497 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 498 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 498 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 499 | LOOP(*ndB) { | 499 | LOOP(*ndB) { |
| 500 | LOOP(*ndbT) { | 500 | LOOP(*ndbT) { |
| 501 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 501 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -37,7 +37,7 @@ Status BuildEqAscendGraphND(af::AscGraph &graph) { | |||
| 37 | auto z3 = graph.CreateAxis("z3", s3); | 37 | auto z3 = graph.CreateAxis("z3", s3); |
| 38 | auto [z0T, z0t] = graph.TileSplit(z0.id); | 38 | auto [z0T, z0t] = graph.TileSplit(z0.id); |
| 39 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); | 39 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); |
| 40 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z2, z3}, FORMAT_ND); | 40 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0, z2, z3}, 0, FORMAT_ND); |
| 41 | LOOP(*z0TB) { | 41 | LOOP(*z0TB) { |
| 42 | LOOP(*z0T) { | 42 | LOOP(*z0T) { |
| 43 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 43 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -58,7 +58,7 @@ static Status BuildVectorFuncSubgraph(af::AscGraph &subgraph) { | |||
| 58 | auto nd = subgraph.CreateAxis("nd", ND); | 58 | auto nd = subgraph.CreateAxis("nd", ND); |
| 59 | auto [ndB, ndb] = subgraph.BlockSplit(nd.id); | 59 | auto [ndB, ndb] = subgraph.BlockSplit(nd.id); |
| 60 | auto [ndbT, ndbt] = subgraph.TileSplit(ndb->id); | 60 | auto [ndbT, ndbt] = subgraph.TileSplit(ndb->id); |
| 61 | - auto data1 = subgraph.CreateContiguousData("input1", DT_FLOAT, {*ndbt}); | 61 | + auto data1 = subgraph.CreateContiguousData("input1", DT_FLOAT, {*ndbt}, 0); |
| 62 | auto load1 = Load("load1", data1); | 62 | auto load1 = Load("load1", data1); |
| 63 | auto abs1 = Abs("abs1", load1); | 63 | auto abs1 = Abs("abs1", load1); |
| 64 | auto sub1 = Sub("sub1", abs1, abs1); | 64 | auto sub1 = Sub("sub1", abs1, abs1); |
| @@ -78,8 +78,7 @@ static Status AddVectorFuncToMainGraph(af::AscGraph &graph) { | |||
| 78 | auto z0 = CreateS0Axis(graph); | 78 | auto z0 = CreateS0Axis(graph); |
| 79 | auto [z0B, z0b] = graph.BlockSplit(z0.id); | 79 | auto [z0B, z0b] = graph.BlockSplit(z0.id); |
| 80 | auto [z0bT, z0bt] = graph.TileSplit(z0b->id); | 80 | auto [z0bT, z0bt] = graph.TileSplit(z0b->id); |
| 81 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 81 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 82 | - | ||
| 83 | LOOP(*z0B) { | 82 | LOOP(*z0B) { |
| 84 | LOOP(*z0bT) { | 83 | LOOP(*z0bT) { |
| 85 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 84 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -33,8 +33,8 @@ Status BuildGatherAscendGraphND(AscGraph &graph) { | |||
| 33 | auto nd = graph.CreateAxis("nd", ND); | 33 | auto nd = graph.CreateAxis("nd", ND); |
| 34 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 34 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 35 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 35 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 36 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 36 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 37 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 37 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 38 | LOOP(*ndB) { | 38 | LOOP(*ndB) { |
| 39 | LOOP(*ndbT) { | 39 | LOOP(*ndbT) { |
| 40 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 40 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -66,8 +66,8 @@ Status BuildReduceAscendGraphND(AscGraph &graph) { | |||
| 66 | auto nd = graph.CreateAxis("nd", ND); | 66 | auto nd = graph.CreateAxis("nd", ND); |
| 67 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 67 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 68 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 68 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 69 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 69 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 70 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 70 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 71 | LOOP(*ndB) { | 71 | LOOP(*ndB) { |
| 72 | LOOP(*ndbT) { | 72 | LOOP(*ndbT) { |
| 73 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 73 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -47,8 +47,8 @@ Status BuildAscendGraphTest1(af::AscGraph &graph) { | |||
| 47 | auto nd = graph.CreateAxis("nd", ND); | 47 | auto nd = graph.CreateAxis("nd", ND); |
| 48 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 48 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 49 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 49 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 50 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 50 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 51 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 51 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 52 | GELOGD("axis id = [%d, %d, %d, %d, %d]", nd.id, ndB->id, ndb->id, ndbT->id, ndbt->id); | 52 | GELOGD("axis id = [%d, %d, %d, %d, %d]", nd.id, ndB->id, ndb->id, ndbT->id, ndbt->id); |
| 53 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); | 53 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); |
| 54 | LOOP(*ndB) { | 54 | LOOP(*ndB) { |
| @@ -72,8 +72,8 @@ Status BuildAscendGraphTest2(af::AscGraph &graph) { | |||
| 72 | auto nd = graph.CreateAxis("nd", ND); | 72 | auto nd = graph.CreateAxis("nd", ND); |
| 73 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 73 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 74 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 74 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 75 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 75 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 76 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 76 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 77 | LOOP(*ndB) { | 77 | LOOP(*ndB) { |
| 78 | LOOP(*ndbT) { | 78 | LOOP(*ndbT) { |
| 79 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 79 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -97,8 +97,8 @@ Status BuildAscendGraphTest3(af::AscGraph &graph) { | |||
| 97 | auto nd = graph.CreateAxis("nd", ND); | 97 | auto nd = graph.CreateAxis("nd", ND); |
| 98 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 98 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 99 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 99 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 100 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 100 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 101 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 101 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 102 | LOOP(*ndB) { | 102 | LOOP(*ndB) { |
| 103 | LOOP(*ndbT) { | 103 | LOOP(*ndbT) { |
| 104 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 104 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -120,8 +120,8 @@ Status BuildAscendGraphTest4(af::AscGraph &graph) { | |||
| 120 | auto nd = graph.CreateAxis("nd", ND); | 120 | auto nd = graph.CreateAxis("nd", ND); |
| 121 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 121 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 122 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 122 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 123 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 123 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 124 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 124 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 125 | LOOP(*ndB) { | 125 | LOOP(*ndB) { |
| 126 | LOOP(*ndbT) { | 126 | LOOP(*ndbT) { |
| 127 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 127 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -143,8 +143,8 @@ Status BuildAscendGraphTest5(af::AscGraph &graph) { | |||
| 143 | auto nd = graph.CreateAxis("nd", ND); | 143 | auto nd = graph.CreateAxis("nd", ND); |
| 144 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 144 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 145 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 145 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 146 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT16, {nd}); | 146 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT16, {nd}, 0); |
| 147 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 147 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 148 | LOOP(*ndB) { | 148 | LOOP(*ndB) { |
| 149 | LOOP(*ndbT) { | 149 | LOOP(*ndbT) { |
| 150 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 150 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -171,8 +171,8 @@ Status BuildAscendGraphTest6(af::AscGraph &graph) { | |||
| 171 | auto [ndTB, ndTb] = graph.BlockSplit(ndt->id); | 171 | auto [ndTB, ndTb] = graph.BlockSplit(ndt->id); |
| 172 | std::swap(ndTB->id, ndT->id); | 172 | std::swap(ndTB->id, ndT->id); |
| 173 | std::swap(ndTb->id, ndt->id); | 173 | std::swap(ndTb->id, ndt->id); |
| 174 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 174 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 175 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 175 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 176 | GELOGD("axis id = [%d, %d, %d, %d, %d]", nd.id, ndT->id, ndt->id, ndTB->id, ndTb->id); | 176 | GELOGD("axis id = [%d, %d, %d, %d, %d]", nd.id, ndT->id, ndt->id, ndTB->id, ndTb->id); |
| 177 | GELOGD("axis id = [%d, %d]", ndTB->id, ndT->id); | 177 | GELOGD("axis id = [%d, %d]", ndTB->id, ndT->id); |
| 178 | LOOP(*ndTB) { | 178 | LOOP(*ndTB) { |
| @@ -196,8 +196,8 @@ Status BuildAscendGraphTest1_Equal(af::AscGraph &graph) { | |||
| 196 | auto z0 = graph.CreateAxis("z0", S0); | 196 | auto z0 = graph.CreateAxis("z0", S0); |
| 197 | auto [ndB, ndb] = graph.BlockSplit(z0.id); | 197 | auto [ndB, ndb] = graph.BlockSplit(z0.id); |
| 198 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 198 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 199 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 199 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 200 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}); | 200 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}, 1); |
| 201 | GELOGD("axis id = [%d, %d, %d, %d, %d]", z0.id, ndB->id, ndb->id, ndbT->id, ndbt->id); | 201 | GELOGD("axis id = [%d, %d, %d, %d, %d]", z0.id, ndB->id, ndb->id, ndbT->id, ndbt->id); |
| 202 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); | 202 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); |
| 203 | LOOP(*ndB) { | 203 | LOOP(*ndB) { |
| @@ -220,8 +220,8 @@ Status BuildAscendGraphTest7_AddDefaultInput(af::AscGraph &graph) { | |||
| 220 | auto z0 = graph.CreateAxis("z0", S0); | 220 | auto z0 = graph.CreateAxis("z0", S0); |
| 221 | auto [ndB, ndb] = graph.BlockSplit(z0.id); | 221 | auto [ndB, ndb] = graph.BlockSplit(z0.id); |
| 222 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 222 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 223 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 223 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 224 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}); | 224 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}, 1); |
| 225 | GELOGD("axis id = [%d, %d, %d, %d, %d]", z0.id, ndB->id, ndb->id, ndbT->id, ndbt->id); | 225 | GELOGD("axis id = [%d, %d, %d, %d, %d]", z0.id, ndB->id, ndb->id, ndbT->id, ndbt->id); |
| 226 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); | 226 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); |
| 227 | LOOP(*ndB) { | 227 | LOOP(*ndB) { |
| @@ -245,8 +245,8 @@ Status BuildAscendGraphTest7_AddSwapInput(af::AscGraph &graph) { | |||
| 245 | auto z1 = graph.CreateAxis("z1", S1); | 245 | auto z1 = graph.CreateAxis("z1", S1); |
| 246 | auto [ndB, ndb] = graph.BlockSplit(z0.id); | 246 | auto [ndB, ndb] = graph.BlockSplit(z0.id); |
| 247 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 247 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 248 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 248 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 249 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z1}); | 249 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z1}, 1); |
| 250 | GELOGD("axis id = [%d, %d, %d, %d, %d]", z0.id, ndB->id, ndb->id, ndbT->id, ndbt->id); | 250 | GELOGD("axis id = [%d, %d, %d, %d, %d]", z0.id, ndB->id, ndb->id, ndbT->id, ndbt->id); |
| 251 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); | 251 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); |
| 252 | LOOP(*ndB) { | 252 | LOOP(*ndB) { |
| @@ -269,8 +269,8 @@ Status BuildAscendGraphTest1_ConstND(af::AscGraph &graph) { | |||
| 269 | auto nd = graph.CreateAxis("nd", ND); | 269 | auto nd = graph.CreateAxis("nd", ND); |
| 270 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 270 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 271 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 271 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 272 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 272 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 273 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}); | 273 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {nd}, 1); |
| 274 | GELOGD("axis id = [%d, %d, %d, %d, %d]", nd.id, ndB->id, ndb->id, ndbT->id, ndbt->id); | 274 | GELOGD("axis id = [%d, %d, %d, %d, %d]", nd.id, ndB->id, ndb->id, ndbT->id, ndbt->id); |
| 275 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); | 275 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); |
| 276 | LOOP(*ndB) { | 276 | LOOP(*ndB) { |
| @@ -294,8 +294,8 @@ Status BuildAscendGraphTest1_EqualValue(af::AscGraph &graph) { | |||
| 294 | auto z0 = graph.CreateAxis("z0", S0); | 294 | auto z0 = graph.CreateAxis("z0", S0); |
| 295 | auto [ndB, ndb] = graph.BlockSplit(z0.id); | 295 | auto [ndB, ndb] = graph.BlockSplit(z0.id); |
| 296 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 296 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 297 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 297 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 298 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}); | 298 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}, 1); |
| 299 | GELOGD("axis id = [%d, %d, %d, %d, %d]", z0.id, ndB->id, ndb->id, ndbT->id, ndbt->id); | 299 | GELOGD("axis id = [%d, %d, %d, %d, %d]", z0.id, ndB->id, ndb->id, ndbT->id, ndbt->id); |
| 300 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); | 300 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); |
| 301 | LOOP(*ndB) { | 301 | LOOP(*ndB) { |
| @@ -319,8 +319,8 @@ Status BuildAscendGraphTest1_NotEqualValue(af::AscGraph &graph) { | |||
| 319 | auto z0 = graph.CreateAxis("z0", S0); | 319 | auto z0 = graph.CreateAxis("z0", S0); |
| 320 | auto [ndB, ndb] = graph.BlockSplit(z0.id); | 320 | auto [ndB, ndb] = graph.BlockSplit(z0.id); |
| 321 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 321 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 322 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 322 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 323 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}); | 323 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z0}, 1); |
| 324 | GELOGD("axis id = [%d, %d, %d, %d, %d]", z0.id, ndB->id, ndb->id, ndbT->id, ndbt->id); | 324 | GELOGD("axis id = [%d, %d, %d, %d, %d]", z0.id, ndB->id, ndb->id, ndbT->id, ndbt->id); |
| 325 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); | 325 | GELOGD("axis id = [%d, %d]", ndB->id, ndbT->id); |
| 326 | LOOP(*ndB) { | 326 | LOOP(*ndB) { |
| @@ -366,8 +366,8 @@ Status BuildAscendGraphTest1_InputAxes1(af::AscGraph &graph) { | |||
| 366 | auto z2 = graph.CreateAxis("z2", S2); // 2 | 366 | auto z2 = graph.CreateAxis("z2", S2); // 2 |
| 367 | auto [ndB, ndb] = graph.BlockSplit(z0.id); // 3,4 | 367 | auto [ndB, ndb] = graph.BlockSplit(z0.id); // 3,4 |
| 368 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); // 5,6 | 368 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); // 5,6 |
| 369 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 369 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 370 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z1}); | 370 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z1}, 1); |
| 371 | LOOP(*ndB) { | 371 | LOOP(*ndB) { |
| 372 | LOOP(*ndbT) { | 372 | LOOP(*ndbT) { |
| 373 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 373 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -393,8 +393,8 @@ Status BuildAscendGraphTest1_InputAxes2(af::AscGraph &graph) { | |||
| 393 | auto z2 = graph.CreateAxis("z2", S2); // 2 | 393 | auto z2 = graph.CreateAxis("z2", S2); // 2 |
| 394 | auto [ndB, ndb] = graph.BlockSplit(z0.id); // 3,4 | 394 | auto [ndB, ndb] = graph.BlockSplit(z0.id); // 3,4 |
| 395 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); // 5,6 | 395 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); // 5,6 |
| 396 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 396 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 397 | - auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z1}); | 397 | + auto data2 = graph.CreateContiguousData("input2", DT_FLOAT, {z1}, 1); |
| 398 | LOOP(*ndB) { | 398 | LOOP(*ndB) { |
| 399 | LOOP(*ndbT) { | 399 | LOOP(*ndbT) { |
| 400 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 400 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -22,7 +22,7 @@ Status ConstructSimpleLoadStoreOp(af::AscGraph &graph) { | |||
| 22 | auto nd = graph.CreateAxis("nd", ND); | 22 | auto nd = graph.CreateAxis("nd", ND); |
| 23 | auto [ndB, ndb] = graph.BlockSplit(nd.id); | 23 | auto [ndB, ndb] = graph.BlockSplit(nd.id); |
| 24 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); | 24 | auto [ndbT, ndbt] = graph.TileSplit(ndb->id); |
| 25 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}); | 25 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {nd}, 0); |
| 26 | LOOP(*ndB) { | 26 | LOOP(*ndB) { |
| 27 | LOOP(*ndbT) { | 27 | LOOP(*ndbT) { |
| 28 | auto load1 = Load("load", data1).TQue(Position::kPositionVecIn, 1, 1); | 28 | auto load1 = Load("load", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -53,7 +53,7 @@ Status BuildConcatGroupAscendGraphS0S1ReduceMultiTiling(af::AscGraph &graph) { | |||
| 53 | auto [s1T, s1t] = graph.TileSplit(s1.id); | 53 | auto [s1T, s1t] = graph.TileSplit(s1.id); |
| 54 | auto s1Ts0T = *graph.MergeAxis({s1T->id, s0T->id}); | 54 | auto s1Ts0T = *graph.MergeAxis({s1T->id, s0T->id}); |
| 55 | auto [s1Ts0TB, s1Ts0Tb] = graph.BlockSplit(s1Ts0T.id); | 55 | auto [s1Ts0TB, s1Ts0Tb] = graph.BlockSplit(s1Ts0T.id); |
| 56 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {s0, s1}); | 56 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {s0, s1}, 0); |
| 57 | LOOP(*s1Ts0TB) { | 57 | LOOP(*s1Ts0TB) { |
| 58 | LOOP(*s1Ts0Tb) { | 58 | LOOP(*s1Ts0Tb) { |
| 59 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 59 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -195,7 +195,7 @@ Status BuildVectorFunctionSubgraph(af::AscGraph &subgraph) { | |||
| 195 | auto nd = subgraph.CreateAxis("nd", ND); | 195 | auto nd = subgraph.CreateAxis("nd", ND); |
| 196 | auto [ndB, ndb] = subgraph.BlockSplit(nd.id); | 196 | auto [ndB, ndb] = subgraph.BlockSplit(nd.id); |
| 197 | auto [ndbT, ndbt] = subgraph.TileSplit(ndb->id); | 197 | auto [ndbT, ndbt] = subgraph.TileSplit(ndb->id); |
| 198 | - auto data1 = subgraph.CreateContiguousData("input1", DT_FLOAT, {*ndbt}); | 198 | + auto data1 = subgraph.CreateContiguousData("input1", DT_FLOAT, {*ndbt}, 0); |
| 199 | auto load1 = Load("load1", data1); | 199 | auto load1 = Load("load1", data1); |
| 200 | auto abs1 = Abs("abs1", load1); | 200 | auto abs1 = Abs("abs1", load1); |
| 201 | auto sub1 = Sub("sub1", abs1, abs1); | 201 | auto sub1 = Sub("sub1", abs1, abs1); |
| @@ -225,8 +225,7 @@ static Status BuildVectorFuncGraphS0(af::AscGraph &graph) { | |||
| 225 | auto z0 = graph.CreateAxis("z0", S0); | 225 | auto z0 = graph.CreateAxis("z0", S0); |
| 226 | auto [z0B, z0b] = graph.BlockSplit(z0.id); | 226 | auto [z0B, z0b] = graph.BlockSplit(z0.id); |
| 227 | auto [z0bT, z0bt] = graph.TileSplit(z0b->id); | 227 | auto [z0bT, z0bt] = graph.TileSplit(z0b->id); |
| 228 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 228 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 229 | - | ||
| 230 | LOOP(*z0B) { | 229 | LOOP(*z0B) { |
| 231 | LOOP(*z0bT) { | 230 | LOOP(*z0bT) { |
| 232 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 231 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -251,8 +250,7 @@ static Status BuildVectorFuncGraphS0V1(af::AscGraph &graph) { | |||
| 251 | auto z0 = graph.CreateAxis("z0", S0); | 250 | auto z0 = graph.CreateAxis("z0", S0); |
| 252 | auto [z0T, z0t] = graph.TileSplit(z0.id); | 251 | auto [z0T, z0t] = graph.TileSplit(z0.id); |
| 253 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); | 252 | auto [z0TB, z0Tb] = graph.BlockSplit(z0T->id); |
| 254 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 253 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 255 | - | ||
| 256 | LOOP(*z0TB) { | 254 | LOOP(*z0TB) { |
| 257 | LOOP(*z0Tb) { | 255 | LOOP(*z0Tb) { |
| 258 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 256 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -313,8 +311,7 @@ Status BuildTwoGroupTestAscGraphCommon(af::AscGraph &graph, const std::string &z | |||
| 313 | auto [z0z1TB, z0z1Tb] = graph.BlockSplit(z0z1T->id); | 311 | auto [z0z1TB, z0z1Tb] = graph.BlockSplit(z0z1T->id); |
| 314 | 312 | ||
| 315 | std::vector<af::Axis> axes = {z0_axis, z1}; | 313 | std::vector<af::Axis> axes = {z0_axis, z1}; |
| 316 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, axes); | 314 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, axes, 0); |
| 317 | - | ||
| 318 | LOOP(*z0z1TB) { | 315 | LOOP(*z0z1TB) { |
| 319 | LOOP(*z0z1Tb) { | 316 | LOOP(*z0z1Tb) { |
| 320 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 317 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |
| @@ -30,7 +30,7 @@ Status BuildVectorFunctionSubgraph(af::AscGraph &subgraph) { | |||
| 30 | auto nd = subgraph.CreateAxis("nd", ND); | 30 | auto nd = subgraph.CreateAxis("nd", ND); |
| 31 | auto [ndB, ndb] = subgraph.BlockSplit(nd.id); | 31 | auto [ndB, ndb] = subgraph.BlockSplit(nd.id); |
| 32 | auto [ndbT, ndbt] = subgraph.TileSplit(ndb->id); | 32 | auto [ndbT, ndbt] = subgraph.TileSplit(ndb->id); |
| 33 | - auto data1 = subgraph.CreateContiguousData("input1", DT_FLOAT, {*ndbt}); | 33 | + auto data1 = subgraph.CreateContiguousData("input1", DT_FLOAT, {*ndbt}, 0); |
| 34 | auto load1 = Load("load1", data1); | 34 | auto load1 = Load("load1", data1); |
| 35 | auto abs1 = Abs("abs1", load1); | 35 | auto abs1 = Abs("abs1", load1); |
| 36 | auto sub1 = Sub("sub1", abs1, abs1); | 36 | auto sub1 = Sub("sub1", abs1, abs1); |
| @@ -44,7 +44,7 @@ Status BuildConcatGroupAscendGraphS0WithVectorFunc(af::AscGraph &graph) { | |||
| 44 | auto z0 = graph.CreateAxis("z0", S0); | 44 | auto z0 = graph.CreateAxis("z0", S0); |
| 45 | auto [z0B, z0b] = graph.BlockSplit(z0.id); | 45 | auto [z0B, z0b] = graph.BlockSplit(z0.id); |
| 46 | auto [z0bT, z0bt] = graph.TileSplit(z0b->id); | 46 | auto [z0bT, z0bt] = graph.TileSplit(z0b->id); |
| 47 | - auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}); | 47 | + auto data1 = graph.CreateContiguousData("input1", DT_FLOAT, {z0}, 0); |
| 48 | LOOP(*z0B) { | 48 | LOOP(*z0B) { |
| 49 | LOOP(*z0bT) { | 49 | LOOP(*z0bT) { |
| 50 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); | 50 | auto load1 = Load("load1", data1).TQue(Position::kPositionVecIn, 1, 1); |