When lowering some KernelBench programs (level2: 18, 22, 42, 43, 45, 51, 58, 64), I get this error:
error: failed to legalize operation 'torch.constant.bool'
Reproducer:
Clone Lighthouse
Init uv as in README
Run: $ uv run examples/KernelBench/test-kernel-bench.py --kernel level2/18_
Error message:
error: failed to legalize operation 'torch.constant.bool'
ERROR: got an error converting /home/rengolin/devel/llvm/lighthouse/third_party/KernelBench/KernelBench/level2/18_Matmul_Sum_Max_AvgPool_LogSumExp_LogSumExp.py to MLIR:
...
File "/home/rengolin/devel/llvm/lighthouse/.venv/lib/python3.12/site-packages/torch_mlir/compiler_utils.py", line 136, in run_pipeline_with_repro_report
raise TorchMlirCompilerError(trimmed_message) from None
torch_mlir.compiler_utils.TorchMlirCompilerError: Lowering Torch Backend IR -> Linalg-on-Tensors Backend IR failed with the following diagnostics:
python exception: Failure while executing pass pipeline
For Torch-MLIR developers, the error can be reproduced with:
$ torch-mlir-opt -pass-pipeline='builtin.module(torch-backend-to-linalg-on-tensors-backend-pipeline{allow-non-finites=True})' /tmp/UnnammedModule.mlir
Add '-mlir-print-ir-after-all -mlir-disable-threading' to get the IR dump for debugging purpose.
Kernel 18 has:
x = torch.sum(x, dim=1, keepdim=True) # (batch_size, 1)
And the others with the same error have a similar pattern: keepdim=True.
When lowering some KernelBench programs (level2: 18, 22, 42, 43, 45, 51, 58, 64), I get this error:
error: failed to legalize operation 'torch.constant.bool'Reproducer:
Clone Lighthouse
Init uv as in README
Run:
$ uv run examples/KernelBench/test-kernel-bench.py --kernel level2/18_Error message:
Kernel 18 has:
x = torch.sum(x, dim=1, keepdim=True) # (batch_size, 1)And the others with the same error have a similar pattern:
keepdim=True.