Page MenuHome

Enable inlining on Apple Silicon. Use new process-wide ShaderCache in order to safely re-enable binary archives
ClosedPublic

Authored by Michael Jones (michael_jones) on May 11 2022, 3:12 PM.

Details

Summary

This patch is the same as D14763, but with a fix for unit test failures caused by ShaderCache fetch logic not working in the non-MetalRT case:

diff --git a/intern/cycles/device/metal/kernel.mm b/intern/cycles/device/metal/kernel.mm
index ad268ae7057..6aa1a56056e 100644
--- a/intern/cycles/device/metal/kernel.mm
+++ b/intern/cycles/device/metal/kernel.mm
@@ -203,9 +203,12 @@ bool kernel_has_intersection(DeviceKernel device_kernel)
 
   /* metalrt options */
   request.pipeline->use_metalrt = device->use_metalrt;
-  request.pipeline->metalrt_hair = device->kernel_features & KERNEL_FEATURE_HAIR;
-  request.pipeline->metalrt_hair_thick = device->kernel_features & KERNEL_FEATURE_HAIR_THICK;
-  request.pipeline->metalrt_pointcloud = device->kernel_features & KERNEL_FEATURE_POINTCLOUD;
+  request.pipeline->metalrt_hair = device->use_metalrt &&
+                                   (device->kernel_features & KERNEL_FEATURE_HAIR);
+  request.pipeline->metalrt_hair_thick = device->use_metalrt &&
+                                         (device->kernel_features & KERNEL_FEATURE_HAIR_THICK);
+  request.pipeline->metalrt_pointcloud = device->use_metalrt &&
+                                         (device->kernel_features & KERNEL_FEATURE_POINTCLOUD);
 
   {
     thread_scoped_lock lock(cache_mutex);
@@ -225,9 +228,9 @@ bool kernel_has_intersection(DeviceKernel device_kernel)
 
   /* metalrt options */
   bool use_metalrt = device->use_metalrt;
-  bool metalrt_hair = device->kernel_features & KERNEL_FEATURE_HAIR;
-  bool metalrt_hair_thick = device->kernel_features & KERNEL_FEATURE_HAIR_THICK;
-  bool metalrt_pointcloud = device->kernel_features & KERNEL_FEATURE_POINTCLOUD;
+  bool metalrt_hair = use_metalrt && (device->kernel_features & KERNEL_FEATURE_HAIR);
+  bool metalrt_hair_thick = use_metalrt && (device->kernel_features & KERNEL_FEATURE_HAIR_THICK);
+  bool metalrt_pointcloud = use_metalrt && (device->kernel_features & KERNEL_FEATURE_POINTCLOUD);
 
   MetalKernelPipeline *best_pipeline = nullptr;
   for (auto &pipeline : collection) {

Diff Detail

Repository
rB Blender
Branch
arcpatch-D14923 (branched from master)
Build Status
Buildable 22070
Build 22070: arc lint + arc unit

Event Timeline

Michael Jones (michael_jones) requested review of this revision.May 11 2022, 3:12 PM
Michael Jones (michael_jones) created this revision.
  • Remove diagnostic printf
  • Remove unnecessary functions & add PSO NULL-check during MetalDeviceQueue::enqueue
  • Remove undefined method

Metal tests are passing on the buildbot now.
https://builder.blender.org/admin/#/builders/19/builds/386

This can be merged into master.

This revision is now accepted and ready to land.May 11 2022, 3:54 PM