Skip to content

Commit 4f3878a

Browse files
author
git apple-llvm automerger
committed
Merge commit 'e9b1c974be27' from llvm.org/main into next
2 parents bcf9f83 + e9b1c97 commit 4f3878a

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

mlir/test/python/dialects/sparse_tensor/test_SpMM.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,16 @@ class SparseCompiler:
116116

117117
def __init__(self, options: str):
118118
pipeline = (
119+
f'builtin.func(linalg-generalize-named-ops,linalg-fuse-elementwise-ops),'
119120
f'sparsification{{{options}}},'
120121
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),'
122123
f'convert-scf-to-std,'
123124
f'func-bufferize,'
124125
f'tensor-constant-bufferize,'
125126
f'builtin.func(tensor-bufferize,std-bufferize,finalizing-bufferize),'
126127
f'convert-vector-to-llvm{{reassociate-fp-reductions=1 enable-index-optimizations=1}},'
128+
f'lower-affine,'
127129
f'convert-memref-to-llvm,'
128130
f'convert-std-to-llvm,'
129131
f'reconcile-unrealized-casts')
@@ -134,7 +136,7 @@ def __call__(self, module: ir.Module):
134136

135137

136138
# CHECK-LABEL: TEST: testSpMM
137-
# CHECK: Passed 72 tests
139+
# CHECK: Passed 8 tests
138140
@run
139141
def testSpMM():
140142
# Obtain path to runtime support library.
@@ -143,18 +145,17 @@ def testSpMM():
143145

144146
with ir.Context() as ctx, ir.Location.unknown():
145147
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.
148152
par = 0
149153
vec = 0
150154
vl = 1
151155
e = False
152156
opt = (f'parallelization-strategy={par} '
153157
f'vectorization-strategy={vec} '
154158
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!
158159
levels = [[st.DimLevelType.dense, st.DimLevelType.dense],
159160
[st.DimLevelType.dense, st.DimLevelType.compressed],
160161
[st.DimLevelType.compressed, st.DimLevelType.dense],
@@ -163,7 +164,7 @@ def testSpMM():
163164
ir.AffineMap.get_permutation([0, 1]),
164165
ir.AffineMap.get_permutation([1, 0])
165166
]
166-
bitwidths = [0, 8, 32]
167+
bitwidths = [0]
167168
for level in levels:
168169
for ordering in orderings:
169170
for pwidth in bitwidths:

0 commit comments

Comments
 (0)