Issue 203676
Summary [mlir][xegpu] `-xegpu-blocking` crashes on dynamic `xegpu.tensor_desc` loop-carried values
Labels crash-on-valid, generated by fuzzer, mlir:xegpu
Assignees
Reporter Men-cotton
    git version: `e5afb8e0982c524ee79436a15fb7270d4b9436f3`

Reproduce with:

```sh
mlir-opt -xegpu-blocking a.mlir
```

MLIR Program:

```mlir
#l = #xegpu.layout<inst_data = [8]>
module {
 func.func @m(%arg0: !xegpu.tensor_desc<?xf32, #l>)
      -> !xegpu.tensor_desc<?xf32, #l> {
    %c0 = arith.constant 0 : index
    %c1 = arith.constant 1 : index
    %0 = scf.for %i = %c0 to %c1 step %c1
 iter_args(%arg1 = %arg0) -> (!xegpu.tensor_desc<?xf32, #l>) {
 scf.yield %arg1 : !xegpu.tensor_desc<?xf32, #l>
    }
    return %0 : !xegpu.tensor_desc<?xf32, #l>
  }
}
```

The same crash also reproduces with an `scf.while` loop-carried value:

```mlir
#l = #xegpu.layout<inst_data = [8]>
module {
  func.func @m(%arg0: !xegpu.tensor_desc<?xf32, #l>)
      -> !xegpu.tensor_desc<?xf32, #l> {
 %true = arith.constant true
    %0 = scf.while (%init = %arg0)
        : (!xegpu.tensor_desc<?xf32, #l>) -> (!xegpu.tensor_desc<?xf32, #l>) {
 scf.condition(%true) %init : !xegpu.tensor_desc<?xf32, #l>
    } do {
 ^bb0(%arg1: !xegpu.tensor_desc<?xf32, #l>):
      scf.yield %arg1 : !xegpu.tensor_desc<?xf32, #l>
    }
    return %0 : !xegpu.tensor_desc<?xf32, #l>
  }
}
```

Stack trace:

```sh
mlir-opt: mlir/lib/Dialect/Utils/IndexingUtils.cpp:86:
int64_t mlir::computeProduct(ArrayRef<int64_t>):
Assertion `llvm::all_of(basis, [](int64_t s) { return s > 0; }) &&
"basis must be positive"' failed.

mlir::computeProduct(ArrayRef<int64_t>)
(anonymous namespace)::XeGPUBlockingPass::runOnOperation()::$_12::operator()(
 ArrayRef<int64_t>, xegpu::DistributeLayoutAttr)
(anonymous namespace)::XeGPUBlockingPass::runOnOperation()::$_7::operator()(
 xegpu::TensorDescType, SmallVectorImpl<Type> &)
mlir::TypeConverter::convertTypeImpl(...)
mlir::applyPartialConversion(...)
(anonymous namespace)::XeGPUBlockingPass::runOnOperation()
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to