set metal fast math default to 0 (disabled) (#3370)

* set metal fast math default to 0 (disabled)

It's a correctness fix because we use inf and nan. Let's see how slow it is

* skip failed onnx tests

* tmp DISABLE_COMPILER_CACHE=1 in metal benchmark

* Revert "tmp DISABLE_COMPILER_CACHE=1 in metal benchmark"

This reverts commit 22267df380.
This commit is contained in:
chenyu
2024-02-14 05:42:33 -05:00
committed by GitHub
parent 668324d92b
commit 078a2603d5
2 changed files with 2 additions and 2 deletions

View File

@@ -162,7 +162,7 @@ backend_test.exclude('test_resize_tf_crop_and_resize_cpu') # unsure about fill v
backend_test.exclude('test_ai_onnx_ml_label_encoder_tensor_value_only_mapping_cpu') # bad data type string
backend_test.exclude('test_ai_onnx_ml_label_encoder_tensor_mapping_cpu') # bad data type string
if Device.DEFAULT in ['GPU']:
if Device.DEFAULT in ['GPU', 'METAL']:
backend_test.exclude('test_resize_upsample_sizes_nearest_axes_2_3_cpu')
backend_test.exclude('test_resize_upsample_sizes_nearest_axes_3_2_cpu')
backend_test.exclude('test_resize_upsample_sizes_nearest_cpu')

View File

@@ -20,7 +20,7 @@ class MetalCompiler(Compiler):
return subprocess.check_output(['xcrun', '-sdk', 'macosx', 'metallib', '-', '-o', '-'], input=air)
else:
options = Metal.MTLCompileOptions.new()
options.setFastMathEnabled_(getenv("METAL_FAST_MATH", 1))
options.setFastMathEnabled_(getenv("METAL_FAST_MATH"))
library = unwrap2(self.device.device.newLibraryWithSource_options_error_(src, options, None))
return library.libraryDataContents().bytes().tobytes()