Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
2 changes: 1 addition & 1 deletion paddle/cinn/adt/adt.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ struct Ok final {
bool operator!=(const Ok&) const { return false; }
};

#define ADT_TODO() LOG(FATAL) << "TODO"
#define ADT_TODO() CINN_THROW("TODO")

inline std::size_t hash_combine(std::size_t lhs, std::size_t rhs) {
return lhs ^= rhs + 0x9e3779b9 + (lhs << 6) + (lhs >> 2);
Expand Down
2 changes: 1 addition & 1 deletion paddle/cinn/adt/equation_solver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void CheckEquationsSolvable(
[&](const auto& opt_old_value, const auto& simplified_value) {
LOG(ERROR) << "old_value: " << ToTxtString(opt_old_value);
LOG(ERROR) << "simplified_value: " << ToTxtString(simplified_value);
LOG(FATAL) << "CheckEquationsSolvable Failed";
CINN_THROW("CheckEquationsSolvable Failed");
return tValueInferSuccess<bool>{false};
});
};
Expand Down
2 changes: 1 addition & 1 deletion paddle/cinn/adt/get_sub_reshape_dim_ranges.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ GetSubReshapeDimRanges(const List<DimExpr>& lhs_dims,
} else if (LhsAcc() > RhsAcc()) {
rhs_end++;
} else {
LOG(FATAL) << "Dead code";
CINN_THROW("Dead code");
}
}
CHECK(lhs_end == lhs_dims->size() && rhs_end == rhs_dims->size());
Expand Down
4 changes: 2 additions & 2 deletions paddle/cinn/adt/igroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ List<Iterator> IGroup::GetIndexIterators(const Index& index) const {
} else if (arg_pos.Has<Undefined>()) {
// do nothing
} else {
LOG(FATAL) << "Dead code";
CINN_THROW("Dead code");
}
}
LOG(FATAL) << "Can not find anchor iterators";
CINN_THROW("Can not find anchor iterators");
}

} // namespace cinn::adt
6 changes: 3 additions & 3 deletions paddle/cinn/adt/m_ir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ void CollectTensorIndexIterators(const TensorIndexExpr& tensor_index_expr,

void CollectTensorIndexIteratorsImpl(const Undefined& tensor_index_expr,
std::unordered_set<Iterator>* ret) {
LOG(FATAL) << "Not Implemented";
CINN_THROW("Not Implemented");
}

void CollectTensorIndexIteratorsImpl(const Ok& ok,
std::unordered_set<Iterator>* ret) {
LOG(FATAL) << "Not Implemented";
CINN_THROW("Not Implemented");
}

void CollectTensorIndexIteratorsImpl(const Iterator& iterator,
Expand Down Expand Up @@ -134,7 +134,7 @@ LoopIterators GetAnchorTensorLoopIterators(
namespace {

Tensor GetTensorImpl(const OpStmt& op_stmt, const Undefined& undefined) {
LOG(FATAL) << "position not found";
CINN_THROW("position not found");
}

Tensor GetTensorImpl(const OpStmt& op_stmt, const tIn<std::size_t>& pos) {
Expand Down
2 changes: 1 addition & 1 deletion paddle/cinn/adt/naive_op_equation_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ std::optional<std::int64_t> GetArgDimSizeImpl(
const Undefined&,
const GetArgStaticDimT& GetInDim,
const GetArgStaticDimT& GetOutDim) {
LOG(FATAL) << "position not found";
CINN_THROW("position not found");
}

std::optional<std::int64_t> GetArgDimSize(const OpArgDimPos& arg_dim_pos,
Expand Down
2 changes: 1 addition & 1 deletion paddle/cinn/adt/print_utils/print_map_expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ std::string ToTxtStringImpl(const adapter::DynamicTensor& tensor) {
}

std::string ToTxtStringImpl(const TempStorage& tensor) {
LOG(FATAL) << "Not supported yet";
CINN_THROW("Not supported yet");
}

} // namespace
Expand Down
4 changes: 2 additions & 2 deletions paddle/cinn/adt/schedule_dim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ List<int> GetReduceAxis(const List<ScheduleDim>& loop_sizes) {
} else if (sched_dim.Has<tInjective<LoopSize>>()) {
// do nothing
} else {
LOG(FATAL) << "Dead code";
CINN_THROW("Dead code");
}
}
return reduce_axis;
Expand All @@ -203,7 +203,7 @@ List<int> GetInjectiveAxis(const List<ScheduleDim>& loop_sizes) {
} else if (sched_dim.Has<tInjective<LoopSize>>()) {
injective_axis->emplace_back(i);
} else {
LOG(FATAL) << "Dead code";
CINN_THROW("Dead code");
}
}
return injective_axis;
Expand Down
2 changes: 1 addition & 1 deletion paddle/cinn/adt/schedule_mesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ std::tuple<ScheduleMesh, List<LoopType>> CreateOptimizedScheduleMesh(
return policy->Optimize(loop_sizes);
}
}
LOG(FATAL) << "Dead code, no valid schedule mesh policy found";
CINN_THROW("Dead code, no valid schedule mesh policy found");
}

ScheduleMesh MeshReshape(const ScheduleMesh& sched_mesh,
Expand Down
6 changes: 3 additions & 3 deletions paddle/cinn/adt/simplify_value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct SimplifyRedundantBroadcastedIterator {
const auto& simplified_bd = DimExpr{symbol::SimplifyDimExpr(bd)};
return BroadcastedIterator<Value, DimExpr>{inner_iterator, simplified_bd};
}
LOG(FATAL) << "Dead code";
CINN_THROW("Dead code");
}
};

