Skip to content

Commit

Permalink
Merge branch 'SYCL-2020' into enable-deduction
Browse files Browse the repository at this point in the history
  • Loading branch information
bader authored Jun 21, 2023
2 parents 5b656bf + 3493cc7 commit b0c86ce
Show file tree
Hide file tree
Showing 14 changed files with 775 additions and 53 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cts_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
# - sycl-impl: computecpp
# version: 2.11.0
- sycl-impl: dpcpp
version: 0267c1b
version: 83f877975c97acdb38d84f94dc146571cd522e0e
- sycl-impl: hipsycl
version: 3d8b1cd
steps:
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
- sycl-impl: computecpp
version: 2.11.0
- sycl-impl: dpcpp
version: 0267c1b
version: 83f877975c97acdb38d84f94dc146571cd522e0e
- sycl-impl: hipsycl
version: 3d8b1cd
env:
Expand Down
23 changes: 3 additions & 20 deletions docker/dpcpp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
# DPC++ version (git revision) to install
# DPC++ build version (git revision) to install
# Go to https://github.com/intel/llvm/pkgs/container/llvm%2Fsycl_ubuntu2204_nightly to see avilable docker image tags
ARG IMPL_VERSION

FROM khronosgroup/sycl-cts-ci:common

ARG IMPL_VERSION
RUN test -n "$IMPL_VERSION" || ( echo "Error: IMPL_VERSION is not set"; exit 1 )

RUN git clone https://github.com/intel/llvm.git \
--branch=sycl --single-branch --shallow-since=2021-09-01 \
--recurse-submodules /tmp/dpcpp && \
cd /tmp/dpcpp && \
git checkout $IMPL_VERSION && \
python3 /tmp/dpcpp/buildbot/configure.py \
--src-dir=/tmp/dpcpp \
--obj-dir=/tmp/build \
--build-type=Release \
--cmake-opt=-DCMAKE_INSTALL_PREFIX=/sycl && \
python3 /tmp/dpcpp/buildbot/compile.py \
--src-dir=/tmp/dpcpp \
--obj-dir=/tmp/build && \
rm -rf /tmp/dpcpp /tmp/build
FROM ghcr.io/intel/llvm/sycl_ubuntu2204_nightly:no-drivers-$IMPL_VERSION

COPY configure.sh /scripts/
4 changes: 2 additions & 2 deletions docker/dpcpp/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set -o errexit -o pipefail -o noclobber -o nounset
cmake . -G Ninja -B build \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DSYCL_IMPLEMENTATION=DPCPP \
-DDPCPP_INSTALL_DIR=/sycl \
-DCMAKE_CXX_COMPILER=/sycl/bin/clang++ \
-DDPCPP_INSTALL_DIR=/opt/sycl \
-DCMAKE_CXX_COMPILER=/opt/sycl/bin/clang++ \
-DCMAKE_BUILD_TYPE=Release \
-DSYCL_CTS_ENABLE_FULL_CONFORMANCE=0 \
-DSYCL_CTS_ENABLE_DEPRECATED_FEATURES_TESTS=1 \
Expand Down
103 changes: 103 additions & 0 deletions test_plans/oneapi_discard_queue_events.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
:sectnums:
:xrefstyle: short

= Test plan for sycl extension oneapi discard queue events

This is a test plan for the extension adding
`ext::oneapi::property::queue::discard_events` property for `sycl::queue`. The
extension is described in
https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/supported/sycl_ext_oneapi_discard_queue_events.asciidoc[sycl_ext_oneapi_discard_queue_events.asciidoc].

== Testing scope

=== Device coverage

All of the tests described below are performed only on the default device that
is selected on the CTS command line.

=== Feature test macro

All of the tests should use `#ifdef SYCL_EXT_ONEAPI_DISCARD_QUEUE_EVENTS` so they can
be skipped if feature is not supported.

== Tests

Extension introduces new `ext::oneapi::property::queue::discard_events`
property for `sycl::queue` and new enumerator value for the
`sycl::info::event_command_status` enumeration. When the queue is created
with the `discard_events` property the queue member functions returning
events will return _invalid_ events.
Behavior of some _invalid_ event member functions is different from the default
event behavior and needs to be tested. The behavior when _invalid_ event is
passed into `handler::depends_on()` function is also different and needs to be
tested. Also we should check correct kernel execution submitted to the queue
constructed with the `ext::oneapi::property::queue::discard_events` property.

