[mpact][sparse] run pre-sparsification-rewrite before elementwise fus… (#57)
* [mpact][sparse] run pre-sparsification-rewrite before elementwise fusion.
* address comments.
diff --git a/python/mpact/mpactbackend.py b/python/mpact/mpactbackend.py
index a98bc60..425413a 100644
--- a/python/mpact/mpactbackend.py
+++ b/python/mpact/mpactbackend.py
@@ -212,6 +212,9 @@
+ ",".join(
[
"func.func(linalg-generalize-named-ops)",
+ # Run pre-sparsification pass to fuse convert/cast op into
+ # producer as they might hinder kernel fusions.
+ "pre-sparsification-rewrite",
"func.func(linalg-fuse-elementwise-ops)",
"convert-shape-to-std",
# Propagate sparse encodings before sparsifier mini-pipeline.
diff --git a/test/python/sqsum.py b/test/python/sqsum.py
index 2d21204..6f3294c 100644
--- a/test/python/sqsum.py
+++ b/test/python/sqsum.py
@@ -28,8 +28,10 @@
# Run it with MPACT.
print("mpact")
-# TODO: make this work, expose `sparse-emit-strategy=sparse-iterator` to
-# mini-pipeline.
+# Try sparsification with sparse iterator
+# TODO: will work after explicit value is specified in the encoding.
# res = mpact_jit(net, adj_mat, use_sp_it=True)
+# print(res)
+# Try sparsification directly with scf.for/while
res = mpact_jit(net, adj_mat)
print(res)