From bf355fec1818dae7ef436a9f5aa7c2b0565ac75c Mon Sep 17 00:00:00 2001 From: PGZXB <420254146@qq.com> Date: Sun, 6 Mar 2022 11:25:59 +0800 Subject: [PATCH 1/2] Remove some warnings --- taichi/aot/module_loader.h | 2 +- taichi/backends/cuda/cupti_toolkit.cpp | 2 +- taichi/backends/cuda/cupti_toolkit.h | 4 ++-- taichi/backends/vulkan/runtime.h | 2 +- taichi/codegen/spirv/spirv_codegen.cpp | 2 -- taichi/ir/statements.cpp | 4 ++-- taichi/jit/jit_session.cpp | 1 + taichi/program/ndarray.cpp | 2 +- taichi/transforms/make_mesh_block_local.cpp | 2 +- taichi/transforms/offload.cpp | 2 +- tests/cpp/aot/aot_save_load_test.cpp | 2 +- tests/cpp/transforms/extract_constant_test.cpp | 2 +- 12 files changed, 13 insertions(+), 14 deletions(-) diff --git a/taichi/aot/module_loader.h b/taichi/aot/module_loader.h index 303a3bffddbbd..8217923d719fc 100644 --- a/taichi/aot/module_loader.h +++ b/taichi/aot/module_loader.h @@ -13,7 +13,7 @@ namespace taichi { namespace lang { -class RuntimeContext; +struct RuntimeContext; namespace aot { diff --git a/taichi/backends/cuda/cupti_toolkit.cpp b/taichi/backends/cuda/cupti_toolkit.cpp index 9a57b20363cbe..5c4244fba6222 100644 --- a/taichi/backends/cuda/cupti_toolkit.cpp +++ b/taichi/backends/cuda/cupti_toolkit.cpp @@ -22,7 +22,7 @@ enum class CuptiMetricsDefault : uint { CUPTI_METRIC_DEFAULT_TOTAL = 2 }; -constexpr const char *MetricListDefault[] = { +[[maybe_unused]] constexpr const char *MetricListDefault[] = { "smsp__cycles_elapsed.avg", // CUPTI_METRIC_KERNEL_ELAPSED_CLK_NUMS "smsp__cycles_elapsed.avg.per_second", // CUPTI_METRIC_CORE_FREQUENCY_HZS }; diff --git a/taichi/backends/cuda/cupti_toolkit.h b/taichi/backends/cuda/cupti_toolkit.h index f7e50632435ac..98a5c3309730f 100644 --- a/taichi/backends/cuda/cupti_toolkit.h +++ b/taichi/backends/cuda/cupti_toolkit.h @@ -38,8 +38,8 @@ class CuptiToolkit { void set_status(bool enable); private: - bool enabled_{false}; - CuptiConfig cupti_config_; + [[maybe_unused]] bool enabled_{false}; + [[maybe_unused]] CuptiConfig cupti_config_; CuptiImage cupti_image_; }; diff --git a/taichi/backends/vulkan/runtime.h b/taichi/backends/vulkan/runtime.h index aa92abe8af3c8..d862dcf5cf755 100644 --- a/taichi/backends/vulkan/runtime.h +++ b/taichi/backends/vulkan/runtime.h @@ -64,7 +64,7 @@ class CompiledTaichiKernel { TaichiKernelAttributes ti_kernel_attribs_; std::vector tasks_attribs_; - Device *device_; + [[maybe_unused]] Device *device_; InputBuffersMap input_buffers_; diff --git a/taichi/codegen/spirv/spirv_codegen.cpp b/taichi/codegen/spirv/spirv_codegen.cpp index 7350433c94608..821ccb12b91f6 100644 --- a/taichi/codegen/spirv/spirv_codegen.cpp +++ b/taichi/codegen/spirv/spirv_codegen.cpp @@ -1517,8 +1517,6 @@ class TaskCodegen : public IRVisitor { task_attribs_.advisory_total_num_threads = total_num_cells; int num_cells = snode->num_cells_per_container; - int upper_level_cells = total_num_cells / num_cells; - TI_INFO("ListGen {} * {}", total_num_cells / num_cells, num_cells); auto listgen_buffer = diff --git a/taichi/ir/statements.cpp b/taichi/ir/statements.cpp index 5f2b1821dc64b..2da47acc5ed28 100644 --- a/taichi/ir/statements.cpp +++ b/taichi/ir/statements.cpp @@ -305,11 +305,11 @@ MeshForStmt::MeshForStmt(mesh::Mesh *mesh, int num_cpu_threads, int block_dim) : mesh(mesh), - major_from_type(element_type), body(std::move(body)), bit_vectorize(bit_vectorize), num_cpu_threads(num_cpu_threads), - block_dim(block_dim) { + block_dim(block_dim), + major_from_type(element_type) { this->body->parent_stmt = this; TI_STMT_REG_FIELDS; } diff --git a/taichi/jit/jit_session.cpp b/taichi/jit/jit_session.cpp index a979f55bf4ab9..dd9547589949b 100644 --- a/taichi/jit/jit_session.cpp +++ b/taichi/jit/jit_session.cpp @@ -33,6 +33,7 @@ std::unique_ptr JITSession::create(LlvmProgramImpl *llvm_prog, #else TI_ERROR("Llvm disabled"); #endif + return nullptr; } TLANG_NAMESPACE_END diff --git a/taichi/program/ndarray.cpp b/taichi/program/ndarray.cpp index 196fda01fe989..a54923d353ade 100644 --- a/taichi/program/ndarray.cpp +++ b/taichi/program/ndarray.cpp @@ -16,7 +16,6 @@ Ndarray::Ndarray(Program *prog, const std::vector &shape) : dtype(type), shape(shape), - prog_impl_(prog->get_llvm_program_impl()), num_active_indices(shape.size()), nelement_(std::accumulate(std::begin(shape), std::end(shape), @@ -24,6 +23,7 @@ Ndarray::Ndarray(Program *prog, std::multiplies<>())), element_size_(data_type_size(dtype)), device_(prog->get_device_shared()), + prog_impl_(prog->get_llvm_program_impl()), rw_accessors_bank_(&prog->get_ndarray_rw_accessors_bank()) { ndarray_alloc_ = prog->allocate_memory_ndarray(nelement_ * element_size_, prog->result_buffer); diff --git a/taichi/transforms/make_mesh_block_local.cpp b/taichi/transforms/make_mesh_block_local.cpp index bb4699237eefa..98f5319141a71 100644 --- a/taichi/transforms/make_mesh_block_local.cpp +++ b/taichi/transforms/make_mesh_block_local.cpp @@ -400,7 +400,7 @@ void MakeMeshBlockLocal::fetch_mapping( MakeMeshBlockLocal::MakeMeshBlockLocal(OffloadedStmt *offload, const CompileConfig &config) - : offload_(offload), config_(config) { + : config_(config), offload_(offload) { // Step 0: simplify l2g + g2r -> l2r simplify_nested_conversion(); diff --git a/taichi/transforms/offload.cpp b/taichi/transforms/offload.cpp index 00abf97230691..135e0c7053e16 100644 --- a/taichi/transforms/offload.cpp +++ b/taichi/transforms/offload.cpp @@ -672,7 +672,7 @@ class FixCrossOffloadReferences : public BasicStmtVisitor { } private: - const CompileConfig &config_; + [[maybe_unused]] const CompileConfig &config_; StmtToOffsetMap local_to_global_offset_; std::unordered_map stmt_to_offloaded_; OffloadedRanges *const offloaded_ranges_; diff --git a/tests/cpp/aot/aot_save_load_test.cpp b/tests/cpp/aot/aot_save_load_test.cpp index 5ffff6ae87600..89f91c314f9f2 100644 --- a/tests/cpp/aot/aot_save_load_test.cpp +++ b/tests/cpp/aot/aot_save_load_test.cpp @@ -10,7 +10,7 @@ using namespace taichi; using namespace lang; -static void aot_save() { +[[maybe_unused]] static void aot_save() { auto program = Program(Arch::vulkan); program.config.advanced_optimization = false; diff --git a/tests/cpp/transforms/extract_constant_test.cpp b/tests/cpp/transforms/extract_constant_test.cpp index b579f9178a429..4e4693d3bc501 100644 --- a/tests/cpp/transforms/extract_constant_test.cpp +++ b/tests/cpp/transforms/extract_constant_test.cpp @@ -26,7 +26,7 @@ TEST_F(ExtractConstantTest, ExtractConstant) { builder.set_insertion_point_to_loop_begin(for_stmt); auto *x = builder.create_local_var(get_data_type()); auto *x_v = builder.create_local_load(x); - auto *sum = builder.create_add(x_v, builder.get_int32(1)); + builder.create_add(x_v, builder.get_int32(1)); auto ir = builder.extract_ir(); ASSERT_TRUE(ir->is()); From 9d325e196e592a5f05cea6d0c53a58730befda50 Mon Sep 17 00:00:00 2001 From: PGZXB <420254146@qq.com> Date: Sun, 6 Mar 2022 14:59:54 +0800 Subject: [PATCH 2/2] Re-commit