Skip to content
12 changes: 6 additions & 6 deletions sycl/cmake/modules/UnifiedRuntimeTag.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# commit 58abf8fa778376546274c52304b9f924314d65e6
# Merge: a96fddec a97df490
# commit eddfd8ef62a267921612801ed4300cc429460b05
# Merge: 58abf8fa ec5e8ea6
# Author: aarongreig <[email protected]>
# Date: Thu Oct 24 13:37:02 2024 +0100
# Merge pull request #2160 from aarongreig/aaron/clQuerySourceWGSize
# Query out and use local size set in program IL in CL adapter
set(UNIFIED_RUNTIME_TAG 58abf8fa778376546274c52304b9f924314d65e6)
# Date: Thu Oct 24 16:16:06 2024 +0100
# Merge pull request #2153 from PietroGhg/pietro/events_initial
# [NATIVECPU] Initial implementation of events on Native CPU
set(UNIFIED_RUNTIME_TAG eddfd8ef62a267921612801ed4300cc429460b05)
75 changes: 49 additions & 26 deletions sycl/test/native_cpu/scalar_args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,62 @@ const size_t N = 10;

template <typename T> class init_a;

template <typename T> bool test(queue myQueue) {
{
buffer<float, 1> a(range<1>{N});
const T test = rand() % 10;

myQueue.submit([&](handler &cgh) {
auto A = a.get_access<access::mode::write>(cgh);
cgh.parallel_for<init_a<T>>(range<1>{N},
[=](id<1> index) { A[index] = test; });
});

auto A = a.get_access<access::mode::read>();
std::cout << "Result:" << std::endl;
for (size_t i = 0; i < N; i++) {
if (A[i] != test) {
std::cout << "ERROR at pos " << i << " expected " << test << ", got "
<< A[i] << "\n";
return false;
}
}
template <typename T, int M>
bool compare(const sycl::vec<T, M> a, const sycl::vec<T, M> truth) {
bool res = true;
for (int i = 0; i < M; i++) {
res &= a[i] == truth[i];
}
return res;
}

std::cout << "Good computation!" << std::endl;
template <typename T> bool compare(const T a, const T truth) {
return a == truth;
}

template <typename T> bool check(buffer<T, 1> &result, const T truth) {
auto A = result.get_host_access();
for (size_t i = 0; i < N; i++) {
if (!compare(A[i], truth)) {
return false;
}
}
return true;
}

template <typename T> bool test(queue myQueue) {
buffer<T, 1> a(range<1>{N});
const T test{42};

myQueue.submit([&](handler &cgh) {
auto A = a.template get_access<access::mode::write>(cgh);
cgh.parallel_for<init_a<T>>(range<1>{N},
[=](id<1> index) { A[index] = test; });
});

return check(a, test);
}

int main() {
queue q;
int res1 = test<int>(q);
int res2 = test<unsigned>(q);
int res3 = test<float>(q);
int res4 = test<double>(q);
if (!(res1 && res2 && res3 && res4)) {

std::vector<bool> res;
res.push_back(test<int>(q));
res.push_back(test<unsigned>(q));
res.push_back(test<float>(q));
res.push_back(test<double>(q));
res.push_back(test<sycl::vec<int, 2>>(q));
res.push_back(test<sycl::vec<int, 3>>(q));
res.push_back(test<sycl::vec<int, 4>>(q));
res.push_back(test<sycl::vec<int, 8>>(q));
res.push_back(test<sycl::vec<int, 16>>(q));
res.push_back(test<sycl::vec<double, 2>>(q));
res.push_back(test<sycl::vec<double, 3>>(q));
res.push_back(test<sycl::vec<double, 4>>(q));
res.push_back(test<sycl::vec<double, 8>>(q));
res.push_back(test<sycl::vec<double, 16>>(q));

if (std::any_of(res.begin(), res.end(), [](bool b) { return !b; })) {
return 1;
}
return 0;
Expand Down
Loading