Revert "Cycles: Make use of maximum concurrent compilations on Metal"

This reverts commit 63d3fc2dcb, because it
causes a build error on the buildbot.

Ref #109655
This commit is contained in:
Brecht Van Lommel
2023-07-03 20:29:50 +02:00
parent d0bbae8596
commit f4da74ed29

View File

@@ -15,6 +15,9 @@
CCL_NAMESPACE_BEGIN
/* limit to 2 MTLCompiler instances */
int max_mtlcompiler_threads = 2;
const char *kernel_type_as_string(MetalPipelineType pso_type)
{
switch (pso_type) {
@@ -289,21 +292,6 @@ void ShaderCache::load_kernel(DeviceKernel device_kernel,
/* create compiler threads on first run */
thread_scoped_lock lock(cache_mutex);
if (compile_threads.empty()) {
/* Limit to 2 MTLCompiler instances by default. In macOS >= 13.3 we can query the upper
* limit. */
int max_mtlcompiler_threads = 2;
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wobjc-method-access"
/* Note: Disable warning for missing method when building on older OS's. Compiled code will
* still work correctly when run on a system with the API available. */
if (@available(macOS 13.3, *)) {
/* Subtract one to avoid contention with the real-time GPU module. */
max_mtlcompiler_threads = max(2, [mtlDevice maximumConcurrentCompilationTaskCount] - 1);
}
# pragma clang diagnostic pop
metal_printf("Spawning %d Cycles kernel compilation threads\n", max_mtlcompiler_threads);
for (int i = 0; i < max_mtlcompiler_threads; i++) {
compile_threads.push_back(std::thread([&] { compile_thread_func(i); }));
}