[Mlir-commits] [mlir] [mlir][gpu] Fix crash in RemoveDeadValues pass with gpu.launch ops (PR #182711)
Matthias Springer
llvmlistbot at llvm.org
Sun Feb 22 05:50:57 PST 2026
================
@@ -942,6 +942,12 @@ static void printSizeAssignment(OpAsmPrinter &p, KernelDim3 size,
p << size.z << " = " << operands.z << ')';
}
+void LaunchOp::getEffects(
+ SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>>
+ &effects) {
+ effects.emplace_back(MemoryEffects::Write::get());
----------------
matthias-springer wrote:
This doesn't look correct to me. #182263 looks like a bug that happens to be triggered by `gpu.launch`, but could probably also be also be triggered with other ops. I don't think `gpu.launch` is the actual problem here.
Adding a side effect to `gpu.launch` is problematic because of this test case:
```mlir
// The GPU kernel does not have any side effecting ops, so the entire
// gpu.launch op can fold away.
// CHECK-LABEL: func @gpu_launch_without_side_effects
// CHECK-NOT: gpu.launch
func.func @gpu_launch_without_side_effects() { ... }
```
Given that we have such a test case, it looks like a kernel launch by itself is not considered a side-effecting step by the GPU dialect.
https://github.com/llvm/llvm-project/pull/182711
More information about the Mlir-commits
mailing list