Cycles: Apple M3 tuning including hardware raytracing #114296

Merged
Michael Jones (Apple) merged 1 commits from Michael-Jones/blender:AppleM3 into blender-v4.0-release 2023-10-31 11:14:31 +01:00
4 changed files with 13 additions and 0 deletions

View File

@ -74,6 +74,9 @@ void device_metal_info(vector<DeviceInfo> &devices)
}
# endif
/* Use hardware raytracing for faster rendering on architectures that support it. */
info.use_metalrt_by_default = (MetalInfo::get_apple_gpu_architecture(device) >= APPLE_M3);
devices.push_back(info);
device_index++;
}

View File

@ -41,6 +41,12 @@ struct ShaderCache {
if (MetalInfo::get_device_vendor(mtlDevice) == METAL_GPU_APPLE) {
switch (MetalInfo::get_apple_gpu_architecture(mtlDevice)) {
default:
case APPLE_M3:
/* Peak occupancy is achieved through Dynamic Caching on M3 GPUs. */
for (size_t i = 0; i < DEVICE_KERNEL_NUM; i++) {
occupancy_tuning[i] = {64, 64};
}
break;
case APPLE_M2_BIG:
occupancy_tuning[DEVICE_KERNEL_INTEGRATOR_COMPACT_SHADOW_STATES] = {384, 128};
occupancy_tuning[DEVICE_KERNEL_INTEGRATOR_INIT_FROM_CAMERA] = {640, 128};

View File

@ -31,6 +31,7 @@ enum AppleGPUArchitecture {
APPLE_M1,
APPLE_M2,
APPLE_M2_BIG,
APPLE_M3,
};
/* Contains static Metal helper functions. */

View File

@ -56,6 +56,9 @@ AppleGPUArchitecture MetalInfo::get_apple_gpu_architecture(id<MTLDevice> device)
else if (strstr(device_name, "M2")) {
return get_apple_gpu_core_count(device) <= 10 ? APPLE_M2 : APPLE_M2_BIG;
}
else if (strstr(device_name, "M3")) {
return APPLE_M3;
}
return APPLE_UNKNOWN;
}