llvm / llvm/torch-mlir

One or more Stablehlo test(s) crashing after llvm bump to 266a5a9cb9daa96c1eeaebc18e10f5a37d638734

Open
#3,549 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.9k
Forks
736
Avg merge
5d 22h
Merged PRs (30d)
15

Description

After bumping llvm-project to https://github.com/llvm/llvm-project/commit/266a5a9cb9daa96c1eeaebc18e10f5a37d638734, one or more Stablehlo test(s) crash and cause the CI to timeout here:
https://github.com/llvm/torch-mlir/actions/runs/9982523928/job/27588414876?pr=3544.

Python/torchvision version: stable

After running the Stablehlo tests sequentially using `python -m projects.pt1.e2e_testing.main -v --config=stablehlo -s`, the last test to run is `ReduceMaxAlongDimUnsignedInt`:

```
====================
StableHLO Backend IR
module attributes {torch.debug_module_name = "ReduceMaxAlongDimUnsignedInt"} {
func.func @forward(%arg0: tensor) -> (tensor, tensor) {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
%c = stablehlo.constant dense<128> : tensor
%c_0 = stablehlo.constant dense<0> : tensor
%dim = tensor.dim %arg0, %c0 : tensor
%dim_1 = tensor.dim %arg0, %c1 : tensor
%dim_2 = tensor.dim %arg0, %c2 : tensor
%from_elements = tensor.from_elements %dim, %dim_1, %dim_2 : tensor<3xindex>
%0 = stablehlo.dynamic_iota %from_elements, dim = 1 : (tensor<3xindex>) -> tensor
%1:2 = stablehlo.reduce(%arg0 init: %c), (%0 init: %c_0) across dimensions = [1] : (tensor, tensor, tensor, tensor) -> (tensor, tensor)
reducer(%arg1: tensor, %arg3: tensor) (%arg2: tensor, %arg4: tensor) {
%2 = stablehlo.compare GE, %arg1, %arg3, SIGNED : (tensor, tensor) -> tensor
%3 = stablehlo.select %2, %arg1, %arg3 : tensor, tensor
%4 = stablehlo.compare EQ, %arg1, %arg3, SIGNED : (tensor, tensor) -> tensor
%5 = stablehlo.minimum %arg2, %arg4 : tensor
%6 = stablehlo.select %2, %arg2, %arg4 : tensor, tensor
%7 = stablehlo.select %4, %5, %6 : tensor, tensor
stablehlo.return %3, %7 : tensor, tensor
}
return %1#0, %1#1 : tensor, tensor
}
}
```
and this error occurs after it:

python: /home/avsharma/torch-mlir/externals/llvm-project/mlir/lib/Transforms/Utils/DialectConversion.cpp:2868: llvm::LogicalResult legalizeUnresolvedMaterialization((anonymous namespace)::UnresolvedMaterializationRewrite &, DenseMap &, mlir::ConversionPatternRewriter &, mlir::detail::ConversionPatternRewriterImpl &, DenseMap> &): Assertion `newMaterialization.getType() == outputType && "materialization callback produced value of incorrect type"' failed.
Aborted (core dumped)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with projects.pt1.e2e_testing.main using the stablehlo configuration and sequential mode. Focus on ReduceMaxAlongDimUnsignedInt, the last test reported before the crash, and inspect the StableHLO IR alongside the DialectConversion.cpp assertion. Done means the StableHLO tests complete without the crash or CI timeout after the LLVM bump.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python, pytorch
Domain
ci-cd, compilers, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.