[mlir][xegpu] `-xegpu-blocking` crashes on dynamic `xegpu.tensor_desc` loop-carried values
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
git version: e5afb8e0982c524ee79436a15fb7270d4b9436f3
Reproduce with:
```sh
mlir-opt -xegpu-blocking a.mlir
```
MLIR Program:
```mlir
#l = #xegpu.layout
module {
func.func @m(%arg0: !xegpu.tensor_desc)
-> !xegpu.tensor_desc {
%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) {
scf.yield %arg1 : !xegpu.tensor_desc
}
return %0 : !xegpu.tensor_desc
}
}
```
The same crash also reproduces with an `scf.while` loop-carried value:
```mlir
#l = #xegpu.layout
module {
func.func @m(%arg0: !xegpu.tensor_desc)
-> !xegpu.tensor_desc {
%true = arith.constant true
%0 = scf.while (%init = %arg0)
: (!xegpu.tensor_desc) -> (!xegpu.tensor_desc) {
scf.condition(%true) %init : !xegpu.tensor_desc
} do {
^bb0(%arg1: !xegpu.tensor_desc):
scf.yield %arg1 : !xegpu.tensor_desc
}
return %0 : !xegpu.tensor_desc
}
}
```
Stack trace:
```sh
mlir-opt: mlir/lib/Dialect/Utils/IndexingUtils.cpp:86:
int64_t mlir::computeProduct(ArrayRef):
Assertion `llvm::all_of(basis, [](int64_t s) { return s > 0; }) &&
"basis must be positive"' failed.
mlir::computeProduct(ArrayRef)
(anonymous namespace)::XeGPUBlockingPass::runOnOperation()::$_12::operator()(
ArrayRef, xegpu::DistributeLayoutAttr)
(anonymous namespace)::XeGPUBlockingPass::runOnOperation()::$_7::operator()(
xegpu::TensorDescType, SmallVectorImpl &)
mlir::TypeConverter::convertTypeImpl(...)
mlir::applyPartialConversion(...)
(anonymous namespace)::XeGPUBlockingPass::runOnOperation()
```
Contributor guide
Research direction
Start by running mlir-opt -xegpu-blocking with the supplied scf.for and scf.while examples. Trace XeGPUBlockingPass through TensorDescType conversion to the computeProduct assertion in mlir/lib/Dialect/Utils/IndexingUtils.cpp. Done means both dynamic loop-carried tensor descriptors are processed without a crash and the reproducer cases complete successfully.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100