=== Test description

==== Event member functions

* Create a queue with property list that includes `discard_events` property
* Submit a kernel to the queue, save a returned event
* Call `get_wait_list()` for the event object
* Check that an exception with the `errc::invalid` error code is thrown
* Call `wait()` for the event object
* Check that an exception with the `errc::invalid` error code is thrown
* Call the static version of `wait()` function and passed the saved event
object to it
* Check that an exception with the `errc::invalid` error code is thrown
* Call `wait_and_throw()` for the event object
* Check that an exception with the `errc::invalid` error code is thrown
* Call the static version of `wait_and_throw()` function and passed the saved
event object to it
* Check that an exception with the `errc::invalid` error code is thrown
* Call `get_info<info::event::command_execution_status>()` for the event object
* Check returned value type is `sycl::info::event_command_status` and returned
value is `sycl::info::event_command_status::ext_oneapi_unknown`

Perform the test for two cases when queue property list includes also
`in-order` property and doesn't.

==== Handler member functions

* Create a queue with property list that includes `discard_events` and
`in-order` properties
* Submit a kernel to the queue, save a returned event
* Submit a command group that call `handler::depends_on(event)` on the saved
event
* Check that an exception with the `errc::invalid` error code is thrown
* Submit a command group that call `handler::depends_on(vector<event>)` on the
saved event
* Check that an exception with the `errc::invalid` error code is thrown

Perform the test for two cases when queue property list includes also
`in-order` property and doesn't.

==== Simultaneously using `discard_events` and `enable_profiling` properties

According to the specification `discard_events` property is incompatible with
`enable_profiling`. We should check that attempts to construct a queue with both properties raises `errc::invalid`.

* Create a queue with property list that includes `discard_events` and
`enable_profiling` properties
* Check that an exception with the `errc::invalid` error code is thrown

==== Kernel execution check

Do all of the following twice, with a queue constructed with `discard_events`
and with a queue constructed with both `discard_events` and `in_order`:

* Submit a `single_task` kernel, wait on the queue, validate that the kernel
ran
* Submit a simple `parallel_for` kernel, wait on the queue, validate that the
kernel ran
* Submit an `nd-range` kernel, wait on the queue, validate that the kernel ran
* Submit a `single_task` kernel using assert (where the assert does not
trigger), wait on the queue, validate that the kernel ran
* Submit a `single_task` kernel using stream, wait on the kernel, validate that
the kernel ran
* Submit a `single_task` kernel using a buffer accessor, wait on the kernel,
validate that the kernel ran

If the `SYCL_EXT_ONEAPI_ASSERT` macro isn't defined test with kernel using
assert can be skipped.
61 changes: 61 additions & 0 deletions test_plans/use_pinned_host_memory.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
:sectnums:
:xrefstyle: short

= Test plan for use_pinned_host_memory

This is a test plan for the buffer property described in
https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/supported/sycl_ext_oneapi_use_pinned_host_memory_property.asciidoc[sycl_ext_oneapi_use_pinned_host_memory]

== Testing scope

=== Device coverage

All of the tests described below are performed only on the default device that
is selected on the CTS command line.

=== Types coverage

All of the tests described below are performed using each of the following `typename T`:

* `int`
* `float`

=== Feature test macro

All of the tests should use `#ifdef SYCL_EXT_ONEAPI_USE_PINNED_HOST_MEMORY_PROPERTY` so they can be skipped
if feature is not supported.

== Tests

=== buffer constructors without host data

Check that the following constructors can create objects without any exceptions thrown:

* `buffer(const range<Dimensions>& bufferRange, const property_list& propList)`;
* `buffer(const range<Dimensions>& bufferRange, AllocatorT allocator, const property_list& propList)`,

Where:

* `Dimensions` from 1 to 3;
* `AllocatorT` - `sycl::buffer_allocator` and `std::allocator`;
* `bufferRange` - `sycl::range<Dimensions>{1}`;
* `propList` - `sycl::property_list{use_pinned_host_memory()}`.

