This test plan adds missing coverage for Section 4.9. "Expressing parallelism through kernels" of the SYCL 2020 specification: the ranges and index specifiers described in Section 4.9.1., the command group handler
class of Section 4.9.4., the reducer
class of Section 4.9.2.3., as well as the specialization constants described in Section 4.9.5. The estimated development time is three days.
The existing test in range_api.cpp
includes a check for the operators of the range
class. This check executes various operators on ranges and checks the elements of the resulting ranges with the result of applying the operator element-wise. This test is modified by adding a test for
-
The unary operators
+
and-
. -
The prefix operators
++
and--
. -
The postfix operators
++
and--
.
The existing tests are modified in the following way:
-
Mark all tests for the constructor that takes an offset as deprecated.
-
Mark all tests for
nd_range::get_offset
as deprecated.
The existing tests are modified in the following way:
-
Mark tests for
item::get_offset
as deprecated. -
The existing test for
item
whenDimension == 1
isitem_1d.cpp
. This test launches a kernel with the parametersycl::item<1> item
. It is modified by adding a test foroperator size_t() const
(which only is available whenDimension == 1
):-
Call the above operator on
item
and check that the result is equal toitem.get_id(0)
. -
Let
item_const
be aconst
copy ofitem
. Call the above operator onitem_const
and check that the result is equal toitem.get_id(0)
.
-
-
Check that
std::is_default_constructible_v<sycl::item<D>>
is false forD = 1, 2, 3
, since the constructor is specified asitem() = delete;
.
The existing tests are modified in the following way:
-
Remove all tests relating to
nd_item::barrier
andnd_item::mem_fence
. -
Mark tests for
nd_item::get_offset
as deprecated. -
Check that
std::is_default_constructible_v<sycl::nd_item<D>>
is false forD = 1, 2, 3
, since the constructor is specified asnd_item() = delete;
.
The below tests are added.
Check that the following statements evaluate to false
:
-
std::is_copy_constructible_v<sycl::reducer>
-
std::is_move_constructible_v<sycl::reducer>
-
std::is_copy_assignable_v<sycl::reducer>
-
std::is_move_assignable_v<sycl::reducer>
Since sycl::reducer
may have implementation-defined template parameters, use decltype
.
This test is repeated for the types of the existing reduction tests: char
, signed char
, unsigned char
, short int
, unsigned short int
, int
, unsigned int
, long int
, unsigned long int
, float
, long long int
, unsigned long long int
. In addition, if the device has aspect::fp64
: double
. In addition, if the device has aspect::fp16
: sycl::half
.
This test is repeated for a shared memory pointer, a sycl::buffer
, and a sycl::span
over a shared memory pointer:
-
Instantiate a
sycl::reduction
,reduction
, over the data withsycl::plus
. -
Launch a kernel
parallel_for(range<1>, reduction, [](id<1>, auto& reducer))
. -
Check that
decltype(reducer)::value_type
is equal to the value type of the test. -
Check that
decltype(reducer)::binary_operation
is equal tosycl::plus
. -
If using a shared memory pointer or a buffer:
-
Check that
decltype(reducer)::dimensions
is0
.
-
-
Else (if using a span over a shared pointer):
-
Check that
decltype(reducer)::dimensions
is1
. -
Check that
decltype(reducer[0])::value_type
is equal to the value type of the test. -
Check that
decltype(reducer[0])::binary_operation
is equal tosycl::plus
. -
Check that
decltype(reducer[0])::dimensions
is0
.
-
In addition to the types defined above, this test is also executed for bool
. Let this type be T
. In combination, this test is repeated for the SYCL function objects with known identities (SYCL specification Table 123.): plus
, multiplies
, bit_and
, bit_or
, bit_xor
, logical_and
, logical_or
, minimum
, maximum
.
-
Instantiate a
reduction
,red
, over some buffer. -
Launch a kernel
parallel_for(range<1>, red, [](id<1>, auto& reducer))
. -
Check that the return type and value of
reducer.identity()
are as expected. The expected values are derived from the aforementioned Table 123. and the return type is expected to beT
.
The existing tests are modified in the following way:
-
Mark tests for
template <typename KernelName, typename KernelType, int Dimensions> void parallel_for(range<Dimensions> numWorkItems, id<Dimensions> workItemOffset, const KernelType& kernelFunc);
as deprecated. -
The below tests are added.
-
Create event
e1
by submitting a dummy kernel to the queue. -
Create event
e2
by submitting a dummy kernel to the queue. Inside the submit call, usedepends_on
to lete2
depend one1
. -
Wait for the completion of
e2
. -
Check that
e1
has completed by querying thecommand_execution_status
ofe1
.
-
Create event
e1
by submitting a dummy kernel to the queue. -
Create event
e2
by submitting a dummy kernel to the queue. -
Create event
e3
by submitting a dummy kernel to the queue. Inside the submit call, usedepends_on
with a vector{e1, e2}
to lete3
depend one1
ande2
. -
Wait for the completion of
e3
. -
Check that
e1
ande2
have completed by querying thecommand_execution_status
ofe1
ande2
.
A test is added, which checks that the following statements evaluate to false
:
-
std::is_copy_constructible_v<sycl::specialization_id>
-
std::is_move_constructible_v<sycl::specialization_id>
-
std::is_copy_assignable_v<sycl::specialization_id>
-
std::is_move_assignable_v<sycl::specialization_id>