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
62 changes: 0 additions & 62 deletions sycl/test-e2e/Basic/enqueue_barrier.cpp

This file was deleted.

97 changes: 0 additions & 97 deletions sycl/test-e2e/ESIMD/esimd_check_vc_codegen.cpp
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for ESIMD reviewers: even though the test also does some computations in kernels, I assume that they are not unique to this test and was merely done to avoid submitting an empty kernel or just by copying an existing test as a baseline.

Therefore, I'm completely removing it in favor of unit-test-level checks that we pass the right JIT compilation flag down to UR program build APIs.

Please speak up if you disagree and the test should still be preserved for some reason.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah the computation is definitely not important, the point of the test is to check the flag to IGC.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// REQUIRES: gpu && linux && (opencl || level_zero)

// RUN: %{build} -o %t.out
// RUN: env NEOReadDebugKeys=1 CreateMultipleRootDevices=3 SYCL_UR_TRACE=2 %{run} %t.out
Copy link
Contributor Author

Choose a reason for hiding this comment

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

lit captures stdout/stderr, so why waste our machine resources for something that is not used anyways?

// RUN: env NEOReadDebugKeys=1 CreateMultipleRootDevices=3 %{run} %t.out

// Test to check that we can compile and link a kernel bundle for multiple
// devices and run the kernel on each device.
Expand Down
17 changes: 17 additions & 0 deletions sycl/unittests/kernel-and-program/KernelBuildOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,20 @@ TEST(KernelBuildOptions, KernelBundleBasic) {
auto LinkBundle = sycl::link(ObjBundle, ObjBundle.get_devices());
EXPECT_EQ(BuildOpts, "-link-img");
}

TEST(KernelBuildOptions, ESIMDParallelForBasic) {
sycl::unittest::UrMock<> Mock;
sycl::platform Plt = sycl::platform();
setupCommonMockAPIs(Mock);

const sycl::device Dev = Plt.get_devices()[0];
sycl::queue Queue{Dev};

Queue.submit([&](sycl::handler &cgh) {
cgh.parallel_for<BuildOptsTestKernel>(
sycl::range{1024}, [=](sycl::id<1>) /* SYCL_ESIMD_KERNEL */ {});
});

EXPECT_EQ(BuildOpts,
Copy link
Contributor

Choose a reason for hiding this comment

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

wow cool!

"-compile-img -vc-codegen -disable-finalizer-msg -link-img");
}
100 changes: 100 additions & 0 deletions sycl/unittests/queue/Barrier.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
//==------------------- Barrier.cpp --- queue unit tests -------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include <helpers/TestKernel.hpp>
#include <helpers/UrMock.hpp>

#include <gtest/gtest.h>

static unsigned NumOfEventsWaitWithBarrierCalls = 0;

static ur_result_t redefined_urEnqueueEventsWaitWithBarrier(void *) {
NumOfEventsWaitWithBarrierCalls++;

return UR_RESULT_SUCCESS;
}

TEST(Queue, HandlerBarrier) {
sycl::unittest::UrMock<> Mock;
mock::getCallbacks().set_before_callback(
"urEnqueueEventsWaitWithBarrier",
&redefined_urEnqueueEventsWaitWithBarrier);
NumOfEventsWaitWithBarrierCalls = 0;

sycl::queue Q;

Q.submit(
[&](sycl::handler &cgh) { cgh.single_task<TestKernel<1>>([=]() {}); });
Q.submit(
[&](sycl::handler &cgh) { cgh.single_task<TestKernel<1>>([=]() {}); });

Q.submit([&](sycl::handler &cgh) { cgh.ext_oneapi_barrier(); });

ASSERT_EQ(NumOfEventsWaitWithBarrierCalls, 1u);
}

TEST(Queue, ExtOneAPISubmitBarrier) {
sycl::unittest::UrMock<> Mock;
mock::getCallbacks().set_before_callback(
"urEnqueueEventsWaitWithBarrier",
&redefined_urEnqueueEventsWaitWithBarrier);
NumOfEventsWaitWithBarrierCalls = 0;

sycl::queue Q;

Q.submit(
[&](sycl::handler &cgh) { cgh.single_task<TestKernel<1>>([=]() {}); });
Q.submit(
[&](sycl::handler &cgh) { cgh.single_task<TestKernel<1>>([=]() {}); });

Q.ext_oneapi_submit_barrier();

ASSERT_EQ(NumOfEventsWaitWithBarrierCalls, 1u);
}

TEST(Queue, HandlerBarrierWithWaitList) {
sycl::unittest::UrMock<> Mock;
mock::getCallbacks().set_before_callback(
"urEnqueueEventsWaitWithBarrier",
&redefined_urEnqueueEventsWaitWithBarrier);
NumOfEventsWaitWithBarrierCalls = 0;

sycl::queue Q1;
sycl::queue Q2;
sycl::queue Q3;

auto E1 = Q1.submit(
[&](sycl::handler &cgh) { cgh.single_task<TestKernel<1>>([=]() {}); });
auto E2 = Q2.submit(
[&](sycl::handler &cgh) { cgh.single_task<TestKernel<1>>([=]() {}); });

Q3.submit([&](sycl::handler &cgh) { cgh.ext_oneapi_barrier({E1, E2}); });

ASSERT_EQ(NumOfEventsWaitWithBarrierCalls, 1u);
}

TEST(Queue, ExtOneAPISubmitBarrierWithWaitList) {
sycl::unittest::UrMock<> Mock;
mock::getCallbacks().set_before_callback(
"urEnqueueEventsWaitWithBarrier",
&redefined_urEnqueueEventsWaitWithBarrier);
NumOfEventsWaitWithBarrierCalls = 0;

sycl::queue Q1;
sycl::queue Q2;
sycl::queue Q3;

auto E1 = Q1.submit(
[&](sycl::handler &cgh) { cgh.single_task<TestKernel<1>>([=]() {}); });
auto E2 = Q2.submit(
[&](sycl::handler &cgh) { cgh.single_task<TestKernel<1>>([=]() {}); });

Q3.ext_oneapi_submit_barrier({E1, E2});

ASSERT_EQ(NumOfEventsWaitWithBarrierCalls, 1u);
}
1 change: 1 addition & 0 deletions sycl/unittests/queue/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ add_sycl_unittest(QueueTests OBJECT
InOrderQueue.cpp
InteropRetain.cpp
Properties.cpp
Barrier.cpp
)
Loading