Skip to content

Commit 6b9dd88

Browse files
committed
chore: upgrade clang-format and clang-tidy version
1 parent 28b878b commit 6b9dd88

File tree

13 files changed

+42
-31
lines changed

13 files changed

+42
-31
lines changed

.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
InheritParentConfig: true
3-
ExtraArgs: ['-v']
43
FormatStyle: file
54
UseColor: true
65
WarningsAsErrors: '*'

.github/workflows/ci.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ jobs:
226226
echo "PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL}" | tee -a "${GITHUB_ENV}"
227227
echo "UV_INDEX=${UV_INDEX}" | tee -a "${GITHUB_ENV}"
228228
fi
229+
229230
export CLANG_TIDY_CMAKE_OPTIONS="${CLANG_TIDY_CMAKE_OPTIONS} -DUSE_METAL=ON"
230231
231232
echo "USE_METAL=ON" | tee -a "${GITHUB_ENV}"
@@ -289,21 +290,33 @@ jobs:
289290
290291
- name: Run clang-tidy
291292
id: clang-tidy
293+
if: runner.os == 'Linux'
292294
run: |
293-
clang-tidy --version
295+
echo "\$ $(command -v clang-tidy) --version" && clang-tidy --version
296+
297+
if [[ -x "$(command -v run-clang-tidy)" ]]; then
298+
echo "Using run-clang-tidy from $(command -v run-clang-tidy)"
299+
CLANG_TIDY=(run-clang-tidy)
300+
else
301+
echo "Downloading run-clang-tidy script"
302+
wget -O run-clang-tidy.py https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/release/21.x/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
303+
CLANG_TIDY=(uv run --no-project --script -- run-clang-tidy.py)
304+
fi
305+
if [[ -x "$(command -v clang-apply-replacements)" ]]; then
306+
echo "Using clang-apply-replacements from $(command -v clang-apply-replacements)"
307+
CLANG_TIDY+=(-fix -clang-apply-replacements-binary="$(command -v clang-apply-replacements)")
308+
else
309+
echo "::warning::clang-apply-replacements not found in PATH, automatic fixing disabled."
310+
fi
294311
295312
# Run cmake to create the build directory with compile_commands.json
296313
cmake -S . -B cmake-build --fresh ${CLANG_TIDY_CMAKE_OPTIONS} # no quotes here
297314
298315
CXX_FILES=$(find src -type f -iname "*.[ch]pp" -o -iname "*.cc" -o -iname "*.c" -o -iname "*.h")
299316
rc=0
300-
if [[ -x "$(command -v run-clang-tidy)" ]]; then
301-
run-clang-tidy -clang-tidy-binary="$(command -v clang-tidy)" \
302-
-fix -p="cmake-build" ${CXX_FILES} || rc="$?"
303-
else
304-
clang-tidy --fix -p="cmake-build" ${CXX_FILES} || rc="$?"
305-
fi
306-
rm -rf cmake-build
317+
"${CLANG_TIDY[@]}" -clang-tidy-binary="$(command -v clang-tidy)" \
318+
-p="cmake-build" ${CXX_FILES} || rc="$?"
319+
rm -rf cmake-build run-clang-tidy.py
307320
if (( rc != 0 )); then
308321
echo "::error::clang-tidy found issues (exit code: ${rc}). Please run 'clang-tidy --fix' locally to fix them."
309322
git diff --color=always || true

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ repos:
3232
args: [--ignore-case]
3333
files: ^docs/spelling_wordlist\.txt$
3434
- repo: https://github.com/pre-commit/mirrors-clang-format
35-
rev: v15.0.7 # sync with requirements-lint.txt
35+
rev: v21.1.2 # sync with requirements-lint.txt
3636
hooks:
3737
- id: clang-format
3838
exclude: |

requirements-lint.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Format and lint requirements
22
pre-commit
3-
clang-format==15.0.7
4-
clang-tidy==18.1.8
3+
clang-format==21.1.2
4+
clang-tidy==21.1.1
55
codespell[toml]==2.4.1
66
ruff==0.14.0
77
yapf==0.43.0

