Skip to content

Commit

Permalink
Fix Xcode 10 metal compile error (#2836)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslo authored and tqchen committed Mar 18, 2019
1 parent 011f0b6 commit 3575d19
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 3575d19

Please sign in to comment.