Skip to content

Commit 71cb942

Browse files
authored
[torch-mlir][sparse] register sparse tensor dialect for all rewriting (llvm#3918)
We incorrectly relied on the fact that StableHLO registers the sparse tensor dialect, but when building for e.g. just LinAlg, the dependency was missing. This fixes this shortcoming. FIXES: llvm#3816
1 parent 8e0eafd commit 71cb942

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/InitAll.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "mlir/Dialect/MLProgram/IR/MLProgram.h"
1717
#include "mlir/Dialect/MemRef/IR/MemRef.h"
1818
#include "mlir/Dialect/SCF/IR/SCF.h"
19+
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
1920
#include "mlir/Dialect/Tensor/IR/Tensor.h"
2021
#include "mlir/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.h"
2122
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
@@ -52,7 +53,8 @@ void mlir::torch::registerOptionalInputDialects(
5253
mlir::DialectRegistry &registry) {
5354
registry.insert<complex::ComplexDialect, linalg::LinalgDialect,
5455
memref::MemRefDialect, ml_program::MLProgramDialect,
55-
scf::SCFDialect, tensor::TensorDialect, tosa::TosaDialect>();
56+
scf::SCFDialect, sparse_tensor::SparseTensorDialect,
57+
tensor::TensorDialect, tosa::TosaDialect>();
5658
}
5759

5860
void mlir::torch::registerAllPasses() {

0 commit comments

Comments
 (0)