Skip to content

Commit

Permalink
Handle file paths with spaces (triton-lang#3305) (triton-lang#3450)
Browse files Browse the repository at this point in the history
A call to split() on a file path string results in a truncated path if
the latter has spaces in it, then the target binary is not found. It was
an unnecessary step.
  • Loading branch information
fkouteib authored Mar 25, 2024
1 parent 2d80562 commit eb59314
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions third_party/nvidia/backend/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ def _path_to_binary(binary: str):
os.path.join(os.path.dirname(__file__), "bin", binary),
]

for p in paths:
bin = p.split(" ")[0]
for bin in paths:
if os.path.exists(bin) and os.path.isfile(bin):
result = subprocess.check_output([bin, "--version"], stderr=subprocess.STDOUT)
if result is not None:
version = re.search(r".*release (\d+\.\d+).*", result.decode("utf-8"), flags=re.MULTILINE)
if version is not None:
return p, version.group(1)
return bin, version.group(1)
raise RuntimeError(f"Cannot find {binary}")


Expand Down

0 comments on commit eb59314

Please sign in to comment.