forked from PaddlePaddle/Paddle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CINN] Strong constraint branch adapt to pir (PaddlePaddle#58993)
* Strong Constraint Branch * NoInlineTranslator (PaddlePaddle#84) * Adapt adt to pir * Move FLAGS_cinn_enable_map_expr_schedule location * Apply new group schedule * Remove useless log * Remove adt unittest * Solve merge conflicts * Fix typo * Fix merge conflicts * Add unit test * Fix cmake * Add test_cinn_sub_graph_map_expr * Save current workspace * Remove unittest to cinn directory * Refactor unittest cmake * Refactor unittest cmake * Add unit test at Cmake * Restore test_cinn_sub_graph.py * Fix unittest * Refine codes according to comment * Refine codes according to comment
- Loading branch information
Showing
44 changed files
with
752 additions
and
818 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,39 @@ | ||
add_subdirectory(print_utils) | ||
if(NOT CINN_ONLY) | ||
add_subdirectory(print_utils) | ||
|
||
core_gather_headers() | ||
core_gather_headers() | ||
|
||
gather_srcs( | ||
cinnapi_src | ||
SRCS | ||
anchor_sd_equation_context.cc | ||
equation_function.cc | ||
equation_solver.cc | ||
equation_value.cc | ||
generate_map_expr.cc | ||
get_sub_reshape_dim_ranges.cc | ||
igroup.cc | ||
index_expr_infer_context.cc | ||
kgroup.cc | ||
m_ir.cc | ||
naive_bidirection_equation_generator.cc | ||
naive_op_equation_context.cc | ||
partition_op_stmts.cc | ||
schedule_descriptor.cc | ||
schedule_dim.cc | ||
schedule_mesh.cc | ||
simplify_value.cc | ||
write_broadcast_disabled_bidirection_equation_generator.cc) | ||
gather_srcs( | ||
cinnapi_src | ||
SRCS | ||
adapter_tensor.cc | ||
anchor_sd_equation_context.cc | ||
equation_function.cc | ||
equation_solver.cc | ||
equation_value.cc | ||
generate_map_expr.cc | ||
get_sub_reshape_dim_ranges.cc | ||
igroup.cc | ||
index_expr_infer_context.cc | ||
kgroup.cc | ||
m_ir.cc | ||
naive_bidirection_equation_generator.cc | ||
naive_op_equation_context.cc | ||
partition_op_stmts.cc | ||
schedule_descriptor.cc | ||
schedule_dim.cc | ||
schedule_mesh.cc | ||
simplify_value.cc | ||
write_broadcast_disabled_bidirection_equation_generator.cc) | ||
|
||
cinn_cc_test(equation_value_match_trait_test SRCS | ||
equation_value_match_trait_test.cc DEPS gtest glog) | ||
cinn_cc_test(equation_value_match_trait_test SRCS | ||
equation_value_match_trait_test.cc DEPS gtest glog) | ||
|
||
cinn_cc_test(tree_test SRCS tree_test.cc DEPS gtest glog) | ||
cinn_cc_test(tree_test SRCS tree_test.cc DEPS gtest glog) | ||
|
||
cinn_cc_test(inline_translator_test SRCS inline_translator_test.cc DEPS | ||
cinncore) | ||
cinn_cc_test(inline_translator_test SRCS inline_translator_test.cc DEPS | ||
cinncore) | ||
|
||
message(STATUS "ADT srcs: ${cinnapi_src}") | ||
message(STATUS "ADT srcs: ${cinnapi_src}") | ||
|
||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "paddle/cinn/adt/adapter_tensor.h" | ||
#include "glog/logging.h" | ||
#include "paddle/cinn/hlir/framework/pir/utils.h" | ||
|
||
namespace cinn::adt::adapter { | ||
|
||
std::size_t Tensor::GetRank() const { | ||
return cinn::hlir::framework::pir::CompatibleInfo::ValueShape(node_data) | ||
.size(); | ||
} | ||
|
||
std::vector<int32_t> Tensor::GetShape() const { | ||
std::vector<int32_t> ret{}; | ||
for (int dim_size : | ||
cinn::hlir::framework::pir::CompatibleInfo::ValueShape(node_data)) { | ||
ret.emplace_back(dim_size); | ||
} | ||
return ret; | ||
} | ||
|
||
std::size_t Tensor::GetNumel() const { | ||
std::size_t ret = 1; | ||
for (int dim_size : | ||
cinn::hlir::framework::pir::CompatibleInfo::ValueShape(node_data)) { | ||
ret = ret * dim_size; | ||
} | ||
return ret; | ||
} | ||
|
||
} // namespace cinn::adt::adapter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.