Fix MacOS builds after hack-and-slash PR (#3962)
diff --git a/iree/base/wait_handle_impl.h b/iree/base/wait_handle_impl.h
index ffb89aa..38f82e5 100644
--- a/iree/base/wait_handle_impl.h
+++ b/iree/base/wait_handle_impl.h
@@ -51,7 +51,8 @@
// TODO(benvanik): EPOLL on android/linux/bsd/etc.
// TODO(benvanik): KQUEUE on mac/ios.
-#if !defined(OS_IOS) && !defined(__EMSCRIPTEN__)
+// KQUEUE is not implemented yet. Use POLL for mac/ios
+#if !defined(IREE_PLATFORM_APPLE) && !defined(__EMSCRIPTEN__)
#define IREE_WAIT_API IREE_WAIT_API_PPOLL
#else
#define IREE_WAIT_API IREE_WAIT_API_POLL
diff --git a/iree/hal/metal/CMakeLists.txt b/iree/hal/metal/CMakeLists.txt
index 5d1dc75..b8b5f0e 100644
--- a/iree/hal/metal/CMakeLists.txt
+++ b/iree/hal/metal/CMakeLists.txt
@@ -16,6 +16,8 @@
return()
endif()
+iree_add_all_subdirs()
+
iree_cc_library(
NAME
metal
@@ -52,7 +54,6 @@
iree::base::flatcc
iree::base::file_io
iree::base::logging
- iree::base::memory
iree::base::status
iree::base::time
iree::base::tracing
diff --git a/iree/hal/metal/metal_command_buffer.mm b/iree/hal/metal/metal_command_buffer.mm
index 34ab86f..b40369f 100644
--- a/iree/hal/metal/metal_command_buffer.mm
+++ b/iree/hal/metal/metal_command_buffer.mm
@@ -368,11 +368,11 @@
}
IREE_DVLOG(2) << "Dispatch workgroup count: (" << workgroups[0] << ", " << workgroups[1] << ", "
- << workgroups[2] << "), workgroup size: (" << workgroup_size.x() << ", "
- << workgroup_size.y() << ", " << workgroup_size.z() << ")";
- [compute_encoder dispatchThreadgroups:MTLSizeMake(workgroups[0], workgroups[1], workgroups[2])
- threadsPerThreadgroup:MTLSizeMake(workgroup_size.x(), workgroup_size.y(),
- workgroup_size.z())];
+ << workgroups[2] << "), workgroup size: (" << workgroup_size.x << ", "
+ << workgroup_size.y << ", " << workgroup_size.z << ")";
+ [compute_encoder
+ dispatchThreadgroups:MTLSizeMake(workgroups[0], workgroups[1], workgroups[2])
+ threadsPerThreadgroup:MTLSizeMake(workgroup_size.x, workgroup_size.y, workgroup_size.z)];
return OkStatus();
}
diff --git a/iree/hal/metal/metal_kernel_library.mm b/iree/hal/metal/metal_kernel_library.mm
index 7cbdeb6..8ea7e6a 100644
--- a/iree/hal/metal/metal_kernel_library.mm
+++ b/iree/hal/metal/metal_kernel_library.mm
@@ -58,8 +58,7 @@
iree_MetalThreadgroupSize_vec_t threadgroup_sizes_vec =
iree_MetalExecutableDef_threadgroup_sizes(executable_def);
size_t threadgroup_size_count = iree_MetalThreadgroupSize_vec_len(threadgroup_sizes_vec);
- if (!metal_executable_def.threadgroup_sizes() ||
- metal_executable_def.threadgroup_sizes()->size() == 0) {
+ if (!threadgroup_size_count) {
return InvalidArgumentErrorBuilder(IREE_LOC) << "No threadgroup sizes present";
}
@@ -150,16 +149,17 @@
}
libraries.push_back(library);
- NSString* entry_point = [NSString stringWithCString:entry_point
- encoding:[NSString defaultCStringEncoding]];
- id<MTLFunction> function = [library newFunctionWithName:entry_point];
+ id<MTLFunction> function = [library
+ newFunctionWithName:[NSString stringWithCString:entry_point
+ encoding:[NSString defaultCStringEncoding]]];
if (!function) {
NSLog(@"Failed to create MTLFunction");
#ifndef NDEBUG
NSLog(@"Original MSL source: %@", shader_source);
#endif
return InvalidArgumentErrorBuilder(IREE_LOC)
- << "Cannot find entry point '" << entry_point << "' in shader source index " << i;
+ << "Cannot find entry point '" << entry_point << "' in shader source index "
+ << entry_ordinal;
}
id<MTLComputePipelineState> pso = [device newComputePipelineStateWithFunction:function
@@ -172,8 +172,8 @@
return InvalidArgumentErrorBuilder(IREE_LOC) << "Invalid MSL source";
}
- kernel_objects.push_back(KernelObjects{
- function, iree_MetalThreadgroupSize_vec_at(threadgroup_sizes_vec, entry_ordinal), pso});
+ kernel_objects.push_back(
+ KernelObjects{function, {static_cast<uint32_t>(iree_MetalThreadgroupSize__size())}, pso});
}
}