Skip to content

Commit 9f15813

Browse files
committed
[SYCL] Resolve namespace ambiguity in this_nd_item
Since the `detail` namespace appears in both the `sycl` namespace and in the `sycl::ext::oneapi::experimental` namespace, the implementation of `sycl::ext::oneapi::experimental::this_nd_item` may fail due to `detail::declptr` not existing in the latter. These changes remove the ambiguity. Signed-off-by: Steffen Larsen <[email protected]>
1 parent ebf9ea8 commit 9f15813

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

sycl/include/CL/sycl/nd_item.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ namespace oneapi {
207207
namespace experimental {
208208
template <int Dims> nd_item<Dims> this_nd_item() {
209209
#ifdef __SYCL_DEVICE_ONLY__
210-
return sycl::detail::Builder::getElement(detail::declptr<nd_item<Dims>>());
210+
return sycl::detail::Builder::getElement(
211+
sycl::detail::declptr<nd_item<Dims>>());
211212
#else
212213
throw sycl::exception(
213214
sycl::make_error_code(sycl::errc::feature_not_supported),

sycl/test/basic_tests/free_function_queries/free_function_queries_interface.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ template <template <int, bool = true> class Item, int Dims> void test() {
5353
"Wrong return type of free function query for Item");
5454
}
5555

56-
int main() {
56+
void test_all() {
5757
test<sycl::id>(this_id_caller<1>{});
5858
test<sycl::id>(this_id_caller<2>{});
5959
test<sycl::id>(this_id_caller<3>{});
@@ -75,3 +75,12 @@ int main() {
7575
sycl::ext::oneapi::sub_group>::value,
7676
"Wrong return type of free function query for Sub Group");
7777
}
78+
79+
int main() {
80+
// Test on host.
81+
test_all();
82+
83+
// Test on device.
84+
sycl::queue Q;
85+
Q.single_task([]() { test_all(); });
86+
}

0 commit comments

Comments
 (0)