[Mlir-commits] [mlir] [mlir][gpu] Add `broadcast_lane` op (PR #152808)
Ivan Butygin
llvmlistbot at llvm.org
Sat Aug 9 14:40:30 PDT 2025
================
@@ -2511,6 +2511,43 @@ bool WarpExecuteOnLane0Op::areTypesCompatible(Type lhs, Type rhs) {
verifyDistributedType(lhs, rhs, getWarpSize(), getOperation()));
}
+//===----------------------------------------------------------------------===//
+// GPU_BroadcastLaneOp
+//===----------------------------------------------------------------------===//
+
+void gpu::BroadcastLaneOp::inferResultRanges(
+ ArrayRef<ConstantIntRanges> argRanges, SetIntRangeFn setResultRange) {
+ setResultRange(getResult(), argRanges.front());
+}
+
+Speculation::Speculatability gpu::BroadcastLaneOp::getSpeculatability() {
+ switch (getBroadcastType()) {
+ case BroadcastType::first_lane:
+ // Cannot speculate first_lane broadcast, because speculating it across
+ // control flow can change the active lanes.
+ return Speculation::NotSpeculatable;
+ case BroadcastType::any_lane:
+ LLVM_FALLTHROUGH;
+ case BroadcastType::lane:
----------------
Hardcode84 wrote:
technically, CSE can merge ops across blocks
```
%1 = gpu.broadcast %src, lane %idx
scf.if lane_id < 13 {
%2 = gpu.broadcast %src, lane %idx
}
```
not sure if it's a problem, though
https://github.com/llvm/llvm-project/pull/152808
More information about the Mlir-commits
mailing list