Skip to content

Commit

Permalink
[misc] Remove some warnings (#4453)
Browse files Browse the repository at this point in the history
* Remove some warnings

* Re-commit
  • Loading branch information
PGZXB authored Mar 7, 2022
1 parent c8501f0 commit 0a1b9a6
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion taichi/aot/module_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace taichi {
namespace lang {

class RuntimeContext;
struct RuntimeContext;

namespace aot {

Expand Down
2 changes: 1 addition & 1 deletion taichi/backends/cuda/cupti_toolkit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
4 changes: 2 additions & 2 deletions taichi/backends/cuda/cupti_toolkit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
};

Expand Down
2 changes: 1 addition & 1 deletion taichi/backends/vulkan/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class CompiledTaichiKernel {
TaichiKernelAttributes ti_kernel_attribs_;
std::vector<TaskAttributes> tasks_attribs_;

Device *device_;
[[maybe_unused]] Device *device_;

InputBuffersMap input_buffers_;

Expand Down
2 changes: 0 additions & 2 deletions taichi/codegen/spirv/spirv_codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
4 changes: 2 additions & 2 deletions taichi/ir/statements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions taichi/jit/jit_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ std::unique_ptr<JITSession> JITSession::create(LlvmProgramImpl *llvm_prog,
#else
TI_ERROR("Llvm disabled");
#endif
return nullptr;
}

TLANG_NAMESPACE_END
2 changes: 1 addition & 1 deletion taichi/program/ndarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ Ndarray::Ndarray(Program *prog,
const std::vector<int> &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),
1,
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);
Expand Down
2 changes: 1 addition & 1 deletion taichi/transforms/make_mesh_block_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion taichi/transforms/offload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 *, Stmt *> stmt_to_offloaded_;
OffloadedRanges *const offloaded_ranges_;
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/aot/aot_save_load_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/transforms/extract_constant_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>());
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<Block>());
Expand Down

0 comments on commit 0a1b9a6

Please sign in to comment.