Author: Justin Fargnoli
Date: 2025-08-28T15:32:17-07:00
New Revision: 10613ed67ca470a671c98280049812ea74f9c773

URL: 
https://github.com/llvm/llvm-project/commit/10613ed67ca470a671c98280049812ea74f9c773
DIFF: 
https://github.com/llvm/llvm-project/commit/10613ed67ca470a671c98280049812ea74f9c773.diff

LOG: Windows output "-m 32" error message to stdout

Added: 
    

Modified: 
    llvm/test/lit.cfg.py

Removed: 
    


################################################################################
diff  --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index b23922d01483a..05b5f02b9bd9a 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -377,14 +377,9 @@ def ptxas_supported_isa_versions(ptxas, major_version, 
minor_version):
 
 
 def ptxas_supported_sms(ptxas_executable):
-    result = subprocess.run(
-        [ptxas_executable, "--help"],
-        capture_output=True,
-        text=True,
-        check=True,
-    )
+    output = subprocess.check_output([ptxas_executable, "--help"], text=True)
 
-    gpu_arch_section = re.search(r"--gpu-name(.*?)--", result.stdout, 
re.DOTALL)
+    gpu_arch_section = re.search(r"--gpu-name(.*?)--", output, re.DOTALL)
     allowed_values = gpu_arch_section.group(1)
     supported_sms = re.findall(r"'sm_(\d+(?:[af]?))'", allowed_values)
 
@@ -394,17 +389,19 @@ def ptxas_supported_sms(ptxas_executable):
 
 
 def ptxas_supports_address_size_32(ptxas_executable):
+    # Linux outputs the error message to stderr, while Windows outputs to 
stdout.
+    # Pipe both to stdout to make sure we get the error message.
     result = subprocess.run(
         [ptxas_executable, "-m 32"],
-        capture_output=True,
+        stdout=subprocess.PIPE,
+        stderr=subprocess.STDOUT,
         text=True,
-        check=False,
     )
-    if "is not defined for option 'machine'" in result.stderr:
+    if "is not defined for option 'machine'" in result.stdout:
         return False
-    if "Missing .version directive at start of file" in result.stderr:
+    if "Missing .version directive at start of file" in result.stdout:
         return True
-    raise RuntimeError(f"Unexpected ptxas output: {result.stderr}")
+    raise RuntimeError(f"Unexpected ptxas output: {result.stdout}")
 
 
 def enable_ptxas(ptxas_executable):


        
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to