Skip to content

Commit e799a63

Browse files
authored
Update GroupReduceUtils.h
1 parent 5153ae5 commit e799a63

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ATen/native/xpu/sycl/GroupReduceUtils.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,11 @@ inline T& GroupReduceWithoutBroadcast(
149149
shared[sg_id] = val;
150150
}
151151
item.barrier(sycl_local_fence);
152-
val = (g_tid < n_sg) ? shared[sg_id] : identity_element;
152+
val = identity_element;
153153
if (sg_id == 0) {
154+
for (int i = sg_tid; i < n_sg; i += SIMD) {
155+
val = op.combine(val, shared[i]);
156+
}
154157
val = SubgroupReduceWithoutBroadcast<T, ReduceOp, SIMD, DIM>(item, val, op);
155158
}
156159
return val;

0 commit comments

Comments
 (0)