Skip to content

Commit c5b174d

Browse files
[SYCL] Implement latest version of sycl_ext_oneapi_free_function_queries (#13257)
- Implement latest revision of the proposed extension - Deprecate `sycl::ext::oneapi::experimental::` interfaces - Remove old deprecated interfaces from `sycl::` namespace
1 parent dc9c91e commit c5b174d

File tree

21 files changed

+167
-455
lines changed

21 files changed

+167
-455
lines changed

llvm/lib/SYCLLowerIR/ESIMD/ESIMDVerifier.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ class ESIMDVerifierImpl {
153153
if (!Name.starts_with("sycl::_V1::") ||
154154
Name.starts_with("sycl::_V1::detail::") ||
155155
Name.starts_with("sycl::_V1::ext::intel::esimd::") ||
156-
Name.starts_with("sycl::_V1::ext::intel::experimental::esimd::"))
156+
Name.starts_with(
157+
"sycl::_V1::ext::intel::experimental::esimd::") ||
158+
Name.starts_with("sycl::_V1::ext::oneapi::this_work_item::"))
157159
continue;
158160

159161
// Check if function name matches any allowed SYCL function name.

sycl/doc/extensions/experimental/sycl_ext_oneapi_free_function_queries.asciidoc

Lines changed: 0 additions & 226 deletions
This file was deleted.

sycl/doc/extensions/proposed/sycl_ext_oneapi_free_function_queries.asciidoc renamed to sycl/doc/extensions/supported/sycl_ext_oneapi_free_function_queries.asciidoc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,7 @@ SYCL specification refer to that revision.
4545

4646
== Status
4747

48-
This is a proposed update to an existing extension. Interfaces defined in this
49-
specification may not be implemented yet or may be in a preliminary state. The
50-
specification itself may also change in incompatible ways before it is
51-
finalized. *Shipping software products should not rely on APIs defined in this
52-
specification.* See
53-
link:../experimental/sycl_ext_oneapi_free_function_queries.asciidoc[here] for
54-
the existing extension, which is implemented.
55-
48+
This extension is implemented and fully supported by {dpcpp}.
5649

5750
== Overview
5851

sycl/doc/syclcompat/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Specifically, this library depends on the following SYCL extensions:
4343
* [sycl_ext_oneapi_complex](
4444
../extensions/experimental/sycl_ext_oneapi_complex.asciidoc)
4545
* [sycl_ext_oneapi_free_function_queries](
46-
../extensions/experimental/sycl_ext_oneapi_free_function_queries.asciidoc)
46+
../extensions/supported/sycl_ext_oneapi_free_function_queries.asciidoc)
4747
* [sycl_ext_oneapi_assert](
4848
../extensions/supported/sycl_ext_oneapi_assert.asciidoc)
4949
* [sycl_ext_oneapi_enqueue_barrier](

sycl/include/sycl/ext/oneapi/experimental/root_group.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#pragma once
1010

11+
#include <sycl/ext/oneapi/free_function_queries.hpp>
1112
#include <sycl/ext/oneapi/properties/properties.hpp>
1213
#include <sycl/group.hpp>
1314
#include <sycl/memory_enums.hpp>
@@ -91,7 +92,8 @@ template <int Dimensions> sycl::sub_group get_child_group(group<Dimensions> g) {
9192

9293
namespace this_kernel {
9394
template <int Dimensions> root_group<Dimensions> get_root_group() {
94-
return this_nd_item<Dimensions>().ext_oneapi_get_root_group();
95+
return sycl::ext::oneapi::this_work_item::get_nd_item<Dimensions>()
96+
.ext_oneapi_get_root_group();
9597
}
9698
} // namespace this_kernel
9799

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
//==---- free_function_queries.hpp -- SYCL_INTEL_free_function_queries ext -==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#pragma once
10+
11+
#include <sycl/group.hpp>
12+
#include <sycl/nd_item.hpp>
13+
#include <sycl/sub_group.hpp>
14+
15+
// For deprecated queries:
16+
#include <sycl/id.hpp>
17+
#include <sycl/item.hpp>
18+
19+
namespace sycl {
20+
inline namespace _V1 {
21+
namespace ext::oneapi::this_work_item {
22+
template <int Dimensions> nd_item<Dimensions> get_nd_item() {
23+
#ifdef __SYCL_DEVICE_ONLY__
24+
return sycl::detail::Builder::getElement(
25+
sycl::detail::declptr<nd_item<Dimensions>>());
26+
#else
27+
throw sycl::exception(
28+
sycl::make_error_code(sycl::errc::feature_not_supported),
29+
"Free function calls are not supported on host");
30+
#endif
31+
}
32+
33+
template <int Dimensions> group<Dimensions> get_work_group() {
34+
return get_nd_item<Dimensions>().get_group();
35+
}
36+
37+
inline sycl::sub_group get_sub_group() {
38+
#ifdef __SYCL_DEVICE_ONLY__
39+
return sycl::sub_group();
40+
#else
41+
throw sycl::exception(
42+
sycl::make_error_code(sycl::errc::feature_not_supported),
43+
"Free function calls are not supported on host");
44+
#endif
45+
}
46+
} // namespace ext::oneapi::this_work_item
47+
48+
namespace ext::oneapi::experimental {
49+
template <int Dims>
50+
__SYCL_DEPRECATED(
51+
"use sycl::ext::oneapi::this_work_item::get_nd_item() instead")
52+
nd_item<Dims> this_nd_item() {
53+
return ext::oneapi::this_work_item::get_nd_item<Dims>();
54+
}
55+
56+
template <int Dims>
57+
__SYCL_DEPRECATED(
58+
"use sycl::ext::oneapi::this_work_item::get_work_group() instead")
59+
group<Dims> this_group() {
60+
return ext::oneapi::this_work_item::get_work_group<Dims>();
61+
}
62+
63+
__SYCL_DEPRECATED(
64+
"use sycl::ext::oneapi::this_work_item::get_sub_group() instead")
65+
inline sycl::sub_group this_sub_group() {
66+
return ext::oneapi::this_work_item::get_sub_group();
67+
}
68+
69+
template <int Dims>
70+
__SYCL_DEPRECATED("use nd_range kernel and "
71+
"sycl::ext::oneapi::this_work_item::get_nd_item() instead")
72+
item<Dims> this_item() {
73+
#ifdef __SYCL_DEVICE_ONLY__
74+
return sycl::detail::Builder::getElement(sycl::detail::declptr<item<Dims>>());
75+
#else
76+
throw sycl::exception(
77+
sycl::make_error_code(sycl::errc::feature_not_supported),
78+
"Free function calls are not supported on host");
79+
#endif
80+
}
81+
82+
template <int Dims>
83+
__SYCL_DEPRECATED("use nd_range kernel and "
84+
"sycl::ext::oneapi::this_work_item::get_nd_item() instead")
85+
id<Dims> this_id() {
86+
return this_item<Dims>().get_id();
87+
}
88+
} // namespace ext::oneapi::experimental
89+
} // namespace _V1
90+
} // namespace sycl

0 commit comments

Comments
 (0)