Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <sycl/group_barrier.hpp>
#include <sycl/usm.hpp>

constexpr size_t Size = 1024;
using DataType = int;

namespace sycl_ext = sycl::ext::oneapi::experimental;
Expand All @@ -31,23 +30,27 @@ void copy_via_smem(DataType *a, DataType *b, sycl::nd_item<1> it) {

int main() {
sycl::queue queue;
DataType *a = sycl::malloc_device<DataType>(Size, queue);
DataType *b = sycl::malloc_device<DataType>(Size, queue);
std::vector<DataType> a_host(Size, 1.0);
std::vector<DataType> b_host(Size, -5.0);
auto size = std::min(
queue.get_device().get_info<sycl::info::device::max_work_group_size>(),
size_t{1024});

queue.copy(a_host.data(), a, Size).wait_and_throw();
DataType *a = sycl::malloc_device<DataType>(size, queue);
DataType *b = sycl::malloc_device<DataType>(size, queue);
std::vector<DataType> a_host(size, 1.0);
std::vector<DataType> b_host(size, -5.0);

queue.copy(a_host.data(), a, size).wait_and_throw();

queue
.submit([&](sycl::handler &cgh) {
cgh.parallel_for(sycl::nd_range<1>({Size}, {Size}),
cgh.parallel_for(sycl::nd_range<1>({size}, {size}),
sycl_ext::properties{sycl_ext::work_group_scratch_size(
Size * sizeof(DataType))},
size * sizeof(DataType))},
[=](sycl::nd_item<1> it) { copy_via_smem(a, b, it); });
})
.wait_and_throw();

queue.copy(b, b_host.data(), Size).wait_and_throw();
queue.copy(b, b_host.data(), size).wait_and_throw();
for (size_t i = 0; i < b_host.size(); i++) {
assert(b_host[i] == a_host[i]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %{run} %t.out
//

// UNSUPPORTED: gpu-intel-gen12
// UNSUPPORTED: gpu-intel-gen12, cpu
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/16072

// Test work_group_dynamic extension with allocation size specified at runtime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %{run} %t.out
//

// UNSUPPORTED: gpu-intel-gen12
// UNSUPPORTED: gpu-intel-gen12, cpu
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/16072

// Test work_group_dynamic extension with allocation size specified at runtime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %{run} %t.out
//

// UNSUPPORTED: gpu-intel-gen12
// UNSUPPORTED: gpu-intel-gen12, cpu
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/16072

// Test work_group_dynamic extension with allocation size specified at runtime.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,36 @@
#include <sycl/ext/oneapi/work_group_scratch_memory.hpp>
#include <sycl/usm.hpp>

constexpr size_t Size = 1024;
using DataType = int;

namespace sycl_ext = sycl::ext::oneapi::experimental;

int main() {
sycl::queue queue;
DataType *a = sycl::malloc_device<DataType>(Size, queue);
DataType *b = sycl::malloc_device<DataType>(Size, queue);
std::vector<DataType> a_host(Size, 1.0);
std::vector<DataType> b_host(Size, -5.0);
auto size = std::min(
queue.get_device().get_info<sycl::info::device::max_work_group_size>(),
size_t{1024});

queue.copy(a_host.data(), a, Size).wait_and_throw();
DataType *a = sycl::malloc_device<DataType>(size, queue);
DataType *b = sycl::malloc_device<DataType>(size, queue);
std::vector<DataType> a_host(size, 1.0);
std::vector<DataType> b_host(size, -5.0);

queue.copy(a_host.data(), a, size).wait_and_throw();

queue
.submit([&](sycl::handler &cgh) {
cgh.parallel_for(sycl::nd_range<1>({Size}, {Size}),
cgh.parallel_for(sycl::nd_range<1>({size}, {size}),
sycl_ext::properties{sycl_ext::work_group_scratch_size(
Size * sizeof(DataType))},
size * sizeof(DataType))},
[=](sycl::nd_item<1> it) {
b[it.get_local_linear_id()] =
a[it.get_local_linear_id()];
});
})
.wait_and_throw();

queue.copy(b, b_host.data(), Size).wait_and_throw();
queue.copy(b, b_host.data(), size).wait_and_throw();
for (size_t i = 0; i < b_host.size(); i++) {
assert(b_host[i] == a_host[i]);
}
Expand Down
3 changes: 3 additions & 0 deletions sycl/test-e2e/WorkGroupStatic/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# https://github.com/intel/llvm/issues/16072
config.unsupported_features += ['hip']
Loading