Skip to content

Commit 10613ed

Browse files
Windows output "-m 32" error message to stdout
1 parent 56535ff commit 10613ed

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

llvm/test/lit.cfg.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -377,14 +377,9 @@ def ptxas_supported_isa_versions(ptxas, major_version, minor_version):
377377

378378

379379
def ptxas_supported_sms(ptxas_executable):
380-
result = subprocess.run(
381-
[ptxas_executable, "--help"],
382-
capture_output=True,
383-
text=True,
384-
check=True,
385-
)
380+
output = subprocess.check_output([ptxas_executable, "--help"], text=True)
386381

387-
gpu_arch_section = re.search(r"--gpu-name(.*?)--", result.stdout, re.DOTALL)
382+
gpu_arch_section = re.search(r"--gpu-name(.*?)--", output, re.DOTALL)
388383
allowed_values = gpu_arch_section.group(1)
389384
supported_sms = re.findall(r"'sm_(\d+(?:[af]?))'", allowed_values)
390385

@@ -394,17 +389,19 @@ def ptxas_supported_sms(ptxas_executable):
394389

395390

396391
def ptxas_supports_address_size_32(ptxas_executable):
392+
# Linux outputs the error message to stderr, while Windows outputs to stdout.
393+
# Pipe both to stdout to make sure we get the error message.
397394
result = subprocess.run(
398395
[ptxas_executable, "-m 32"],
399-
capture_output=True,
396+
stdout=subprocess.PIPE,
397+
stderr=subprocess.STDOUT,
400398
text=True,
401-
check=False,
402399
)
403-
if "is not defined for option 'machine'" in result.stderr:
400+
if "is not defined for option 'machine'" in result.stdout:
404401
return False
405-
if "Missing .version directive at start of file" in result.stderr:
402+
if "Missing .version directive at start of file" in result.stdout:
406403
return True
407-
raise RuntimeError(f"Unexpected ptxas output: {result.stderr}")
404+
raise RuntimeError(f"Unexpected ptxas output: {result.stdout}")
408405

409406

410407
def enable_ptxas(ptxas_executable):

0 commit comments

Comments
 (0)