[polly] polly: Fix files that contain Python 3 SyntaxErrors (PR #124424)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 27 08:01:16 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r 178f47143a3b3c547df6d1f07e9707792f5d9fd4...904db93b5c101357059d183adb49ff31b350f3b3 polly/lib/External/isl/imath/tools/findthreshold.py polly/utils/jscop2cloog.py polly/utils/pyscop/jscop2iscc.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- lib/External/isl/imath/tools/findthreshold.py 2025-01-25 20:35:18.000000 +0000
+++ lib/External/isl/imath/tools/findthreshold.py 2025-01-27 16:00:43.701717 +0000
@@ -60,12 +60,11 @@
def compute_stats():
check_binary('imtimer')
seed = int(time.time())
- print("Computing timer statistics (this may take a while)",
- file=sys.stderr)
+ 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)
stats[prec] = (None, 1000000., 0.)
@@ -85,11 +84,10 @@
if __name__ == "__main__":
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()
# Here there be dragons
--- utils/jscop2cloog.py 2025-01-25 20:35:18.000000 +0000
+++ utils/jscop2cloog.py 2025-01-27 16:00:43.815015 +0000
@@ -1,35 +1,36 @@
#!/usr/bin/env python
import argparse, os
import json
def getDomains(scop):
- statements = scop['statements'];
- numStatements = len(statements)
+ statements = scop["statements"]
+ numStatements = len(statements)
- output = "%s\n\n" % str(numStatements)
+ output = "%s\n\n" % str(numStatements)
- for statement in scop['statements']:
- output += "%s\n\n" % statement['domain']
- output += "0 0 0 # for future options\n\n"
+ for statement in scop["statements"]:
+ output += "%s\n\n" % statement["domain"]
+ output += "0 0 0 # for future options\n\n"
+
+ return output
- return output
+def getSchedules(scop):
+ statements = scop["statements"]
+ numStatements = len(statements)
-def getSchedules(scop):
- statements = scop['statements'];
- numStatements = len(statements)
+ output = "%s\n\n" % str(numStatements)
- output = "%s\n\n" % str(numStatements)
+ for statement in scop["statements"]:
+ output += "%s\n\n" % statement["schedule"]
- for statement in scop['statements']:
- output += "%s\n\n" % statement['schedule']
+ return output
- return output
def writeCloog(scop):
- template = """
+ template = """
# ---------------------- CONTEXT ----------------------
c # language is C
# Context (no constraints on two parameters)
%s
@@ -45,24 +46,24 @@
%s
0 # We do not want to set manually the schedule dimension names
"""
- context = scop['context']
- domains = getDomains(scop)
- schedules = getSchedules(scop)
- print(template % (context, domains, schedules))
+ context = scop["context"]
+ domains = getDomains(scop)
+ schedules = getSchedules(scop)
+ print(template % (context, domains, schedules))
+
def __main__():
- description = 'Translate JSCoP into iscc input'
- parser = argparse.ArgumentParser(description)
- parser.add_argument('inputFile', metavar='N', type=file,
- help='The JSCoP file')
+ description = "Translate JSCoP into iscc input"
+ parser = argparse.ArgumentParser(description)
+ parser.add_argument("inputFile", metavar="N", type=file, help="The JSCoP file")
- args = parser.parse_args()
- inputFile = args.inputFile
- scop = json.load(inputFile)
+ args = parser.parse_args()
+ inputFile = args.inputFile
+ scop = json.load(inputFile)
- writeCloog(scop)
+ writeCloog(scop)
+
__main__()
-
--- utils/pyscop/jscop2iscc.py 2025-01-26 08:49:20.000000 +0000
+++ utils/pyscop/jscop2iscc.py 2025-01-27 16:00:43.961573 +0000
@@ -2,69 +2,68 @@
from __future__ import print_function
import argparse, isl, os
import json
+
def printDomain(scop):
+ domain = isl.USet("{}")
- domain = isl.USet('{}')
+ for statement in scop["statements"]:
+ domain = domain.union(isl.USet(statement["domain"]))
- for statement in scop['statements']:
- domain = domain.union(isl.USet(statement['domain']))
+ print("D :=", end=" ")
+ print(str(domain) + ";")
- print("D :=", end=" ")
- print(str(domain) + ";")
def printAccesses(scop):
+ read = isl.UMap("{}")
- read = isl.UMap('{}')
+ for statement in scop["statements"]:
+ for access in statement["accesses"]:
+ if access["kind"] == "read":
+ read = read.union(isl.UMap(access["relation"]))
- for statement in scop['statements']:
- for access in statement['accesses']:
- if access['kind'] == 'read':
- read = read.union(isl.UMap(access['relation']))
+ print("R :=", end=" ")
+ print(str(read) + ";")
- print("R :=", end=" ")
- print(str(read) + ";")
+ write = isl.UMap("{}")
- write = isl.UMap('{}')
+ for statement in scop["statements"]:
+ for access in statement["accesses"]:
+ if access["kind"] == "write":
+ write = write.union(isl.UMap(access["relation"]))
- for statement in scop['statements']:
- for access in statement['accesses']:
- if access['kind'] == 'write':
- write = write.union(isl.UMap(access['relation']))
+ print("W :=", end=" ")
+ print(str(write) + ";")
- print("W :=", end=" ")
- print(str(write) + ";")
def printSchedule(scop):
+ schedule = isl.UMap("{}")
- schedule = isl.UMap('{}')
+ for statement in scop["statements"]:
+ schedule = schedule.union(isl.UMap(statement["schedule"]))
- for statement in scop['statements']:
- schedule = schedule.union(isl.UMap(statement['schedule']))
+ print("S :=", end=" ")
+ print(str(schedule) + ";")
- print("S :=", end=" ")
- print(str(schedule) + ";")
def __main__():
- description = 'Translate JSCoP into iscc input'
- parser = argparse.ArgumentParser(description)
- parser.add_argument('inputFile', metavar='N', type=file,
- help='The JSCoP file')
+ description = "Translate JSCoP into iscc input"
+ parser = argparse.ArgumentParser(description)
+ parser.add_argument("inputFile", metavar="N", type=file, help="The JSCoP file")
- args = parser.parse_args()
- inputFile = args.inputFile
- scop = json.load(inputFile)
+ args = parser.parse_args()
+ inputFile = args.inputFile
+ scop = json.load(inputFile)
- printDomain(scop)
- printAccesses(scop)
- printSchedule(scop)
+ printDomain(scop)
+ 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__()
-
``````````
</details>
https://github.com/llvm/llvm-project/pull/124424
More information about the llvm-commits
mailing list