Skip to content

Commit 6e83c12

Browse files
authored
[SYCL] Add group::get_linear_id(int dim) overload (#6320)
1 parent 90e8b5e commit 6e83c12

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

sycl/include/CL/sycl/group.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ template <int Dimensions = 1> class group {
133133
#endif
134134
}
135135

136+
size_t get_local_id(int dimention) const { return get_local_id()[dimention]; }
137+
136138
size_t get_local_linear_id() const {
137139
return get_local_linear_id_impl<Dimensions>();
138140
}

sycl/test/basic_tests/group.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ int main() {
3333

3434
try {
3535
one_dim.get_local_id();
36+
assert(one_dim.get_local_id(0) == one_dim.get_local_id()[0]);
3637
assert(0); // get_local_id() is not implemented on host device
3738
} catch (cl::sycl::runtime_error) {
3839
}
@@ -64,6 +65,8 @@ int main() {
6465

6566
try {
6667
two_dim.get_local_id();
68+
assert(two_dim.get_local_id(0) == two_dim.get_local_id()[0]);
69+
assert(two_dim.get_local_id(1) == two_dim.get_local_id()[1]);
6770
assert(0); // get_local_id() is not implemented on host device
6871
} catch (cl::sycl::runtime_error) {
6972
}
@@ -101,6 +104,9 @@ int main() {
101104

102105
try {
103106
three_dim.get_local_id();
107+
assert(three_dim.get_local_id(0) == three_dim.get_local_id()[0]);
108+
assert(three_dim.get_local_id(1) == three_dim.get_local_id()[1]);
109+
assert(three_dim.get_local_id(2) == three_dim.get_local_id()[2]);
104110
assert(0); // get_local_id() is not implemented on host device
105111
} catch (cl::sycl::runtime_error) {
106112
}

0 commit comments

Comments
 (0)