[Mlir-commits] [mlir] [mlir][sparse] support sparsifying sparse kernels to sparse-iterator-based loop (PR #95858)
Aart Bik
llvmlistbot at llvm.org
Mon Jun 17 16:07:15 PDT 2024
================
@@ -2300,6 +2300,41 @@ void IterateOp::getCanonicalizationPatterns(mlir::RewritePatternSet &results,
results.add<RemoveUnusedLvlCrds>(context);
}
+void IterateOp::build(OpBuilder &builder, OperationState &odsState,
+ Value iterSpace, ValueRange initArgs) {
+ unsigned rank = llvm::cast<IterSpaceType>(iterSpace.getType()).getSpaceDim();
+ // All ones.
+ LevelSet set((1 << rank) - 1);
+ return build(builder, odsState, iterSpace, initArgs, set);
+}
+
+void IterateOp::build(OpBuilder &builder, OperationState &odsState,
+ Value iterSpace, ValueRange initArgs,
+ LevelSet crdUsedLvls) {
+ OpBuilder::InsertionGuard guard(builder);
+
+ odsState.addOperands(iterSpace);
+ odsState.addOperands(initArgs);
+ odsState.getOrAddProperties<Properties>().crdUsedLvls =
+ builder.getIntegerAttr(builder.getIntegerType(64), crdUsedLvls);
+ Region *bodyRegion = odsState.addRegion();
+ odsState.addTypes(initArgs.getTypes());
+ Block *bodyBlock = builder.createBlock(bodyRegion);
+
+ // 1st args, sparse iterator
----------------
aartbik wrote:
Spell it out, so it reads better
// First argument, sparse iterator.
(also period at end)
https://github.com/llvm/llvm-project/pull/95858
More information about the Mlir-commits
mailing list