Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions paddle/cinn/adt/m_ir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,11 @@ std::unordered_map<Index, LoopIterators> GenerateAnchorIndex2LoopIterators(
const auto& anchor_tensor = GetAnchorTensor(anchor_group);
const auto& anchor_loop_iters = GetAnchorTensorLoopIterators(
anchor_tensor, loop_iters, TensorIndexExpr4Tensor);
CHECK(anchor_index2loop_iters.emplace(anchor_index, anchor_loop_iters)
.second);
PADDLE_ENFORCE_EQ(
anchor_index2loop_iters.emplace(anchor_index, anchor_loop_iters).second,
true,
phi::errors::AlreadyExists("The anchor index has already "
"been associated with loop iters."));
}
return anchor_index2loop_iters;
}
Expand Down
28 changes: 22 additions & 6 deletions paddle/cinn/hlir/op/op_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ CINNSchedule GetElementwiseScheduleFunc(
const Target& target,
bool vectorizable) {
return CINNSchedule([=](lang::Args args, lang::RetValue* ret) {
CHECK(!args.empty()) << "The input argument of ElementwiseSchedule is "
"empty! Please check.\n";
PADDLE_ENFORCE_NE(args.empty(),
true,
phi::errors::InvalidArgument(
"The input argument of ElementwiseSchedule is "
"invalid! Please check.\n"));
cinn::common::CINNValuePack arg_pack = args[0];
PADDLE_ENFORCE_GT(arg_pack.size(),
0U,
Expand All @@ -45,7 +48,12 @@ CINNSchedule GetElementwiseScheduleFunc(
vec_ast.emplace_back(temp);
}
}
CHECK(!vec_ast.empty());
PADDLE_ENFORCE_NE(vec_ast.empty(),
true,
phi::errors::InvalidArgument(
"The vector of AbstractSyntaxTree is empty!"
"Please ensure that the argument pack "
"contains at least one valid expression."));
ir::ModuleExpr mod_expr(vec_ast);
ir::IRSchedule ir_sch(mod_expr);
ir_sch.MergeExprs();
Expand All @@ -61,8 +69,11 @@ CINNSchedule GetInjectiveScheduleFunc(
const Target& target,
bool vectorizable) {
return CINNSchedule([=](lang::Args args, lang::RetValue* ret) {
CHECK(!args.empty()) << "The input argument of InjectiveSchedule is "
"empty! Please check.\n";
PADDLE_ENFORCE_NE(args.empty(),
true,
phi::errors::InvalidArgument(
"The input argument of InjectiveSchedule is "
"invalid! Please check.\n"));
cinn::common::CINNValuePack arg_pack = args[0];
std::vector<Expr> vec_ast;
for (int i = 0; i < arg_pack.size(); i++) {
Expand All @@ -71,7 +82,12 @@ CINNSchedule GetInjectiveScheduleFunc(
vec_ast.emplace_back(temp);
}
}
CHECK(!vec_ast.empty());
PADDLE_ENFORCE_NE(vec_ast.empty(),
true,
phi::errors::InvalidArgument(
"The vector of AbstractSyntaxTree is empty!"
"Please ensure that the argument pack "
"contains at least one valid expression."));
ir::ModuleExpr mod_expr(vec_ast);
ir::IRSchedule ir_sch(mod_expr);
ir_sch.MergeExprs();
Expand Down