src/op/gemm.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ static inline std::pair<bool, TCGEN5MMAMeta>
2727
GetTCGEN5MMAMeta(int M, int N, int K, DataType ab_dtype, DataType c_dtype) {
2828
// TODO (lei) Currently not all shapes / dtypes are supported for TCGEN5MMA.
2929
#define FAIL \
30-
return { \
31-
false, TCGEN5MMAMeta { 0, 0, 0 } \
32-
}
30+
return { false, TCGEN5MMAMeta{0, 0, 0} }
3331
#define SUCCESS(atom_m, atom_n, atom_k) \
3432
return { \
3533
true, TCGEN5MMAMeta { atom_m, atom_n, atom_k } \

src/op/parallel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ParallelOpNode;
4242

4343
class ParallelLoopNestVisitor : public StmtExprVisitor {
4444
private:
45-
ParallelLoopNestVisitor(ParallelOpNode *op) : p(op){};
45+
ParallelLoopNestVisitor(ParallelOpNode *op) : p(op) {};
4646
void VisitStmt_(const ForNode *op) override;
4747
void VisitStmt_(const BufferStoreNode *op) override;
4848
void VisitExpr_(const BufferLoadNode *op) override;

src/target/codegen_cuda.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,8 +1749,8 @@ void CodeGenTileLangCUDA::VisitExpr_(const CallNode *op, std::ostream &os) {
17491749
os << "}\n";
17501750
} else {
17511751
os << "for (int local_id = 0; local_id < 8; ++local_id) {\n";
1752-
os << dst << "[" + this->PrintExpr(dst_ind) + "]"
1753-
<< " = " << src << "[" << src_offset << " + local_id];\n";
1752+
os << dst << "[" + this->PrintExpr(dst_ind) + "]" << " = " << src << "["
1753+
<< src_offset << " + local_id];\n";
17541754
os << "}\n";
17551755
}
17561756

src/target/cuda.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5023,12 +5023,12 @@ typedef struct CUgraphNodeParams_st {
50235023
/**
50245024
* Device that represents the CPU
50255025
*/
5026-
#define CU_DEVICE_CPU ((CUdevice)-1)
5026+
#define CU_DEVICE_CPU ((CUdevice) - 1)
50275027

50285028
/**
50295029
* Device that represents an invalid device
50305030
*/
5031-
#define CU_DEVICE_INVALID ((CUdevice)-2)
5031+
#define CU_DEVICE_INVALID ((CUdevice) - 2)
50325032

50335033
/**
50345034
* Bitmasks for ::CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS

src/tl_templates/cpp/half.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,8 +1192,8 @@ unsigned int float2half_impl(T value, ...) {
11921192
template <std::float_round_style R, typename T>
11931193
unsigned int float2half(T value) {
11941194
return float2half_impl<R>(
1195-
value, bool_type < std::numeric_limits<T>::is_iec559 &&
1196-
sizeof(typename bits<T>::type) == sizeof(T) > ());
1195+
value, bool_type<std::numeric_limits<T>::is_iec559 &&
1196+
sizeof(typename bits<T>::type) == sizeof(T)>());
11971197
}
11981198

11991199
/// Convert integer to half-precision floating-point.
@@ -1665,9 +1665,10 @@ template <typename T> T half2float_impl(unsigned int value, T, ...) {
16651665
/// \param value half-precision value to convert
16661666
/// \return floating-point value
16671667
template <typename T> T half2float(unsigned int value) {
1668-
return half2float_impl(value, T(),
1669-
bool_type < std::numeric_limits<T>::is_iec559 &&
1670-
sizeof(typename bits<T>::type) == sizeof(T) > ());
1668+
return half2float_impl(
1669+
value, T(),
1670+
bool_type<std::numeric_limits<T>::is_iec559 &&
1671+
sizeof(typename bits<T>::type) == sizeof(T)>());
16711672
}
16721673

16731674
/// Convert half-precision floating-point to integer.

src/tl_templates/cuda/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ union GmmaDescriptor {
244244
uint16_t stride_byte_offset_ : 14, : 2; // 14 bits [0,14), 2 bits unused
245245
// base_offset, bit [49,52)
246246
// Valid only for SWIZZLE_128B and SWIZZLE_64B
247-
uint8_t : 1,
248-
base_offset_ : 3, : 4; // 1 bit unused, 3 bits [1,4), 4 bits unused
247+
uint8_t : 1, base_offset_ : 3,
248+
: 4; // 1 bit unused, 3 bits [1,4), 4 bits unused
249249
// layout type, bit [62,64)
250250
// SWIZZLE_NONE = 0, SWIZZLE_32B = 3, SWIZZLE_64B = 2, SWIZZLE_128B = 1
251251
uint8_t : 6, layout_type_ : 2; // 6 bits unused, 2 bits [6,8)

0 commit comments

Comments
 (0)