Skip to content

Commit 9983592

Browse files
author
Peiming Liu
authored
[mlir][sparse] remove sparse encoding propagation pass. (#93593)
1 parent 73e22ff commit 9983592

File tree

3 files changed

+0
-55
lines changed

3 files changed

+0
-55
lines changed

mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ void populateSparseAssembler(RewritePatternSet &patterns, bool directOut);
6565
std::unique_ptr<Pass> createSparseAssembler();
6666
std::unique_ptr<Pass> createSparseAssembler(bool directOut);
6767

68-
//===----------------------------------------------------------------------===//
69-
// The SparseEncodingPropagation pass.
70-
//===----------------------------------------------------------------------===//
71-
72-
std::unique_ptr<Pass> createSparseEncodingPropagationPass();
73-
7468
//===----------------------------------------------------------------------===//
7569
// The SparseReinterpretMap pass.
7670
//===----------------------------------------------------------------------===//

mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -40,42 +40,6 @@ def SparseAssembler : Pass<"sparse-assembler", "ModuleOp"> {
4040
];
4141
}
4242

43-
def SparseEncodingPropagation : Pass<"sparse-encoding-propagation", "func::FuncOp"> {
44-
let summary = "Propagate sparse tensor encodings";
45-
let description = [{
46-
A pass that propagates sparse tensor encodings.
47-
48-
Background: To avoid introducing repetitive operations, sparse tensors
49-
in MLIR try to reuse tensor operations whenever available. However, most
50-
tensor operations are canonicalized/transformed without the knowledge
51-
of sparsity. The pass tries to propagate missing sparse encodings.
52-
53-
For example:
54-
```mlir
55-
%s = tensor.extract_slice %input[0, 0,] [2, 1] [1, 1]
56-
: tensor<2x3xf32, #sparse> to tensor<2x1xf32, #sparse>
57-
58-
// After rank reducing (by tensor dialect transformation)
59-
%t = tensor.extract_slice %input[0, 0,] [2, 1] [1, 1]
60-
: tensor<2x3xf32, #sparse> to tensor<2xf32>
61-
%s = tensor.expand_shape [[0, 1]] %t
62-
: tensor<2xf32> to tensor<2x1xf32, #sparse>
63-
64-
// After sparsity propagation
65-
%t = tensor.extract_slice %input[0, 0,] [2, 1] [1, 1]
66-
: tensor<2x3xf32, #sparse> to tensor<2xf32, #sparse1>
67-
%s = tensor.expand_shape [[0, 1]] %t
68-
: tensor<2xf32, #sparse1> to tensor<2x1xf32, #sparse>
69-
```
70-
}];
71-
72-
let constructor = "mlir::createSparseEncodingPropagationPass()";
73-
let dependentDialects = [
74-
"sparse_tensor::SparseTensorDialect",
75-
"tensor::TensorDialect",
76-
];
77-
}
78-
7943
def SparseReinterpretMap : Pass<"sparse-reinterpret-map", "ModuleOp"> {
8044
let summary = "Reinterprets sparse tensor type mappings";
8145
let description = [{

mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
namespace mlir {
2525
#define GEN_PASS_DEF_SPARSEASSEMBLER
26-
#define GEN_PASS_DEF_SPARSEENCODINGPROPAGATION
2726
#define GEN_PASS_DEF_SPARSEREINTERPRETMAP
2827
#define GEN_PASS_DEF_PRESPARSIFICATIONREWRITE
2928
#define GEN_PASS_DEF_SPARSIFICATIONPASS
@@ -61,14 +60,6 @@ struct SparseAssembler : public impl::SparseAssemblerBase<SparseAssembler> {
6160
}
6261
};
6362

64-
struct SparseEncodingPropagation
65-
: public impl::SparseEncodingPropagationBase<SparseEncodingPropagation> {
66-
SparseEncodingPropagation() = default;
67-
SparseEncodingPropagation(const SparseEncodingPropagation &pass) = default;
68-
69-
void runOnOperation() override {}
70-
};
71-
7263
struct SparseReinterpretMap
7364
: public impl::SparseReinterpretMapBase<SparseReinterpretMap> {
7465
SparseReinterpretMap() = default;
@@ -407,10 +398,6 @@ std::unique_ptr<Pass> mlir::createSparseAssembler() {
407398
return std::make_unique<SparseAssembler>();
408399
}
409400

410-
std::unique_ptr<Pass> mlir::createSparseEncodingPropagationPass() {
411-
return std::make_unique<SparseEncodingPropagation>();
412-
}
413-
414401
std::unique_ptr<Pass> mlir::createSparseReinterpretMapPass() {
415402
return std::make_unique<SparseReinterpretMap>();
416403
}

0 commit comments

Comments
 (0)