Expand Down Expand Up @@ -368,7 +368,7 @@ struct SymbolicDim_SimplifyDotUndot {
return IndexDotValue<Value, List<DimExpr>>{
SimplifyValue(list_get_item_values, ctx), dot_dims};
}
LOG(FATAL) << "Dead code";
CINN_THROW("Dead code");
}
};

Expand Down Expand Up @@ -415,7 +415,7 @@ struct SymbolicDim_SimplifyDotUndot_DimExpr {
return IndexDotValue<Value, List<DimExpr>>{
SimplifyValue(list_get_item_values, ctx), dot_dims};
}
LOG(FATAL) << "Dead code";
CINN_THROW("Dead code");
}
};

Expand Down
4 changes: 2 additions & 2 deletions paddle/cinn/adt/tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#pragma once

#include <optional>

#include "paddle/cinn/adt/adt.h"
#include "paddle/cinn/adt/tags.h"
#include "paddle/cinn/utils/error.h"

namespace cinn::adt {

Expand Down Expand Up @@ -144,7 +144,7 @@ List<typename TreeMergerT::tree_type> MergeTwoInnerTreeImpl(
List<TreeT>{new_lhs, new_rhs});
return List<TreeT>{ret};
} else {
LOG(FATAL) << "Dead code";
CINN_THROW("Dead code");
}
}

Expand Down
2 changes: 1 addition & 1 deletion paddle/cinn/auto_schedule/database/database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ std::unique_ptr<Database> Database::Make(const DatabaseConfig& config) {
config.capacity_per_task, config.record_file_path, true);
}

LOG(FATAL) << "Unimplemented database type.";
CINN_THROW("Unimplemented database type.");
return nullptr;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ReductionFactoring : public AutoGenRule {
}
// In the future, we will no longer use this interface.
void Apply(int index) override {
LOG(FATAL) << "This is a deprecated interface, please do not use it.";
CINN_THROW("This is a deprecated interface, please do not use it.");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void MemoryCopy(const float* src, float* dst, int numel, std::string type) {
dst[i] = src[i];
}
} else {
LOG(FATAL) << "Unknown memory copy type";
CINN_THROW("Unknown memory copy type");
}
}

Expand Down
4 changes: 3 additions & 1 deletion paddle/cinn/auto_schedule/search_space/block_sampler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ std::unique_ptr<BlockSampler> BlockSampler::Make(
all_blocks, default_remove_policy, rand_seed, weights);
}

LOG(FATAL) << "Unimplemented strategy:" << strategy;
std::stringstream ss;
ss << "Unimplemented strategy:" << strategy;
CINN_THROW(ss.str());
return nullptr;
}

Expand Down
4 changes: 3 additions & 1 deletion paddle/cinn/auto_schedule/search_space/rule_sampler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ std::unique_ptr<RuleSampler> RuleSampler::Make(
potential_rules, default_remove_policy, rand_seed, weights);
}

