Skip to content

Commit 77a4594

Browse files
[SYCL][Docs] Disallow sycl::join with source-based kernel_bundle (#18282)
This commit adds a constraint to sycl::join specifying that it is not available when the kernel bundle state is source-based. Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
1 parent bf82cfa commit 77a4594

File tree

3 files changed

+10
-41
lines changed

3 files changed

+10
-41
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_kernel_compiler.asciidoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,14 @@ As a result, the only `kernel_bundle` member functions from the core SYCL
642642
specification that are available for bundles in `ext_oneapi_source` state are
643643
`get_backend`, `get_context`, and `get_devices`.
644644

645+
=== New constraint for `join` function
646+
647+
This extension adds the following constraint to the `join` functions from the
648+
core SYCL specification:
649+
650+
> _Constraints:_ This function is not available when `State` is
651+
> `bundle_state::ext_oneapi_source`.
652+
645653
=== Interaction with existing kernel bundle member functions
646654

647655
Kernels created from online compilation of source code do not have any

sycl/include/sycl/kernel_bundle.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,8 @@ join_impl(const std::vector<detail::KernelBundleImplPtr> &Bundles,
885885
/// \returns a new kernel bundle that represents the union of all the device
886886
/// images in the input bundles with duplicates removed.
887887
template <sycl::bundle_state State>
888-
sycl::kernel_bundle<State>
888+
std::enable_if_t<State != sycl::bundle_state::ext_oneapi_source,
889+
sycl::kernel_bundle<State>>
889890
join(const std::vector<sycl::kernel_bundle<State>> &Bundles) {
890891
// Convert kernel_bundle<State> to impls to abstract template parameter away
891892
std::vector<detail::KernelBundleImplPtr> KernelBundleImpls;

sycl/test-e2e/KernelCompiler/sycl_join.cpp

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -81,46 +81,6 @@ int main() {
8181
source_kb KBSrc2 = syclex::create_kernel_bundle_from_source(
8282
Ctx, syclex::source_language::sycl, SYCLSource2);
8383

84-
// Test joining of source kernel bundles.
85-
{
86-
std::vector<source_kb> KBSrcs{KBSrc1, KBSrc2};
87-
source_kb KBSrcJoined = sycl::join(KBSrcs);
88-
89-
exe_kb KBExeJoined = syclex::build(KBSrcJoined);
90-
assert(KBExeJoined.ext_oneapi_has_kernel("TestKernel1"));
91-
assert(KBExeJoined.ext_oneapi_has_kernel("TestKernel2"));
92-
93-
sycl::kernel K1 = KBExeJoined.ext_oneapi_get_kernel("TestKernel1");
94-
sycl::kernel K2 = KBExeJoined.ext_oneapi_get_kernel("TestKernel2");
95-
96-
int *IntPtr = sycl::malloc_shared<int>(1, Q);
97-
*IntPtr = 0;
98-
99-
Q.submit([&](sycl::handler &CGH) {
100-
CGH.set_args(IntPtr);
101-
CGH.single_task(K1);
102-
}).wait_and_throw();
103-
104-
if (*IntPtr != 42) {
105-
std::cout << "TestKernel1 in joined source bundles failed: " << *IntPtr
106-
<< " != 42\n";
107-
++Failed;
108-
}
109-
110-
Q.submit([&](sycl::handler &CGH) {
111-
CGH.set_args(IntPtr);
112-
CGH.single_task(K2);
113-
}).wait_and_throw();
114-
115-
if (*IntPtr != 24) {
116-
std::cout << "TestKernel1 in joined source bundles failed: " << *IntPtr
117-
<< " != 24\n";
118-
++Failed;
119-
}
120-
121-
sycl::free(IntPtr, Q);
122-
}
123-
12484
auto KBExe1 = std::make_shared<exe_kb>(syclex::build(KBSrc1));
12585
auto KBExe2 = std::make_shared<exe_kb>(syclex::build(KBSrc2));
12686

0 commit comments

Comments
 (0)