-
Notifications
You must be signed in to change notification settings - Fork 842
Description
Description
The compiler crashes during the LLVMCPUSelectLoweringStrategy pass when compiling an iree_linalg_ext.attention op with fully dynamic 3D input shapes (tensor<?x?x?xf32>).
The crash occurs in setRootConfig for AttentionOp when calling limitVectorTileSizes.
Reproducer
Save as attention_crash.mlir:
module @attention_crash {
util.func public @attention(
%query: tensor<?x?x?xf32>,
%key: tensor<?x?x?xf32>,
%value: tensor<?x?x?xf32>,
%scale: f32
) -> tensor<?x?x?xf32> {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
%batch = tensor.dim %query, %c0 : tensor<?x?x?xf32>
%seq_len = tensor.dim %query, %c1 : tensor<?x?x?xf32>
%head_dim = tensor.dim %query, %c2 : tensor<?x?x?xf32>
%output_init = tensor.empty(%batch, %seq_len, %head_dim) : tensor<?x?x?xf32>
%output = iree_linalg_ext.attention {
indexing_maps = [
affine_map<(d0, d1, d2, d3, d4) -> (d0, d1, d2)>,
affine_map<(d0, d1, d2, d3, d4) -> (d0, d3, d2)>,
affine_map<(d0, d1, d2, d3, d4) -> (d0, d3, d4)>,
affine_map<(d0, d1, d2, d3, d4) -> ()>,
affine_map<(d0, d1, d2, d3, d4) -> (d0, d1, d4)>
]
} ins(%query, %key, %value, %scale : tensor<?x?x?xf32>, tensor<?x?x?xf32>, tensor<?x?x?xf32>, f32)
outs(%output_init : tensor<?x?x?xf32>) {
^bb0(%arg0: f32):
iree_linalg_ext.yield %arg0 : f32
} -> tensor<?x?x?xf32>
util.return %output : tensor<?x?x?xf32>
}
}Compile with:
iree-compile attention_crash.mlir --iree-hal-target-backends=llvm-cpu -o /dev/nullStack trace (key frames)
#4 limitVectorTileSizes(...) KernelDispatch.cpp:747
#8 setRootConfig(..., AttentionOp) KernelDispatch.cpp:2344
#14 LLVMCPUSelectLoweringStrategyPass::runOnOperation() LLVMCPUSelectLoweringStrategy.cpp:238
Environment
- IREE: pip package (current release)
- OS: Fedora 43, Linux 6.17
- Target:
llvm-cpu
Notes
Static shapes compile successfully. The crash appears to occur during tile size computation when shapes are unknown at compile time.
This issue was authored by Claude (Opus 4.5) and reviewed by @stellaraccident.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels