Skip to content

Commit bce423c

Browse files
committed
[SYCL] Avoid re-computing group_range in nd_item class
This fix is mostly NFC. Instead of doing costly division operations and re-computing the group_range inside nd_item class, it is better to call group::get_group_range() that does not do divisions as the group class keeps the group_range as a pre-computed field. Signed-off-by: Vyacheslav N Klochkov <[email protected]>
1 parent 42c6f44 commit bce423c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

sycl/include/CL/sycl/nd_item.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,11 @@ template <int dimensions = 1> class nd_item {
8282
}
8383

8484
range<dimensions> get_group_range() const {
85-
return Group.get_global_range() / Group.get_local_range();
85+
return Group.get_group_range();
8686
}
8787

8888
size_t __SYCL_ALWAYS_INLINE get_group_range(int dimension) const {
89-
size_t Range =
90-
Group.get_global_range(dimension) / Group.get_local_range(dimension);
89+
size_t Range = Group.get_group_range(dimension);
9190
__SYCL_ASSUME_INT(Range);
9291
return Range;
9392
}

0 commit comments

Comments
 (0)