@@ -116,14 +116,16 @@ class SparseCompiler:
116
116
117
117
def __init__ (self , options : str ):
118
118
pipeline = (
119
+ f'builtin.func(linalg-generalize-named-ops,linalg-fuse-elementwise-ops),'
119
120
f'sparsification{{{ options } }},'
120
121
f'sparse-tensor-conversion,'
121
- f'builtin.func(convert-linalg-to-loops,convert-vector-to-scf),'
122
+ f'builtin.func(linalg-bufferize, convert-linalg-to-loops,convert-vector-to-scf),'
122
123
f'convert-scf-to-std,'
123
124
f'func-bufferize,'
124
125
f'tensor-constant-bufferize,'
125
126
f'builtin.func(tensor-bufferize,std-bufferize,finalizing-bufferize),'
126
127
f'convert-vector-to-llvm{{reassociate-fp-reductions=1 enable-index-optimizations=1}},'
128
+ f'lower-affine,'
127
129
f'convert-memref-to-llvm,'
128
130
f'convert-std-to-llvm,'
129
131
f'reconcile-unrealized-casts' )
@@ -134,7 +136,7 @@ def __call__(self, module: ir.Module):
134
136
135
137
136
138
# CHECK-LABEL: TEST: testSpMM
137
- # CHECK: Passed 72 tests
139
+ # CHECK: Passed 8 tests
138
140
@run
139
141
def testSpMM ():
140
142
# Obtain path to runtime support library.
@@ -143,18 +145,17 @@ def testSpMM():
143
145
144
146
with ir .Context () as ctx , ir .Location .unknown ():
145
147
count = 0
146
- # Fixed compiler optimization strategy.
147
- # TODO: explore state space here too
148
+ # Loop over various ways to compile and annotate the SpMM kernel with
149
+ # a *single* sparse tensor. Note that we deliberate do not exhaustively
150
+ # search the full state space to reduce runtime of the test. It is
151
+ # straightforward to adapt the code below to explore more combinations.
148
152
par = 0
149
153
vec = 0
150
154
vl = 1
151
155
e = False
152
156
opt = (f'parallelization-strategy={ par } '
153
157
f'vectorization-strategy={ vec } '
154
158
f'vl={ vl } enable-simd-index32={ e } ' )
155
- # Exhaustive loop over various ways to annotate a kernel with
156
- # a *single* sparse tensor. Even this subset already gives
157
- # quite a large state space!
158
159
levels = [[st .DimLevelType .dense , st .DimLevelType .dense ],
159
160
[st .DimLevelType .dense , st .DimLevelType .compressed ],
160
161
[st .DimLevelType .compressed , st .DimLevelType .dense ],
@@ -163,7 +164,7 @@ def testSpMM():
163
164
ir .AffineMap .get_permutation ([0 , 1 ]),
164
165
ir .AffineMap .get_permutation ([1 , 0 ])
165
166
]
166
- bitwidths = [0 , 8 , 32 ]
167
+ bitwidths = [0 ]
167
168
for level in levels :
168
169
for ordering in orderings :
169
170
for pwidth in bitwidths :
0 commit comments