Skip to content

Commit

Permalink
[BACKEND][CPU] Specify CPU target to native for GNU/Linux Arm (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuigesi authored and int3 committed Aug 28, 2024
1 parent fe48608 commit a4cdce4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/triton/runtime/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def quiet():
def _build(name, src, srcdir, library_dirs, include_dirs, libraries):
suffix = sysconfig.get_config_var('EXT_SUFFIX')
system = platform.system()
machine = platform.machine()
so = os.path.join(srcdir, '{name}{suffix}'.format(name=name, suffix=suffix))
# try to avoid setuptools if possible
cc = os.environ.get("CC")
Expand Down Expand Up @@ -57,6 +58,9 @@ def _build(name, src, srcdir, library_dirs, include_dirs, libraries):
cc_cmd += ["-std=c++17", "-fopenmp"]
if src.endswith(".s"):
cc_cmd += ["-gdwarf-5"]
if system == "Linux" and machine in ("aarch64", "arm64"):
# On Arm backend, some CPU (neoverse-v2) needs to be specified through -mcpu
cc_cmd += ["-mcpu=native"]
ret = subprocess.check_call(cc_cmd)
if ret == 0:
return so
Expand Down

0 comments on commit a4cdce4

Please sign in to comment.