Skip to content

Commit

Permalink
[build] Warning Suppression PR taichi-dev#2: Fixed codebase warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jim19930609 committed May 5, 2022
1 parent 3d6fcb0 commit 4c02abc
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
1 change: 0 additions & 1 deletion taichi/backends/metal/shaders/atomic_stubs.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ struct _atomic {};
namespace metal {

using memory_order = bool;
memory_order memory_order_relaxed = false;

} // namespace metal

Expand Down
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
7 changes: 6 additions & 1 deletion taichi/program/async_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,13 @@ 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("Unable to convert %s.dot into %s.pdf", dot_fn,
dot_fn);
}
}

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
5 changes: 4 additions & 1 deletion taichi/util/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ 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("Unable to create directory at: %s", dir);
}
#endif
}

Expand Down

0 comments on commit 4c02abc

Please sign in to comment.