I'm trying to compile some compute kernel source, and force it to all run precise or fast.
The docs (https://developer.apple.com/documentation/metal/mtlcompileoptions/1515914-fastmathenabled?language=objc)say of MTLCompileOptions.fastMathEnabled -- The default value is
YES
. A YES
value also enables the high-precision variant of math functions for single-precision floating-point scalar and vector types.Is this a typo? NO would enable high precision, correct?
Second, it appears I can do this with a c++ namespace in the kernel source itself. Am I correct that doing so will override the setting in MTLCompileOptions.fastMathEnabled?
Can I wrap my kernel in
using namespace metal::fast // metal::precise
to get all float math to compile is one variant or the other? Will this change simple float operations as well? or just functions like clamp/saturate?
Thanks,
mike