Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,68 @@
#!/usr/bin/python
import argparse, isl, os
import json
def printDomain(scop):
domain = isl.USet('{}')
for statement in scop['statements']:
domain = domain.union(isl.USet(statement['domain']))
print "D :=",
print str(domain) + ";"
def printAccesses(scop):
read = isl.UMap('{}')
for statement in scop['statements']:
for access in statement['accesses']:
if access['kind'] == 'read':
read = read.union(isl.UMap(access['relation']))
print "R :=",
print str(read) + ";"
write = isl.UMap('{}')
for statement in scop['statements']:
for access in statement['accesses']:
if access['kind'] == 'write':
write = write.union(isl.UMap(access['relation']))
print "W :=",
print str(write) + ";"
def printSchedule(scop):
schedule = isl.UMap('{}')
for statement in scop['statements']:
schedule = schedule.union(isl.UMap(statement['schedule']))
print "S :=",
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')
args = parser.parse_args()
inputFile = args.inputFile
scop = json.load(inputFile)
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;'
__main__()

View File

@@ -0,0 +1,68 @@
import json
from isl import *
class Scop:
def __init__(self, filename):
f = open(filename, 'r')
self.json = json.load(f)
return
def __str__(self):
return json.dumps(self.json, indent=2)
def __repr__(self):
return str(self)
@property
def statements(self):
return self.json['statements']
class Transforms:
"""
Create a map that interchanges two dimensions 'A' and 'B'
numberDimensions: The overall number of dimensions
dimensionA: The dimension of dimension 'A'
dimensionB: The dimension of dimension 'B'
getInterchange(2, 0, 1):
{[d0, d1] -> [d1, d0]}
"""
@staticmethod
def getInterchange(numberDimensions, dimensionA, dimensionB):
dims = ['d' + str(i) for i in range(numberDimensions)]
dimString = ",".join(dims)
changedDims = dims
first = dims[dimensionA]
second = dims[dimensionB]
changedDims[dimensionA] = second
changedDims[dimensionB] = first
changedDimString = ",".join(changedDims)
return Map("{[%s] -> [%s]}" % (dimString, changedDimString))
"""
Create a map that strip mines one dimension
numberDimensions: The overall number of dimensions
stripMineDim: The dimension to strip mine
factor: The strip mining factor
getStripMine(2, 1, 64):
{[d0, d1] -> [d0, o, d1] : o % 64 = 0 and o <= d1 <= d1 + 63}
"""
@staticmethod
def getStripMine(numberDimensions, stripMineDim, factor):
dims = ['d' + str(i) for i in range(numberDimensions)]
dimString = ",".join(dims)
changedDims = dims
smd = dims[stripMineDim]
changedDims[stripMineDim] = "o,%s" % smd
changedDimString = ",".join(changedDims)
string = "{[%s] -> [%s]: o %% %i = 0 and o <= %s <= o + %i}" % \
(dimString, changedDimString, factor, smd, factor - 1)
return Map(string)