Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions SYCL/Regression/kernel_bundle_ignore_sycl_external.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %HOST_RUN_PLACEHOLDER %t.out

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to run on the host device if the test skips execution on such a device(line 22)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I don't think so, so I have removed it.

// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
//
// XFAIL: cuda || hip

#include <CL/sycl.hpp>

class KernelName;

SYCL_EXTERNAL
int f(int a) { return a + 1; }

int main() {
const sycl::device Dev{sycl::default_selector{}};
const sycl::context Ctx{Dev};
sycl::queue Q{Ctx, Dev};

// No support for host device so far.
if (Q.is_host())
return 0;

assert(sycl::get_kernel_ids().size() == 1);

sycl::kernel_bundle EmptyKernelBundle =
sycl::get_kernel_bundle<sycl::bundle_state::executable>(Ctx, {Dev}, {});

assert(EmptyKernelBundle.get_kernel_ids().size() == 0);

sycl::kernel_bundle KernelBundle =
sycl::get_kernel_bundle<sycl::bundle_state::executable>(Ctx, {Dev});
sycl::kernel_id KernelID = sycl::get_kernel_id<KernelName>();

assert(KernelBundle.get_kernel_ids().size() == 1);
assert(KernelBundle.has_kernel(KernelID));

cl::sycl::buffer<int, 1> Buf(sycl::range<1>{1});
Q.submit([&](sycl::handler &CGH) {
auto Acc = Buf.get_access<sycl::access::mode::write>(CGH);
CGH.use_kernel_bundle(KernelBundle);
CGH.single_task<KernelName>([=]() { Acc[0] = 42; });
});
}