Skip to content

Commit

Permalink
Fix some typos (noedes, mulitple, etc.)(#61788)
Browse files Browse the repository at this point in the history
  • Loading branch information
co63oc authored Feb 22, 2024
1 parent 726ec03 commit 8d704b7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion paddle/cinn/optim/ir_simplify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ using utils::Replace;
namespace {

//! Simplify some sub-expression in the `expr`. Due to the simplify strategy
//! just fit several kinds of IR noedes, we partition the original expression to
//! just fit several kinds of IR nodes, we partition the original expression to
//! several sub-expression those supported by simplify, and process each of
//! them.
void PartialSimplify(
Expand Down
4 changes: 2 additions & 2 deletions paddle/cinn/optim/lower_intrin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ void LowerIntrin(Expr *e, Target target) {
void Visit(const ir::Call *op, Expr *expr) override {
auto *node = expr->As<ir::Call>();
CHECK(node);
LowerCpuintrinsicOp(node, expr);
LowerCpuIntrinsicOp(node, expr);
}

void LowerCpuintrinsicOp(ir::Call *op, Expr *expr) {
void LowerCpuIntrinsicOp(ir::Call *op, Expr *expr) {
auto *node = expr->As<ir::Call>();
if (kIntrinsicCalls.count(node->name)) {
CHECK(!node->name.empty());
Expand Down
10 changes: 5 additions & 5 deletions paddle/cinn/optim/map_extern_call.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ void MapExternCall(Expr *e, Target target) {
CHECK(node);
OptimizeConstantPow(node);
if (target.arch == Target::Arch::NVGPU) {
DealWithNvGpuintrinsics(node, expr);
DealWithNvGpuIntrinsics(node, expr);
} else {
DealWithCpuintrinsics(node, expr);
DealWithCpuIntrinsics(node, expr);
}
}

void DealWithCpuintrinsics(ir::Call *node, Expr *expr) {
void DealWithCpuIntrinsics(ir::Call *node, Expr *expr) {
if (kExternFp32CallsCPU.count(node->name)) {
CHECK_GE(node->read_args.size(), 1UL);
CHECK(node->read_args.front().type().is_float())
<< "CPU extern call instrinsices only support float now! Please "
<< "CPU extern call intrinsics only support float now! Please "
"check.";
if (node->read_args.front().type().is_float(32)) {
auto out_type = node->type();
Expand All @@ -76,7 +76,7 @@ void MapExternCall(Expr *e, Target target) {
}
}

void DealWithNvGpuintrinsics(ir::Call *node, Expr *expr) {
void DealWithNvGpuIntrinsics(ir::Call *node, Expr *expr) {
auto arg_size = node->read_args.size();
if (arg_size == 0UL) {
// some node like __syncthreads hasn't arguments
Expand Down
14 changes: 7 additions & 7 deletions paddle/cinn/optim/update_buffer_axis_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ namespace optim {

bool ExprMathEqual(const Expr& expr1, const Expr& expr2) {
ir::Expr cmp_expr = common::AutoSimplify(ir::Sub::Make(expr1, expr2));
// This is ugry code since AutoSimplify is not powerful enough. Modify it
// This is ugly code since AutoSimplify is not powerful enough. Modify it
// after we make auto simplify better
ir::Expr simplied = common::AutoSimplify(cmp_expr);
ir::Expr simplified = common::AutoSimplify(cmp_expr);
int count = 0;
while (simplied != cmp_expr) {
cmp_expr = simplied;
simplied = common::AutoSimplify(cmp_expr);
while (simplified != cmp_expr) {
cmp_expr = simplified;
simplified = common::AutoSimplify(cmp_expr);
++count;
// Control dead loop
if (count >= 5) {
break;
}
}
return simplied.is_constant() && simplied.get_constant() == 0;
return simplified.is_constant() && simplified.get_constant() == 0;
}

void FormalizeSingleIndex(const ir::Tensor& tensor,
Expand Down Expand Up @@ -126,7 +126,7 @@ class AnalyzeBufferAxis : public ir::IRMutator<> {
if (!buffer_name_access_same_index_expr.count(buffer_name)) {
for (int i = 0; i < indices.size(); ++i) {
if (tensor->buffer->memory_type == ir::MemoryType::GPUShared) {
// In GPUShared case, the thread vars cannot be simplied
// In GPUShared case, the thread vars cannot be simplified
std::set<ir::Expr> var_nodes =
ir::ir_utils::CollectIRNodesWithoutTensor(
indices[i], [&](const Expr* x) {
Expand Down
18 changes: 9 additions & 9 deletions paddle/cinn/optim/vectorize_loops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class TensorVectorizeTeller : public ir::IRMutator<const Expr *> {
return false;
}

// the iter val can't appear in mulitple indices
// the iter val can't appear in multiple indices
for (int i = 0; i < indices.size() - 1; ++i) {
auto repeat_found =
ir::ir_utils::CollectIRNodes(indices[i], find_matched_var_fn);
Expand Down Expand Up @@ -184,9 +184,9 @@ class TensorVectorizeTeller : public ir::IRMutator<const Expr *> {
};

// find tensors accessed sequentially in a for-loop to be vectorized,
// and substitue the corresponding cuda built-in vector for them
// and substitute the corresponding cuda built-in vector for them
class CudaVectorizer : public IRMutator<Expr *> {
const Var iter_var_; // the loop var of the vecotrized loop
const Var iter_var_; // the loop var of the vectorized loop
const int factor_; // the factor for vectorize

std::set<std::string> write_teller_;
Expand Down Expand Up @@ -258,7 +258,7 @@ class CudaVectorizer : public IRMutator<Expr *> {
}

auto vectorized_var = tensor2vectorized_vars_.at(tensor->name);
// substitue a new tensor with the vector name and dtype
// substitute a new tensor with the vector name and dtype
auto t = vectorized_var->type().is_cpp_handle()
? node->tensor->type().PointerOf()
: node->tensor->type();
Expand Down Expand Up @@ -286,7 +286,7 @@ class CudaVectorizer : public IRMutator<Expr *> {
GET_CUDA_VECTOR_TYPE_NAME(type.is_bfloat16(), "bfloat16");
#undef GET_CUDA_VECTOR_TYPE_NAME

// others are not implementd yet
// others are not implemented yet
CINN_NOT_IMPLEMENTED
return "";
}
Expand Down Expand Up @@ -727,15 +727,15 @@ struct VectorizeLoops_ : public IRMutator<Expr *> {

void Visit(const For *forloop, Expr *expr) {
auto *node = expr->As<For>();
auto loopvar_name = forloop->loop_var->name;
auto loop_var_name = forloop->loop_var->name;
if (forloop->extent.As<IntImm>()) {
var_intervals.emplace(
loopvar_name,
loop_var_name,
cinn::common::CasInterval{static_cast<int64_t>(0),
forloop->extent.as_int64() - 1});
} else {
var_intervals.emplace(
loopvar_name,
loop_var_name,
cinn::common::CasInterval{Expr(0), forloop->extent - 1});
}
// the extent the forloops marked as Vectorized should be int constant
Expand Down Expand Up @@ -842,7 +842,7 @@ struct VectorizeLoops_ : public IRMutator<Expr *> {
} else {
IRMutator::Visit(forloop, expr);
}
var_intervals.erase(loopvar_name);
var_intervals.erase(loop_var_name);
}

//! unroll the forloop if its' extent is min type by solving the condition
Expand Down

0 comments on commit 8d704b7

Please sign in to comment.