Skip to content

Commit

Permalink
Don't use libgcc on macos clang
Browse files Browse the repository at this point in the history
  • Loading branch information
digantdesai committed Oct 29, 2024
1 parent 8c2c457 commit 396899c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions python/triton/runtime/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,14 @@ def _build(name, src, srcdir, library_dirs, include_dirs, libraries):
include_dirs = include_dirs + [srcdir, py_include_dir, *custom_backend_dirs]
# for -Wno-psabi, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111047
cc_cmd = [cc, src, "-O3", "-shared", "-fPIC", "-Wno-psabi", "-o", so]

libraries += ["gcc"]
# Use dynamic lookup to load Python library on Mac
if system == "Darwin":
cc_cmd += ["-undefined", "dynamic_lookup"]
# Don't use libgcc on clang + macos
if "clang" in cc:
libraries.remove("gcc")
cc_cmd += [f'-l{lib}' for lib in libraries]
cc_cmd += [f"-L{dir}" for dir in library_dirs]
cc_cmd += [f"-I{dir}" for dir in include_dirs if dir is not None]
Expand Down
2 changes: 1 addition & 1 deletion third_party/cpu/backend/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def make_so(src, metadata, options):
asm_path = os.path.join(tmpdir, "kernel.s")
Path(asm_path).write_text(src)
lib_dirs = cpu_driver.library_dirs
libs = ["gcc", "m", "TritonCPURuntime", "sleef"]
libs = ["m", "TritonCPURuntime", "sleef"]
so = _build("kernel", asm_path, tmpdir, lib_dirs, cpu_driver.include_dirs, libs)
with open(so, "rb") as f:
return f.read()
Expand Down

0 comments on commit 396899c

Please sign in to comment.