torch-mlir
torch-mlir copied to clipboard
Reduce MHLO #ifdefs
We try to avoid using #ifdefs because they make it impossible to test all the configurations easily.
I noticed two in TorchToMhlo that can be removed.
TORCH_MLIR_ENABLE_MHLO_STATIC_SHAPE TORCH_MLIR_ENABLE_MHLO_TRUNC_DIMSIZE_TO_I32
https://github.com/llvm/torch-mlir/blob/9d6ee48661cefa677950bcd262fe2824a4fa9d17/lib/Conversion/TorchToMhlo/Basic.cpp#L412
We should add those as pass options to the convert-torch-to-mhlo pass, and pass them down to the patterns that need them. (see here for how to add pass options: https://mlir.llvm.org/docs/PassManagement/#declarative-pass-specification)
cc @ZihengJiang @fortianyou
Sure! This is a good suggestion. I will try it out recently.
Fixed in https://github.com/llvm/torch-mlir/pull/1315