mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
Add experimental support for SYCL under an experimental gate. The IntelLLVM and Adaptivecpp compilers are recognized, as well as upstream Clang with libsycl support. Fixes: #27219, #27905
18 lines
353 B
C++
18 lines
353 B
C++
#include <sycl/sycl.hpp>
|
|
|
|
template <typename Kernel>
|
|
int run_kernel()
|
|
{
|
|
sycl::queue queue;
|
|
int* value = sycl::malloc_shared<int>(1, queue);
|
|
if (!value) {
|
|
return 1;
|
|
}
|
|
*value = 0;
|
|
queue.single_task<Kernel>([=] { *value = 42; });
|
|
queue.wait_and_throw();
|
|
int result = *value;
|
|
sycl::free(value, queue);
|
|
return result == 42 ? 0 : 1;
|
|
}
|