Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] Update tests for default context extension #433

Merged
merged 1 commit into from
Sep 5, 2021
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
8 changes: 6 additions & 2 deletions SYCL/Basic/buffer/buffer_dev_to_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ int main() {
{property::buffer::use_host_ptr()});

default_selector Selector;
device Device(Selector);

queue FirstQueue(Selector);
queue SecondQueue(Selector);
context FirstContext(Device);
context SecondContext(Device);

queue FirstQueue(FirstContext, Device);
queue SecondQueue(SecondContext, Device);

assert(FirstQueue.get_context() != SecondQueue.get_context());
FirstQueue.submit([&](handler &Cgh) {
Expand Down
27 changes: 21 additions & 6 deletions SYCL/Plugin/enqueue-arg-order-buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,13 @@ void testcopyH2DBuffer() {
{
buffer<float, 1> buffer_from_1D(data_from_1D.data(), range<1>(width));
buffer<float, 1> buffer_to_1D(data_to_1D.data(), range<1>(width));
queue myQueue;
queue otherQueue;

device Dev{default_selector{}};
context myCtx{Dev};
context otherCtx{Dev};

queue myQueue{myCtx, Dev};
queue otherQueue{otherCtx, Dev};
myQueue.submit([&](handler &cgh) {
auto read = buffer_from_1D.get_access<access::mode::read>(cgh);
auto write = buffer_to_1D.get_access<access::mode::write>(cgh);
Expand All @@ -261,8 +266,13 @@ void testcopyH2DBuffer() {
buffer<float, 2> buffer_from_2D(data_from_2D.data(),
range<2>(height, width));
buffer<float, 2> buffer_to_2D(data_to_2D.data(), range<2>(height, width));
queue myQueue;
queue otherQueue;

device Dev{default_selector{}};
context myCtx{Dev};
context otherCtx{Dev};

queue myQueue{myCtx, Dev};
queue otherQueue{otherCtx, Dev};
myQueue.submit([&](handler &cgh) {
auto read = buffer_from_2D.get_access<access::mode::read>(cgh);
auto write = buffer_to_2D.get_access<access::mode::write>(cgh);
Expand All @@ -285,8 +295,13 @@ void testcopyH2DBuffer() {
range<3>(depth, height, width));
buffer<float, 3> buffer_to_3D(data_to_3D.data(),
range<3>(depth, height, width));
queue myQueue;
queue otherQueue;

device Dev{default_selector{}};
context myCtx{Dev};
context otherCtx{Dev};

queue myQueue{myCtx, Dev};
queue otherQueue{otherCtx, Dev};
myQueue.submit([&](handler &cgh) {
auto read = buffer_from_3D.get_access<access::mode::read>(cgh);
auto write = buffer_to_3D.get_access<access::mode::write>(cgh);
Expand Down
24 changes: 18 additions & 6 deletions SYCL/Plugin/enqueue-arg-order-image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,12 @@ void testcopyH2DImage() {
ImgSize_1D);
sycl::image<1> image_to_1D(data_to_1D.data(), ChanOrder, ChanType,
ImgSize_1D);
queue Q;
queue otherQueue;
device Dev{default_selector{}};
context Ctx{Dev};
context otherCtx{Dev};

queue Q{Ctx, Dev};
queue otherQueue{otherCtx, Dev};
// first op
Q.submit([&](sycl::handler &CGH) {
auto readAcc = image_from_1D.get_access<sycl::float4, SYCLRead>(CGH);
Expand Down Expand Up @@ -203,8 +207,12 @@ void testcopyH2DImage() {
ImgSize_2D);
sycl::image<2> image_to_2D(data_to_2D.data(), ChanOrder, ChanType,
ImgSize_2D);
queue Q;
queue otherQueue;
device Dev{default_selector{}};
context Ctx{Dev};
context otherCtx{Dev};

queue Q{Ctx, Dev};
queue otherQueue{otherCtx, Dev};
Q.submit([&](sycl::handler &CGH) {
auto readAcc = image_from_2D.get_access<sycl::float4, SYCLRead>(CGH);
auto writeAcc = image_to_2D.get_access<sycl::float4, SYCLWrite>(CGH);
Expand Down Expand Up @@ -238,8 +246,12 @@ void testcopyH2DImage() {
ImgSize_3D);
sycl::image<3> image_to_3D(data_to_3D.data(), ChanOrder, ChanType,
ImgSize_3D);
queue Q;
queue otherQueue;
device Dev{default_selector{}};
context Ctx{Dev};
context otherCtx{Dev};

queue Q{Ctx, Dev};
queue otherQueue{otherCtx, Dev};
Q.submit([&](sycl::handler &CGH) {
auto readAcc = image_from_3D.get_access<sycl::float4, SYCLRead>(CGH);
auto writeAcc = image_to_3D.get_access<sycl::float4, SYCLWrite>(CGH);
Expand Down