Skip to content

Commit

Permalink
[build] Warning Suppression PR #4: Fixed warnings with MacOS (#4926)
Browse files Browse the repository at this point in the history
* [build] Warning Suppression PR #1: Turned on -Wno-ignored-attributes & Removed unused functions

* [build] Warning Suppression PR #2: Eliminate warnings from third-party headers

* Fixed an warning with enum comparison

* [build] Warning Suppression PR #4: Fixed Mac-specific warnings
  • Loading branch information
jim19930609 authored May 7, 2022
1 parent 7324903 commit 37c47b7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion taichi/backends/metal/codegen_metal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class KernelCodegenImpl : public IRVisitor {

for (int i = 0; i < compiled_snode_trees_.size(); ++i) {
const auto &cst = compiled_snode_trees_[i];
for (const auto [node_id, _] : cst.snode_descriptors) {
for (const auto &[node_id, _] : cst.snode_descriptors) {
RootInfo ri{};
ri.snode_id = cst.root_id;
ri.index_in_cst = i;
Expand Down
7 changes: 7 additions & 0 deletions taichi/backends/metal/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,20 @@ class StreamImpl : public Stream {
const std::vector<StreamSemaphore> &wait_semaphores) override {
auto *cb = static_cast<CommandListImpl *>(cmdlist)->command_buffer();
commit_command_buffer(cb);

// FIXME: Implement semaphore mechanism for Metal backend
// and return the actual semaphore corresponding to the submitted
// cmds.
return nullptr;
}
StreamSemaphore submit_synced(
CommandList *cmdlist,
const std::vector<StreamSemaphore> &wait_semaphores) override {
auto *cb = static_cast<CommandListImpl *>(cmdlist)->command_buffer();
commit_command_buffer(cb);
wait_until_completed(cb);

return nullptr;
}

void command_sync() override {
Expand Down
4 changes: 2 additions & 2 deletions taichi/backends/metal/kernel_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class UserMtlKernel : public CompiledMtlKernelBase {
// 0 is valid for |num_threads|!
TI_ASSERT(kernel_attribs_.advisory_total_num_threads >= 0);
BindBuffers buffers;
for (const auto b : kernel_attribs_.buffers) {
for (const auto &b : kernel_attribs_.buffers) {
buffers.push_back({input_buffers.find(b)->second, b});
}
launch_if_not_empty(std::move(buffers), command_buffer);
Expand All @@ -215,7 +215,7 @@ class SparseRuntimeMtlKernelBase : public CompiledMtlKernelBase {
void launch(InputBuffersMap &input_buffers,
MTLCommandBuffer *command_buffer) override {
BindBuffers buffers;
for (const auto b : kernel_attribs_.buffers) {
for (const auto &b : kernel_attribs_.buffers) {
if (b.type() == BufferDescriptor::Type::Context) {
buffers.push_back({args_buffer_.get(), b});
} else {
Expand Down
2 changes: 1 addition & 1 deletion taichi/backends/metal/metal_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace {
std::unordered_set<const SNode *> find_all_dense_snodes(
const metal::SNodeDescriptorsMap &snodes_map) {
std::unordered_set<const SNode *> res;
for (const auto [_, desc] : snodes_map) {
for (const auto &[_, desc] : snodes_map) {
const auto *sn = desc.snode;
if (sn->type == SNodeType::dense) {
res.insert(sn);
Expand Down
2 changes: 1 addition & 1 deletion taichi/backends/opengl/codegen_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class KernelGen : public IRVisitor {
kernel_header += shaders::kOpenGlAtomicF32Source_gtmp;
}
std::unordered_set<int> arr_ids;
for ([[maybe_unused]] const auto [arr_id, bind_idx] :
for ([[maybe_unused]] const auto &[arr_id, bind_idx] :
used.arr_arg_to_bind_idx) {
arr_ids.insert(arr_id);
}
Expand Down
2 changes: 1 addition & 1 deletion taichi/transforms/make_mesh_block_local.cpp