LOG(FATAL) << "Unimplemented strategy:" << strategy;
std::stringstream ss;
ss << "Unimplemented strategy:" << strategy;
CINN_THROW(ss.str());
return nullptr;
}

Expand Down
2 changes: 1 addition & 1 deletion paddle/cinn/auto_schedule/search_space/search_space.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ std::vector<SearchState> SearchSpace::GenerateSketches(
} else if (strategy == "random_prune") {
sketches = InitSketchWithRandomPrunedStrategy();
} else {
LOG(FATAL) << "Unimplemented init sketch strategy";
CINN_THROW("Unimplemented init sketch strategy");
}

// the more rules are applied, the greater the possibility of good results,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ std::unique_ptr<MutateRule> MutateRule::Make(const std::string& name) {
if (name == "mutate_tile_size") {
return std::make_unique<MutateTileSize>();
} else {
LOG(FATAL) << "MutateRule " << name << " is not supported.";
std::stringstream ss;
ss << "MutateRule " << name << " is not supported.";
CINN_THROW(ss.str());
}
return nullptr;
}
Expand Down
4 changes: 3 additions & 1 deletion paddle/cinn/auto_schedule/task_scheduler/task_scheduler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ std::unique_ptr<TaskScheduler> TaskScheduler::Make(
return std::make_unique<EfficiencyPriority>(tasks, config);
}

LOG(FATAL) << "Unimplemented strategy:" << strategy;
std::stringstream ss;
ss << "Unimplemented strategy:" << strategy;
CINN_THROW(ss.str());
return nullptr;
}

Expand Down
13 changes: 8 additions & 5 deletions paddle/cinn/backends/codegen_c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ std::string CodeGenC::Compile(const ir::Module &module,
Compile(func);
}
} else {
LOG(FATAL) << "Not supported OutputKind";
CINN_THROW("Not supported OutputKind");
}
return str_;
}
Expand Down Expand Up @@ -526,8 +526,9 @@ void CodeGenC::Visit(const ir::Let *op) {
}

void CodeGenC::Visit(const ir::Reduce *op) {
LOG(FATAL) << "Reduce IR is just for internal representation, should not be "
"used for CodeGen.";
CINN_THROW(
"Reduce IR is just for internal representation, should not be "
"used for CodeGen.");
}

void CodeGenC::Visit(const ir::Ramp *op) {
Expand Down Expand Up @@ -731,7 +732,7 @@ void CodeGenC::PrintRuntimeType(const cinn_type_t &type) {
} else if (type == cinn_float64_t()) {
str_ += "cinn_float64_t()";
} else {
LOG(FATAL) << "Unknown type is not supported to print";
CINN_THROW("Unknown type is not supported to print");
}
}

Expand Down Expand Up @@ -806,7 +807,9 @@ void CodeGenC::Visit(const ir::intrinsics::PodValueToX *op) {
} else if (to_type == type_of<cinn_buffer_t *>()) {
str_ += runtime::intrinsic::pod_value_to_buffer_p;
} else {
LOG(FATAL) << "Not supported type: " << to_type;
std::stringstream ss;
ss << "Not supported type: " << to_type;
CINN_THROW(ss.str());
}

str_ += "(";
Expand Down
8 changes: 5 additions & 3 deletions paddle/cinn/backends/codegen_cuda_dev.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ std::string CodeGenCUDA_Dev::Compile(const ir::Module &module,
Compile(func);
}
} else {
LOG(FATAL) << "Not supported OutputKind";
CINN_THROW("Not supported OutputKind");
}

if (for_nvrtc_) {
Expand Down Expand Up @@ -372,8 +372,10 @@ void CodeGenCUDA_Dev::PrintTempBufferCreation(const ir::Buffer &buffer) {
print_gpu_memory("");
}
} else {
LOG(FATAL) << "CUDA device codegen not support memory " << buffer->name
<< ", type " << buffer->memory_type;
std::stringstream ss;
ss << "CUDA device codegen not support memory " << buffer->name << ", type "
<< buffer->memory_type;
CINN_THROW(ss.str());
}
}

Expand Down
Loading