Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] Warning Suppression PR #4: Fixed warnings with MacOS #4926

Merged
merged 8 commits into from
May 7, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ MakeMeshBlockLocal::MakeMeshBlockLocal(OffloadedStmt *offload,
TI_TRACE("available cache attributes bytes = {}", available_bytes);
TI_TRACE("caches size = {}", caches->caches.size());
std::vector<MeshBLSCache> priority_caches;
for (const auto [snode, cache] : caches->caches) {
for (const auto &[snode, cache] : caches->caches) {
priority_caches.push_back(cache);
}
std::sort(priority_caches.begin(), priority_caches.end(),
Expand Down