Skip to content

Commit 0741d5c

Browse files
Fix clang-tidy misc-unused-params warnings (#35433)
# Fix clang-tidy `misc-unused-params` warnings ## Summary This PR applies fixes for clang-tidy's `misc-unused-params` check, which identifies and removes unused function parameters. The changes ensure that function signatures match their actual usage, improving code clarity and maintainability. ## Changes Made ### 1. Removed Unused Variables - **`ttnn/cpp/ttnn/operations/data_movement/scatter/tosa_scatter.cpp`**: Removed unused variable `K` (line 132) - **`ttnn/cpp/ttnn/operations/data_movement/pad/device/pad_rm_reader_writer_multi_core_program_factory.cpp`**: Removed unused variable `nchannel` (line 196) - **`ttnn/cpp/ttnn/operations/eltwise/unary/device/unary_device_operation.cpp`**: Removed unused variable `arch` (line 80) ### 2. Fixed Function Signature Mismatches #### Slice Operations - **`ttnn/cpp/ttnn/operations/data_movement/slice/device/slice_program_factory_tile.cpp`**: - Removed `num_cores` argument from `set_slice_runtime_args_tile()` calls (2 locations) - Function signature was updated by clang-tidy but call sites weren't updated - **`ttnn/cpp/ttnn/operations/data_movement/slice/device/slice_program_factory_tile_tensor_args.cpp`**: - Removed `num_cores` argument from `set_slice_runtime_args_tensor_args()` calls (2 locations) - Function signature was updated by clang-tidy but call sites weren't updated #### Grid Sample Operations - **`ttnn/cpp/ttnn/operations/pool/grid_sample/grid_sample_prepare_grid.cpp`**: - Removed unused `output_dtype` parameter from `create_host_buffer_for_grid_preprocessing()` call - The function signature was updated by clang-tidy but the call site wasn't updated ### 3. Fixed Template Function Calls - **`ttnn/cpp/ttnn/operations/eltwise/unary/unary_nanobind.cpp`**: - Updated bind function calls to remove second argument (operation object) and explicitly specify template parameters using `decltype` - Fixed functions: `bind_softplus`, `bind_sigmoid_accurate`, `bind_sigmoid_mode_appx`, `bind_unary_chain`, `bind_identity` - These functions use the operation directly from the namespace, so the parameter was removed by clang-tidy ### 4. Updated Test Code - **`tests/ttnn/unit_tests/gtests/test_launch_operation.cpp`**: - Updated test structs to match expected method signatures: - Added `const std::vector<Tensor>& input_tensors` parameter to `compute_output_specs()` methods - Added `const std::vector<Tensor>& input_tensors` parameter to `create_output_tensors()` methods - Added `const ttnn::MeshCoordinateRangeSet& mesh_coordinate_range_set` parameter to `create_mesh_workload()` method - These changes ensure test mocks match the actual operation interface requirements ## Testing - ✅ Build passes with `./build_metal.sh --debug --build-all` - ✅ All clang-tidy `misc-unused-params` warnings resolved - ✅ No functional changes - only signature updates to match actual usage ## Notes - The clang-tidy tool automatically removed unused parameters from function signatures, but some call sites needed manual updates - All changes maintain backward compatibility at the API level - only internal implementation details were modified - Test code was updated to ensure test mocks correctly implement the expected interfaces --------- Co-authored-by: Bryan Wilder Field Lozano <blozano@tenstorrent.com>
1 parent 181022b commit 0741d5c

File tree

557 files changed

+1062
-1101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

557 files changed

+1062
-1101
lines changed

.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ Checks: >
8484
-misc-include-cleaner,
8585
-misc-no-recursion,
8686
-misc-non-private-member-variables-in-classes,
87-
-misc-unused-parameters,
8887
-misc-use-anonymous-namespace,
8988
-misc-use-internal-linkage,
9089
-modernize-avoid-bind,

tests/tt_eager/integration_tests/test_bert.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ void test_bert() {
372372
run_loop();
373373
}
374374

375-
int main(int argc, char** argv) {
375+
int main() {
376376
test_bert();
377377
return 0;
378378
}

tests/tt_eager/ops/test_bcast_op.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ using namespace constants;
3535
//////////////////////////////////////////////////////////////////////////////////////////
3636
// TODO: explain what test does
3737
//////////////////////////////////////////////////////////////////////////////////////////
38-
int main(int argc, char** argv) {
38+
int main() {
3939
bool pass = true;
4040

4141
try {

tests/tt_eager/ops/test_bmm_op.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ using namespace constants;
3434
//////////////////////////////////////////////////////////////////////////////////////////
3535
// TODO: explain what test does
3636
//////////////////////////////////////////////////////////////////////////////////////////
37-
int main(int argc, char** argv) {
37+
int main() {
3838
bool pass = true;
3939

4040
try {

tests/tt_eager/ops/test_eltwise_unary_op.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void test_program_cache() {
284284
TT_FATAL(device->num_program_cache_entries() == 0, "Error");
285285
}
286286

287-
int main(int argc, char** argv) {
287+
int main() {
288288
// test_operation_infrastructure();
289289
test_shape_padding();
290290
test_numerically();

tests/tt_eager/ops/test_layernorm_op.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ using namespace constants;
2929
//////////////////////////////////////////////////////////////////////////////////////////
3030
// TODO: explain what test does
3131
//////////////////////////////////////////////////////////////////////////////////////////
32-
int main(int argc, char** argv) {
32+
int main() {
3333
bool pass = true;
3434

3535
try {

tests/tt_eager/ops/test_softmax_op.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void run_softmax(distributed::MeshDevice* device, const ttnn::Shape& shape) {
2929
//////////////////////////////////////////////////////////////////////////////////////////
3030
// TODO: explain what test does
3131
//////////////////////////////////////////////////////////////////////////////////////////
32-
int main(int argc, char** argv) {
32+
int main() {
3333
bool pass = true;
3434

3535
try {

tests/tt_eager/tensors/test_copy_and_move.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ void test_tensor_deallocate_and_close_device(distributed::MeshDevice* device) {
221221
dev_a.deallocate();
222222
}
223223

224-
int main(int argc, char** argv) {
224+
int main() {
225225
bool pass = true;
226226

227227
try {

tests/tt_eager/tensors/test_host_device_loopback.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ bool test_multi_tile_multi_dram_bank_loopback(distributed::MeshDevice* device) {
5353
return pass;
5454
}
5555

56-
int main(int argc, char** argv) {
56+
int main() {
5757
bool pass = true;
5858

5959
try {

tests/tt_metal/distributed/test_mesh_socket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ std::shared_ptr<Program> create_reduce_program(
11071107
const MeshSocket& recv_socket_0,
11081108
const MeshSocket& recv_socket_1,
11091109
const MeshSocket& send_socket_2,
1110-
const std::shared_ptr<MeshDevice>& reducer,
1110+
const std::shared_ptr<MeshDevice>& /*reducer*/,
11111111
std::size_t page_size,
11121112
std::size_t data_size,
11131113
const CoreCoord& reduce_logical_coord,

0 commit comments

Comments
 (0)