From 877254f4e636ee292a95580469c1c8fc07650d51 Mon Sep 17 00:00:00 2001 From: Tianqi Chen <tqchen@users.noreply.github.com> Date: Fri, 13 Apr 2018 10:23:08 -0700 Subject: [PATCH] Fix metal backward compatibility (#1105) --- src/runtime/metal/metal_module.mm | 7 +++++-- tests/python/integration/test_ewise.py | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/runtime/metal/metal_module.mm b/src/runtime/metal/metal_module.mm index 4814d986b..4d9ffec84 100644 --- a/src/runtime/metal/metal_module.mm +++ b/src/runtime/metal/metal_module.mm @@ -83,8 +83,11 @@ class MetalModuleNode final :public runtime::ModuleNode { if (e.lib == nil) { if (fmt_ == "metal") { MTLCompileOptions *opts = [MTLCompileOptions alloc]; - opts.languageVersion = MTLLanguageVersion2_0; - opts.fastMathEnabled = YES; + // Use the default setting for now. + // by default most recent version is used. + // opts.languageVersion = MTLLanguageVersion2_0; + // opts.fastMathEnabled = YES; + opts = nil; e.lib = [ w->devices[device_id] newLibraryWithSource:[NSString stringWithUTF8String:data_.c_str()] diff --git a/tests/python/integration/test_ewise.py b/tests/python/integration/test_ewise.py index ee880ed1d..3ad464f75 100644 --- a/tests/python/integration/test_ewise.py +++ b/tests/python/integration/test_ewise.py @@ -98,8 +98,8 @@ def test_popcount(): check_device("llvm") check_device("cuda") check_device("opencl") - check_device("metal") if dtype == "uint32": + check_device("metal") check_device("vulkan") run('uint32') run('uint64') @@ -146,9 +146,10 @@ def test_add(): c.asnumpy(), a.asnumpy() + b.asnumpy(), rtol=1e-6) check_device("opencl") - check_device("metal") check_device("cuda") - check_device("vulkan") + if dtype == "float32": + check_device("metal") + check_device("vulkan") run("float32") run("int32") -- GitLab