[polly] polly: Fix files that contain Python 3 SyntaxErrors (PR #124424)

Christian Clauss via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 07:57:51 PST 2025


https://github.com/cclauss updated https://github.com/llvm/llvm-project/pull/124424

>From 11c7a68b1e11a304b48badedaf182866b7e04208 Mon Sep 17 00:00:00 2001
From: Christian Clauss <cclauss at me.com>
Date: Sat, 25 Jan 2025 20:27:04 +0100
Subject: [PATCH 1/2] polly: Fix three Python files that contain SyntaxErrors

---
 .../External/isl/imath/tools/findthreshold.py |  9 +++----
 polly/utils/jscop2cloog.py                    |  2 +-
 polly/utils/pyscop/jscop2iscc.py              | 24 +++++++++----------
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/polly/lib/External/isl/imath/tools/findthreshold.py b/polly/lib/External/isl/imath/tools/findthreshold.py
index fbb325e1da916a..bdf2064a987672 100644
--- a/polly/lib/External/isl/imath/tools/findthreshold.py
+++ b/polly/lib/External/isl/imath/tools/findthreshold.py
@@ -62,7 +62,8 @@ def compute_stats():
     check_binary('imtimer')
     seed = int(time.time())
 
-    print >> sys.stderr, "Computing timer statistics (this may take a while)"
+    print("Computing timer statistics (this may take a while)",
+          file=sys.stderr)
     stats = {}
     for prec in (32, 40, 64, 80, 128, 150, 256, 384, 512, 600, 768, 1024):
         sys.stderr.write('%-4d ' % prec)
@@ -86,9 +87,9 @@ def compute_stats():
     stats = compute_stats()
     stats.sort(key=lambda s: s[3] / s[2])
     for prec, thresh, trec, tnorm in stats:
-        print "%d\t%d\t%.3f\t%.3f\t%.4f" % (prec, thresh, trec, tnorm,
-                                            tnorm / trec)
+        print("%d\t%d\t%.3f\t%.3f\t%.4f" % (prec, thresh, trec, tnorm,
+                                            tnorm / trec))
 
-    print
+    print()
 
 # Here there be dragons
diff --git a/polly/utils/jscop2cloog.py b/polly/utils/jscop2cloog.py
index 29383974f26780..1d8a31047d1164 100755
--- a/polly/utils/jscop2cloog.py
+++ b/polly/utils/jscop2cloog.py
@@ -50,7 +50,7 @@ def writeCloog(scop):
   context = scop['context']
   domains = getDomains(scop)
   schedules = getSchedules(scop)
-  print template % (context, domains, schedules)
+  print(template % (context, domains, schedules))
 
 def __main__():
   description = 'Translate JSCoP into iscc input'
diff --git a/polly/utils/pyscop/jscop2iscc.py b/polly/utils/pyscop/jscop2iscc.py
index 42f4cc180f1fb9..2ab27538d8632b 100755
--- a/polly/utils/pyscop/jscop2iscc.py
+++ b/polly/utils/pyscop/jscop2iscc.py
@@ -9,8 +9,8 @@ def printDomain(scop):
   for statement in scop['statements']:
     domain = domain.union(isl.USet(statement['domain']))
 
-  print "D :=",
-  print str(domain) + ";"
+  print("D :=", end=" ")
+  print(str(domain) + ";")
 
 def printAccesses(scop):
 
@@ -21,8 +21,8 @@ def printAccesses(scop):
       if access['kind'] == 'read':
         read = read.union(isl.UMap(access['relation']))
 
-  print "R :=",
-  print str(read) + ";"
+  print("R :=", end=" ")
+  print(str(read) + ";")
 
   write = isl.UMap('{}')
 
@@ -31,8 +31,8 @@ def printAccesses(scop):
       if access['kind'] == 'write':
         write = write.union(isl.UMap(access['relation']))
 
-  print "W :=",
-  print str(write) + ";"
+  print("W :=", end=" ")
+  print(str(write) + ";")
 
 def printSchedule(scop):
 
@@ -41,8 +41,8 @@ def printSchedule(scop):
   for statement in scop['statements']:
     schedule = schedule.union(isl.UMap(statement['schedule']))
 
-  print "S :=",
-  print str(schedule) + ";"
+  print("S :=", end=" ")
+  print(str(schedule) + ";")
 
 def __main__():
   description = 'Translate JSCoP into iscc input'
@@ -58,10 +58,10 @@ def __main__():
   printAccesses(scop)
   printSchedule(scop)
 
-  print 'R := R * D;'
-  print 'W := W * D;'
-  print 'Dep := (last W before R under S)[0];'
-  print 'schedule D respecting Dep minimizing Dep;'
+  print('R := R * D;')
+  print('W := W * D;')
+  print('Dep := (last W before R under S)[0];')
+  print('schedule D respecting Dep minimizing Dep;')
 
 
 __main__()

>From 2bf39ab6e5ff298b9643f0118bc9aad4620f7581 Mon Sep 17 00:00:00 2001
From: Christian Clauss <cclauss at me.com>
Date: Sun, 26 Jan 2025 09:49:20 +0100
Subject: [PATCH 2/2] jscop2iscc.py: from __future__ import print_function

---
 polly/utils/pyscop/jscop2iscc.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/polly/utils/pyscop/jscop2iscc.py b/polly/utils/pyscop/jscop2iscc.py
index 2ab27538d8632b..7ffccaf2deb1e4 100755
--- a/polly/utils/pyscop/jscop2iscc.py
+++ b/polly/utils/pyscop/jscop2iscc.py
@@ -1,4 +1,6 @@
 #!/usr/bin/env python
+from __future__ import print_function
+
 import argparse, isl, os
 import json
 



More information about the llvm-commits mailing list