Unverified Commit 5683e6a6 authored by Xuehai Pan's avatar Xuehai Pan Committed by GitHub
Browse files

[CI][Lint] Retire `format.sh` and add `clang-tidy` to GHA workflow (#1044)

* [Lint] Retire `format.sh` and add `clang-tidy` to GHA workflow

* chore: update clang-tidy settings

* chore: upgrade clang-format and clang-tidy version

* lint: resolve clang-tidy errors

* [Maint] restore format.sh

* [CI] pre-commit autoupdate

* [Minor] fix `command -v` usage
parent 151d9e6b
......@@ -496,8 +496,9 @@ private:
if (reduce_extent == 1) {
// special case, no reduction is needed.
std::vector<Stmt> stores;
stores.reserve(size);
for (size_t i = 0; i < size; ++i) {
stores.push_back(BufferStore(buffers[i], values[i], {0}));
stores.emplace_back(BufferStore(buffers[i], values[i], {0}));
}
return SeqStmt::Flatten(stores);
}
......@@ -604,7 +605,7 @@ private:
// Load reduction values, no synchronization needed.
Array<PrimExpr> a, b;
for (int i = 0; i < n_buffers; ++i) {
Buffer shared_buf = shared_bufs[i];
const Buffer &shared_buf = shared_bufs[i];
BufferLoad val(shared_buf, zero_indices);
ICHECK_EQ(val->dtype, dtypes[i]);
a.push_back(val);
......@@ -623,7 +624,7 @@ private:
// branch with a warp sync call inside.
PrimExpr other = WarpShuffle(builtin::tvm_warp_shuffle_down(),
mask_buffer, val, offset);
Buffer local_buf = local_bufs[i];
const Buffer &local_buf = local_bufs[i];
Stmt s = BufferStore(local_buf, other, zero_indices);
seq->push_back(s);
......@@ -639,7 +640,7 @@ private:
std::vector<Stmt> stores;
stores.reserve(n_buffers);
for (int i = 0; i < n_buffers; ++i) {
Buffer buf = shared_bufs[i];
const Buffer &buf = shared_bufs[i];
stores.push_back(BufferStore(buf, ret[i], zero_indices));
}
......
......@@ -477,7 +477,7 @@ tvm::transform::Pass MakePackedAPI() {
Map<GlobalVar, String> packed_func_methods;
for (const auto &[gvar, base_func] : mod->functions) {
if (auto opt = base_func.as<PrimFunc>()) {
auto prim_func = opt.value();
const auto &prim_func = opt.value();
if (auto global_symbol = RequiresPackedAPI(prim_func)) {
packed_func_methods.Set(gvar, global_symbol.value());
}
......
......@@ -209,7 +209,7 @@ void TileLangStorageAccessVisitor::VisitStmt_(const ForNode *op) {
bool IsThreadInvariant(const PrimExpr &cond) {
if (auto call = cond.as<CallNode>()) {
if (auto opt_call_op = call->op.as<Op>()) {
auto call_op = opt_call_op.value();
const auto &call_op = opt_call_op.value();
if (call_op.same_as(builtin::tvm_thread_invariant())) {
return true;
}
......
......@@ -530,10 +530,11 @@ private:
block_stmt.push_back(block->body);
cur_id++;
}
new_body.push_back(MakeGroupBlock(block_stmt.size() == 1
? block_stmt[0]
: SeqStmt(std::move(block_stmt)),
annotations));
new_body.push_back(MakeGroupBlock(
block_stmt.size() == 1 ? block_stmt[0]
// NOLINTNEXTLINE(performance-move-const-arg)
: SeqStmt(std::move(block_stmt)),
annotations));
}
Array<Integer> order_anno;
Array<Integer> stage_anno;
......@@ -697,10 +698,12 @@ private:
continue;
if (marker_.GetRole(op->seq[i]) == Role::kBoth) {
block_stmt.push_back(seq_transformed[i]);
new_body.push_back(MakeGroupBlock(
block_stmt.size() == 1 ? block_stmt[0]
: SeqStmt(std::move(block_stmt)),
annotations));
new_body.push_back(
MakeGroupBlock(block_stmt.size() == 1
? block_stmt[0]
// NOLINTNEXTLINE(performance-move-const-arg)
: SeqStmt(std::move(block_stmt)),
annotations));
continue;
}
}
......@@ -734,10 +737,12 @@ private:
}
}
collector.Clear();
new_body.push_back(MakeGroupBlock(
block_stmt.size() == 1 ? block_stmt[0]
: SeqStmt(std::move(block_stmt)),
annotations));
new_body.push_back(
MakeGroupBlock(block_stmt.size() == 1
? block_stmt[0]
// NOLINTNEXTLINE(performance-move-const-arg)
: SeqStmt(std::move(block_stmt)),
annotations));
}
}
} else { // consumer case
......@@ -766,10 +771,11 @@ private:
}
}
}
new_body.push_back(MakeGroupBlock(block_stmt.size() == 1
? block_stmt[0]
: SeqStmt(std::move(block_stmt)),
annotations));
new_body.push_back(MakeGroupBlock(
block_stmt.size() == 1 ? block_stmt[0]
// NOLINTNEXTLINE(performance-move-const-arg)
: SeqStmt(std::move(block_stmt)),
annotations));
}
// Filter out the producer stmts
int cur_id = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment