[Metal] Enable Metal 4 shader compilation#19595
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a preprocessor check to support MTLLanguageVersion4_0 in the Metal runtime. Feedback indicates that since MTLLanguageVersion constants are enums and not macros, the current check will always evaluate to false, rendering the change ineffective. It is suggested to use SDK version macros for proper feature detection.
Use the latest SDK language version when available so generated MPP tensor_ops shaders can compile on M5+ while preserving the existing fallback for older SDKs.
7c4074d to
d19d152
Compare
|
Seems that there is something wrong with CI. Could you retrigger it? @oraluben |
tlopex
left a comment
There was a problem hiding this comment.
Thanks for updating the feature detection to use the SDK version macro.
I’m concerned that selecting MTLLanguageVersion4_0 solely based on the build SDK can introduce a runtime compatibility regression. A TVM binary built with a macOS 26 SDK may still run on systems/devices where Metal 4 is not supported, but this change would request MSL 4.0 for every Metal runtime compilation, including shaders that would otherwise compile fine with MTLLanguageVersion2_3.
Could we avoid making Metal 4 the unconditional language version whenever the build SDK exposes it? For example, either add a runtime/device capability guard, or try Metal 4 only when needed and fall back to MTLLanguageVersion2_3 if compilation fails.
Also, please clarify what environment was used to validate the new branch, since the current CI does not appear to exercise the __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000 path.
Use the latest SDK language version when available so generated MPP tensor_ops shaders can compile on M5+ while preserving the existing fallback for older SDKs.