Skip to content

Commit

Permalink
[build] Warning Suppression PR #2: Fixed codebase warnings (taichi-de…
Browse files Browse the repository at this point in the history
  • Loading branch information
jim19930609 authored May 6, 2022
1 parent 92bb359 commit abd0136
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 12 deletions.
5 changes: 1 addition & 4 deletions taichi/backends/vulkan/vulkan_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1396,9 +1396,8 @@ void VulkanDevice::dealloc_memory(DeviceAllocation handle) {
TI_ASSERT_INFO(map_pair != allocations_.end(),
"Invalid handle (double free?) {}", handle.alloc_id);

AllocationInternal &alloc = map_pair->second;

#ifdef TI_VULKAN_DEBUG_ALLOCATIONS
AllocationInternal &alloc = map_pair->second;
TI_TRACE("Dealloc VK buffer {}, alloc_id={}", (void *)alloc.buffer,
handle.alloc_id);
#endif
Expand Down Expand Up @@ -1831,8 +1830,6 @@ void VulkanDevice::destroy_image(DeviceAllocation handle) {
TI_ASSERT_INFO(map_pair != image_allocations_.end(),
"Invalid handle (double free?) {}", handle.alloc_id);

ImageAllocInternal &alloc_int = map_pair->second;

image_allocations_.erase(handle.alloc_id);
}

Expand Down
2 changes: 1 addition & 1 deletion taichi/backends/vulkan/vulkan_device_creator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ void VulkanDeviceCreator::create_logical_device() {

bool has_swapchain = false;

bool portability_subset_enabled = false;
[[maybe_unused]] bool portability_subset_enabled = false;

for (auto &ext : extension_properties) {
TI_TRACE("Vulkan device extension {} ({})", ext.extensionName,
Expand Down
2 changes: 1 addition & 1 deletion taichi/backends/wasm/codegen_wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CodeGenLLVMWASM : public CodeGenLLVM {
}

void create_offload_range_for(OffloadedStmt *stmt) override {
int step = 1;
[[maybe_unused]] int step = 1;

// In parallel for-loops reversing the order doesn't make sense.
// However, we may need to support serial offloaded range for's in the
Expand Down
1 change: 0 additions & 1 deletion taichi/codegen/spirv/spirv_codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ class TaskCodegen : public IRVisitor {

void visit(GlobalStoreStmt *stmt) override {
TI_ASSERT(stmt->width() == 1);
const auto dt = stmt->val->element_type();

spirv::Value val = ir_->query_value(stmt->val->raw_name());

Expand Down
8 changes: 7 additions & 1 deletion taichi/program/async_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,14 @@ void AsyncEngine::debug_sfg(const std::string &stage) {
std::ofstream dot_file(dot_fn + ".dot");
dot_file << dot;
}
std::system(

int return_code = std::system(
fmt::format("dot -Tpdf -o {}.pdf {}.dot", dot_fn, dot_fn).c_str());
if (return_code != 0) {
throw std::runtime_error(
fmt::format("Unable to convert {dot_fn}.dot into {dot_fn}.pdf")
.c_str());
}
}

TLANG_NAMESPACE_END
2 changes: 1 addition & 1 deletion taichi/program/state_flow_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ bool StateFlowGraph::optimize_listgen() {
for (int i = i_start; i < listgens.size(); i++) {
auto node_a = listgens[i];

bool erased_any = false;
[[maybe_unused]] bool erased_any = false;

auto new_i = i;

Expand Down
6 changes: 5 additions & 1 deletion taichi/util/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ inline void create_directories(const std::string &dir) {
#if defined(TI_PLATFORM_WINDOWS)
std::filesystem::create_directories(dir);
#else
std::system(fmt::format("mkdir -p {}", dir).c_str());
int return_code = std::system(fmt::format("mkdir -p {}", dir).c_str());
if (return_code != 0) {
throw std::runtime_error(
fmt::format("Unable to create directory at: {dir}").c_str());
}
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/ir/ir_type_promotion_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TEST(IRTypePromotionTest, ShiftOp) {

// (u8)x << (i32)1 -> (u8)res
auto *lhs = builder.create_arg_load(0, get_data_type<uint8>(), false);
auto *res = builder.create_shl(lhs, builder.get_int32(1));
builder.create_shl(lhs, builder.get_int32(1));
auto ir = builder.extract_ir();

ASSERT_TRUE(ir->is<Block>());
Expand Down
3 changes: 2 additions & 1 deletion tests/cpp/transforms/alg_simp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ TEST_F(AlgebraicSimplicationTest, SimplifyMultiplyZeroFastMath) {
auto add = block->push_back<BinaryOpStmt>(BinaryOpType::add, mul, one);
auto global_store_addr = block->push_back<GlobalTemporaryStmt>(
4, TypeFactory::create_vector_or_scalar_type(1, PrimitiveType::i32));
auto global_store = block->push_back<GlobalStoreStmt>(global_store_addr, add);
[[maybe_unused]] auto global_store =
block->push_back<GlobalStoreStmt>(global_store_addr, add);

CompileConfig config_without_fast_math;
config_without_fast_math.fast_math = false;
Expand Down

0 comments on commit abd0136

Please sign in to comment.