Skip to content

Commit

Permalink
[upstream] Fix Xcode 10 metal compile error (apache#2836)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslo committed Mar 19, 2019
1 parent c2bb478 commit 28950f9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/tvm/contrib/xcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 28950f9

Please sign in to comment.