Cycles: Enable MNEE on Metal (macOS >= 13)
This patch enables MNEE on macOS >= 13. There was an inefficiency in the calculation of spill requirements, fixed as of macOS 13. This patch also adds a temporary inlining workaround for a Metal compiler bug which causes `mnee_compute_constraint_derivatives` to behave incorrectly. Reviewed By: brecht Differential Revision: https://developer.blender.org/D16235
This commit is contained in:
@@ -254,6 +254,10 @@ void MetalDevice::make_source(MetalPipelineType pso_type, const uint kernel_feat
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
|
||||||
|
NSOperatingSystemVersion macos_ver = [processInfo operatingSystemVersion];
|
||||||
|
global_defines += "#define __KERNEL_METAL_MACOS__ " + to_string(macos_ver.majorVersion) + "\n";
|
||||||
|
|
||||||
string &source = this->source[pso_type];
|
string &source = this->source[pso_type];
|
||||||
source = "\n#include \"kernel/device/metal/kernel.metal\"\n";
|
source = "\n#include \"kernel/device/metal/kernel.metal\"\n";
|
||||||
source = path_source_replace_includes(source, path_get("source"));
|
source = path_source_replace_includes(source, path_get("source"));
|
||||||
|
|||||||
@@ -279,7 +279,15 @@ ccl_device_forceinline void mnee_setup_manifold_vertex(KernelGlobals kg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Compute constraint derivatives. */
|
/* Compute constraint derivatives. */
|
||||||
ccl_device_forceinline bool mnee_compute_constraint_derivatives(
|
|
||||||
|
# if defined(__KERNEL_METAL__)
|
||||||
|
/* Temporary workaround for front-end compilation bug (incorrect MNEE rendering when this is
|
||||||
|
* inlined). */
|
||||||
|
__attribute__((noinline))
|
||||||
|
# else
|
||||||
|
ccl_device_forceinline
|
||||||
|
# endif
|
||||||
|
bool mnee_compute_constraint_derivatives(
|
||||||
int vertex_count,
|
int vertex_count,
|
||||||
ccl_private ManifoldVertex *vertices,
|
ccl_private ManifoldVertex *vertices,
|
||||||
ccl_private const float3 &surface_sample_pos,
|
ccl_private const float3 &surface_sample_pos,
|
||||||
|
|||||||
@@ -85,9 +85,9 @@ CCL_NAMESPACE_BEGIN
|
|||||||
# define __VOLUME_RECORD_ALL__
|
# define __VOLUME_RECORD_ALL__
|
||||||
#endif /* !__KERNEL_GPU__ */
|
#endif /* !__KERNEL_GPU__ */
|
||||||
|
|
||||||
/* MNEE currently causes "Compute function exceeds available temporary registers"
|
/* MNEE caused "Compute function exceeds available temporary registers" in macOS < 13 due to a bug
|
||||||
* on Metal, disabled for now. */
|
* in spill buffer allocation sizing. */
|
||||||
#ifndef __KERNEL_METAL__
|
#if !defined(__KERNEL_METAL__) || (__KERNEL_METAL_MACOS__ >= 13)
|
||||||
# define __MNEE__
|
# define __MNEE__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ BLACKLIST_OPTIX = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
BLACKLIST_METAL = [
|
BLACKLIST_METAL = [
|
||||||
# No MNEE for Metal currently
|
# MNEE only works on Metal with macOS >= 13
|
||||||
"underwater_caustics.blend",
|
"underwater_caustics.blend",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user