Verify that `buffer::has_property<use_pinned_host_memory>()` returns true;
Verify that `buffer::get_property<use_pinned_host_memory>()` does not throw any exceptions.

=== buffer constructors with host data

Check that all `buffer` constructors with host data parameter, such as `T*`, `Container`, `InputIterator` and `std::shared_ptr<T>&` throw an `errc::invalid` exception when trying to create `buffer` object. For example:

[source, c++]
----
property_list pl = {use_pinned_host_memory()};
std::array<T, 10> arr;
try {
buffer<T, 1> buf(arr.data(), range{10}, pl); // (T*, range, prop) constructor
// tests failed, no exceptions thrown
} catch ...
----

18 changes: 12 additions & 6 deletions tests/accessor/accessor_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ void check_def_constructor(GetAccFunctorT get_accessor_functor) {

queue
.submit([&](sycl::handler& cgh) {
sycl::accessor res_acc(res_buf, cgh);
sycl::accessor<bool, 1, sycl::access_mode::read_write, Target>
res_acc(res_buf, cgh);
auto acc = get_accessor_functor();
if constexpr (AccType == accessor_type::generic_accessor) {
if (acc.is_placeholder()) {
Expand Down Expand Up @@ -442,7 +443,8 @@ void check_zero_length_buffer_constructor(GetAccFunctorT get_accessor_functor) {

queue
.submit([&](sycl::handler& cgh) {
sycl::accessor res_acc(res_buf);
sycl::accessor<bool, 1, sycl::access_mode::read_write, Target>
res_acc(res_buf);
auto acc = get_accessor_functor(data_buf, cgh);
if constexpr (Target == sycl::target::host_task) {
cgh.host_task([=] {
Expand Down Expand Up @@ -547,7 +549,8 @@ void check_zero_dim_constructor(GetAccFunctorT get_accessor_functor,

queue
.submit([&](sycl::handler& cgh) {
sycl::accessor res_acc(res_buf, cgh);
sycl::accessor<bool, 1, sycl::access_mode::read_write, Target>
res_acc(res_buf, cgh);

auto acc = get_accessor_functor(data_buf, cgh);
if constexpr (AccType == accessor_type::generic_accessor) {
Expand Down Expand Up @@ -663,7 +666,8 @@ void check_common_constructor(const sycl::range<Dimension>& r,

queue
.submit([&](sycl::handler& cgh) {
sycl::accessor res_acc(res_buf, cgh);
sycl::accessor<bool, 1, sycl::access_mode::read_write, Target>
res_acc(res_buf, cgh);
auto acc = get_accessor_functor(data_buf, cgh);

if constexpr (AccType == accessor_type::generic_accessor) {
Expand Down Expand Up @@ -934,7 +938,8 @@ void check_no_init_prop(GetAccFunctorT get_accessor_functor,

queue
.submit([&](sycl::handler& cgh) {
sycl::accessor res_acc(res_buf, cgh);
sycl::accessor<bool, 1, sycl::access_mode::read_write, Target>
res_acc(res_buf, cgh);

auto acc = get_accessor_functor(data_buf, cgh);

Expand Down Expand Up @@ -1308,7 +1313,8 @@ void check_linearization() {
sycl::accessor<T, dims, AccessMode, Target> acc(data_buf, cgh);

if constexpr (Target == sycl::target::device) {
sycl::accessor res_acc(res_buf, cgh);
sycl::accessor<bool, 1, sycl::access_mode::read_write, Target>
res_acc(res_buf, cgh);
cgh.single_task([=] {
sycl::id<dims> id{};
for (auto& elem : acc) {
Expand Down
8 changes: 4 additions & 4 deletions tests/extension/oneapi_memcpy2d/memcpy2d_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class run_handler_tests {
cgh.ext_oneapi_memcpy2d(dest_address, dest_pitch, src_address,
src_pitch, region_width, region_height);
});
queue.wait();
queue.wait_and_throw();
copy_destination_to_host_result<DestPtrType>(dst.get(), result,
result_size, queue);
for_index([&](size_t index) {
Expand All @@ -104,7 +104,7 @@ class run_handler_tests {
cgh.ext_oneapi_copy2d(src_address, src_pitch, dest_address, dest_pitch,
region_width, region_height);
});
queue.wait();
queue.wait_and_throw();
copy_destination_to_host_result<DestPtrType>(dst.get(), result,
result_size, queue);
for_index([&](size_t index) {
Expand All @@ -127,7 +127,7 @@ class run_handler_tests {
cgh.ext_oneapi_memset2d(dest_address, dest_pitch, value, region_width,
region_height);
});
queue.wait();
queue.wait_and_throw();
copy_destination_to_host_result<DestPtrType>(dst.get(), result,
result_size, queue);
for_index([&](size_t index) {
Expand All @@ -150,7 +150,7 @@ class run_handler_tests {
cgh.ext_oneapi_fill2d(dest_address, dest_pitch, value, region_width,
region_height);
});
queue.wait();
queue.wait_and_throw();
copy_destination_to_host_result<DestPtrType>(dst.get(), result,
result_size, queue);
for_index([&](size_t index) {
Expand Down
4 changes: 4 additions & 0 deletions tests/extension/oneapi_memcpy2d/memcpy2d_handler_exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class run_handler_exceptions_tests {
action(dest_pitch + extra_bit), sycl::exception,
sycl_cts::util::equals_exception(sycl::errc::invalid));
}
queue.wait_and_throw();
}
SECTION(
sycl_cts::section_name(std::string("Check copy2d exception with T = ") +
Expand Down Expand Up @@ -125,6 +126,7 @@ class run_handler_exceptions_tests {
CHECK_THROWS_MATCHES(
action(dest_pitch + extra_bit), sycl::exception,
sycl_cts::util::equals_exception(sycl::errc::invalid));
queue.wait_and_throw();
}
if constexpr (std::is_same_v<T, unsigned char>) {
SECTION(sycl_cts::section_name(std::string("Check memset2d with T = ") +
Expand All @@ -148,6 +150,7 @@ class run_handler_exceptions_tests {
CHECK_THROWS_MATCHES(
action(dest_pitch + extra_bit), sycl::exception,
sycl_cts::util::equals_exception(sycl::errc::invalid));
queue.wait_and_throw();
}
}
SECTION(sycl_cts::section_name(std::string("Check fill2d with T = ") +
Expand All @@ -171,6 +174,7 @@ class run_handler_exceptions_tests {
CHECK_THROWS_MATCHES(
action(dest_pitch + extra_bit), sycl::exception,
sycl_cts::util::equals_exception(sycl::errc::invalid));
queue.wait_and_throw();
}
}
};
Expand Down
8 changes: 4 additions & 4 deletions tests/extension/oneapi_memcpy2d/memcpy2d_queue_shortcut.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class run_queue_shortcut_tests {
dest_pitch, region_width, region_height,
{event1, event2});

queue.wait();
queue.wait_and_throw();
copy_destination_to_host_result<DestPtrType>(dst3.get(), result,
result_size, queue);

Expand Down Expand Up @@ -140,7 +140,7 @@ class run_queue_shortcut_tests {
queue.ext_oneapi_copy2d(src_address, dest_pitch, dest_address, dest_pitch,
region_width, region_height, {event1, event2});

queue.wait();
queue.wait_and_throw();
copy_destination_to_host_result<DestPtrType>(dst3.get(), result,
result_size, queue);

Expand Down Expand Up @@ -175,7 +175,7 @@ class run_queue_shortcut_tests {
queue.ext_oneapi_memset2d(dest_address, dest_pitch, value, region_width,
region_height, {event1, event2});

queue.wait();
queue.wait_and_throw();
copy_destination_to_host_result<DestPtrType>(dst1.get(), result,
result_size, queue);
for_index([&](size_t index) {
Expand Down Expand Up @@ -222,7 +222,7 @@ class run_queue_shortcut_tests {
queue.ext_oneapi_fill2d(dest_address, dest_pitch, value, region_width,
region_height, {event1, event2});

queue.wait();
queue.wait_and_throw();
copy_destination_to_host_result<DestPtrType>(dst1.get(), result,
result_size, queue);
for_index([&](size_t index) {
Expand Down
Loading

0 comments on commit b0c86ce

Please sign in to comment.