From 3575d1959596985b01d753098c57f3404bbbaae2 Mon Sep 17 00:00:00 2001 From: Ruslan Baratov Date: Mon, 18 Mar 2019 21:48:58 +0300 Subject: [PATCH] Fix Xcode 10 metal compile error (#2836) --- python/tvm/contrib/xcode.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/tvm/contrib/xcode.py b/python/tvm/contrib/xcode.py index 8461f13feb97..a43dc9ae2bfe 100644 --- a/python/tvm/contrib/xcode.py +++ b/python/tvm/contrib/xcode.py @@ -126,8 +126,13 @@ def compile_metal(code, path_target=None, sdk="macosx"): out_file.write(code) file_target = path_target if path_target else temp_target + # See: + # - https://developer.apple.com/documentation/metal/gpu_functions_libraries/building_a_library_with_metal_s_command-line_tools#overview # pylint: disable=line-too-long + # + # xcrun -sdk macosx metal -c MyLibrary.metal -o MyLibrary.air + # xcrun -sdk macosx metallib MyLibrary.air -o MyLibrary.metallib cmd1 = ["xcrun", "-sdk", sdk, "metal", "-O3"] - cmd1 += [temp_code, "-o", temp_ir] + cmd1 += ["-c", temp_code, "-o", temp_ir] cmd2 = ["xcrun", "-sdk", sdk, "metallib"] cmd2 += [temp_ir, "-o", file_target] proc = subprocess.Popen(