Skip to content

Commit

Permalink
[torch-mlir][sparse] register sparse tensor dialect for all rewriting (
Browse files Browse the repository at this point in the history
…#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: #3816
  • Loading branch information
aartbik authored Dec 17, 2024
1 parent 8e0eafd commit 71cb942
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/InitAll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "mlir/Dialect/MLProgram/IR/MLProgram.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
Expand Down Expand Up @@ -52,7 +53,8 @@ void mlir::torch::registerOptionalInputDialects(
mlir::DialectRegistry &registry) {
registry.insert<complex::ComplexDialect, linalg::LinalgDialect,
memref::MemRefDialect, ml_program::MLProgramDialect,
scf::SCFDialect, tensor::TensorDialect, tosa::TosaDialect>();
scf::SCFDialect, sparse_tensor::SparseTensorDialect,
tensor::TensorDialect, tosa::TosaDialect>();
}

void mlir::torch::registerAllPasses() {
Expand Down

0 comments on commit 71cb942

Please sign in to comment.