llvm / torch-mlir

The Torch-MLIR project aims to provide first class support from the PyTorch ecosystem to the MLIR ecosystem.
Other
1.35k stars 506 forks source link

Lit tests failing with STABLEHLO disabled #3816

Open dbabokin opened 2 weeks ago

dbabokin commented 2 weeks ago

When building with -DTORCH_MLIR_ENABLE_STABLEHLO=OFF and running lit tests, I see three fails:

  TORCH_MLIR :: Conversion/TorchToLinalg/sparse.mlir
  TORCH_MLIR :: Dialect/Torch/invalid.mlir
  TORCH_MLIR :: Dialect/Torch/ops.mlir

All of the fails are due to #sparse_tensor.encoding not being recogined:

bin/torch-mlir-opt < ../test/Conversion/TorchToLinalg/sparse.mlir -split-input-file -verify-diagnostics
module {
}

// -----
within split at <stdin>:3 offset :3:23: error: unexpected error: #"sparse_tensor"<"encoding<{ map = (d0, d1) -> (d0 : dense, d1 : compressed) }>"> : 'none' attribute created with unregistered dialect. If this is intended, please call allowUnregisteredDialects() on the MLIRContext, or use -allow-unregistered-dialect with the MLIR opt tool used
#CSR = #sparse_tensor.encoding<{ map = (d0, d1) -> (d0 : dense, d1 : compressed) }>
                      ^

#sparse_tensor.encoding was introduced in https://github.com/llvm/torch-mlir/pull/2809 and https://github.com/llvm/torch-mlir/pull/2799 by @aartbik.

The patches have nothing specific to STABLEHLO. I'm wondering if ifdefs for STABLEHLO covering too much code somewhere else.

aartbik commented 1 week ago

Due to a career switch, there will be a bit of a delay, but I will have a look!