[Mlir-commits] [mlir] [mlir][sparse][gpu] Add libgen support for transposed SpMV and SpMM (PR #230412)
Vito Secona
llvmlistbot at llvm.org
Mon Oct 12 23:52:58 PDT 2026
================
@@ -591,8 +592,11 @@ static LogicalResult rewriteSpMV(PatternRewriter &rewriter,
// x : memX -> vecX
// y : memY -> vecY
Value nseA = NumberOfEntriesOp::create(rewriter, loc, a);
- Value szY = linalg::createOrFoldDimOp(rewriter, loc, a, 0);
- Value szX = linalg::createOrFoldDimOp(rewriter, loc, a, 1);
+ Value rows = linalg::createOrFoldDimOp(rewriter, loc, a, 0);
+ Value cols = linalg::createOrFoldDimOp(rewriter, loc, a, 1);
+ bool isTranspose = modeA != gpu::TransposeMode::NON_TRANSPOSE;
----------------
secona wrote:
I'm leaning towards keeping the TransposeMode param and setting the isTranpose from it rather than passing bool as a param. With this, it should be possible to pass CONJUGATE_TRANSPOSE to rewriteSpMV and rewriteSpMM and lower it to the correct cusparse calls.
I've pushed this, let me know your thoughts. One missing mechanism is recognizing a conjugate transpose operation in a linalg.generic op, which I've deferred to be a future work.
https://github.com/llvm/llvm-project/pull/230412
More information about the Mlir-commits
mailing list