6 def __init__(self
, filename
):
7 f
= open(filename
, "r")
8 self
.json
= json
.load(f
)
12 return json
.dumps(self
.json
, indent
=2)
19 return self
.json
["statements"]
24 Create a map that interchanges two dimensions 'A' and 'B'
26 numberDimensions: The overall number of dimensions
27 dimensionA: The dimension of dimension 'A'
28 dimensionB: The dimension of dimension 'B'
30 getInterchange(2, 0, 1):
31 {[d0, d1] -> [d1, d0]}
35 def getInterchange(numberDimensions
, dimensionA
, dimensionB
):
37 dims
= ["d" + str(i
) for i
in range(numberDimensions
)]
38 dimString
= ",".join(dims
)
41 first
= dims
[dimensionA
]
42 second
= dims
[dimensionB
]
43 changedDims
[dimensionA
] = second
44 changedDims
[dimensionB
] = first
45 changedDimString
= ",".join(changedDims
)
47 return Map("{[%s] -> [%s]}" % (dimString
, changedDimString
))
50 Create a map that strip mines one dimension
52 numberDimensions: The overall number of dimensions
53 stripMineDim: The dimension to strip mine
54 factor: The strip mining factor
56 getStripMine(2, 1, 64):
57 {[d0, d1] -> [d0, o, d1] : o % 64 = 0 and o <= d1 <= d1 + 63}
61 def getStripMine(numberDimensions
, stripMineDim
, factor
):
63 dims
= ["d" + str(i
) for i
in range(numberDimensions
)]
64 dimString
= ",".join(dims
)
67 smd
= dims
[stripMineDim
]
68 changedDims
[stripMineDim
] = "o,%s" % smd
69 changedDimString
= ",".join(changedDims
)
70 string
= "{[%s] -> [%s]: o %% %i = 0 and o <= %s <= o + %i}" % (