This is a test plan cover kernel_bundle functionality that is not covered by current tests.
Tests intend to cover functions from 4.11. Kernel bundles that are not covered in https://github.com/KhronosGroup/SYCL-CTS/tree/main/tests/kernel_bundle
Check that result of function is_compatible(const std::vector<kernel_id> &kernelIds, const device &dev)
:
-
true
for zero kernels -
true
for built-in kernel id for the selected device -
Construct a vector of the built-in kernel ids from every root device other than the selected device. Check that is_compatible returns
false
for this vector of kernel ids unless the vector is empty. -
for kernels with no kernel attributes:
-
true
for kernel with no optional features and the selected device -
true
for a kernel that usessycl::half
if and only if the selected device hasaspect::fp16
. -
true
for a kernel that usesdouble
if and only if the selected device hasaspect::fp64
. -
true
for a kernel that uses 64-bit atomic operations if and only if the selected device hasaspect::atomic64
.
-
-
Define kernels with the following values of the
[[sycl::reqd_work_group_size()]]
attribute. Verify thatis_compatible
returns true if and only if the work group size is less than or equal to the value reported byinfo::device::max_work_item_sizes<1>
for the selected device.-
[[sycl::reqd_work_group_size(8)]]
-
[[sycl::reqd_work_group_size(16)]]
-
[[sycl::reqd_work_group_size(4294967295)]]
-
-
Define kernels with the following values of the
[[sycl::reqd_sub_group_size()]]
attribute. Verify thatis_compatible
returns true if and only if the sub group size is one of the values reported byinfo::device::sub_group_sizes
for the selected device.-
[[sycl::reqd_work_group_size(8)]]
-
[[sycl::reqd_work_group_size(16)]]
-
[[sycl::reqd_work_group_size(4099)]]
-
-
for kernels with no optional features used and with
[[sycl::device_has()]]
kernel attribute-
true
for a kernel decorated with[[sycl::device_has(aspect::fp16)]]
if and only if the selected device has that aspect. -
true
for a kernel decorated with[[sycl::device_has(aspect::fp64)]]
if and only if the selected device has that aspect. -
true
for a kernel decorated with[[sycl::device_has(aspect::atomic64)]]
if and only if the selected device has that aspect.
-
-
for multiple kernels result is equal to AND operation applied to the multiple calls - each one using single kernel id
-
Check with vector with built-in kernel ids and with the selected device - should return
true
-
To previous vector add kernel id with large
[[sycl::reqd_work_group_size(4294967295)]]
attribute and with the selected device - should returnfalse
if value reported byinfo::device::max_work_item_sizes<1>
is less than 4294967295.
-
Check that std::is_default_constructible_v<sycl::kernel_bundle>
is false
.
Call function kernel_bundle::get_backend()
and check that return type is sycl::backend
.
-
Create a 1-element
std::vector<device>
containing the selected device. -
Create kernel_bundle via
get_kernel_bundle<bundle_state::executable>(const context&, const std::vector<device>&)
. -
Call
get_devices()
. -
Check that return type is std::vector<device>.
-
Check that return vector contains only selected device.
-
Create a kernel bundle by calling
get_kernel_bundle<bundle_state::executable>(const context &)
. -
Iterate over all of the kernel ids returned by
get_kernel_ids()
. -
Verify that
has_kernel(kernelId, dev)
returnstrue
if and only ifis_compatible({kernelId}, const device&)
for selected device istrue
.
-
Define kernel with KernelName.
-
Get a kernel bundle in executable state that contains this kernel via
get_kernel_bundle<KernelName, bundle_state::executable>(const context &)
. -
Verify that
has_kernel<KernelName>()
returnstrue
.
-
Define kernel with KernelName.
-
Get a kernel bundle in executable state that contains this kernel via
get_kernel_bundle<KernelName, bundle_state::executable>(const context &)
. -
Verify that
has_kernel<KernelName>(dev)
returnstrue
if and only ifis_compatible<KernelName>(const device&)
for selected device istrue
.
Define 4 kernels.
Get kernel_bundle via get_kernel_bundle<bundle_state::executable>(const context &)
Check that result of get_kernel_ids
:
-
has type
std::vector<kernel_id>
-
has size at least 4
-
has only different kernel ids
Partially tested in https://github.com/KhronosGroup/SYCL-CTS/blob/main/tests/spec_constants/spec_constants_via_kernel_bundle.h
There are two spec constant defined: SpecName
and OtherSpecName
.
kernel_handler::get_specialization_constant<OtherSpecName>() shouldn’t be used in any kernel in the application.
-
Get an empty kernel bundle by calling get_kernel_bundle<bundle_state::executable>(const context &, const std::vector<device> &, Selector) where Selector is a function that always returns
false
. -
Check that
contains_specialization_constants()
returnfalse
. -
Check that
native_specialization_constant()
returnfalse
. -
Check that
has_specialization_constant<SpecName>()
returnfalse
.
-
Define a kernel named
KernelName
that callskernel_handler::get_specialization_constant<SpecName>()
. -
Attempt to get a kernel bundle in input state that contains this kernel by calling
get_kernel_bundle<KernelName, bundle_state::input>(const context &, const std::vector<device>& )
with 1-elementstd::vector<device>
containing the selected device. -
Test if the kernel bundle contains that kernel by calling
kernel_bundle::has_kernel<KernelName()
. If this returnsfalse
, the test is skipped. -
Set each spec constant to a different value via
kernel_bundle::set_specialization_constant()
. -
Check that
contains_specialization_constants()
returntrue
. -
Check that called
native_specialization_constant()
without exception. -
Check that
has_specialization_constant<SpecName>()
returntrue
. -
Check that
has_specialization_constant<OtherSpecName>()
returnfalse
. -
Check that
get_specialization_constant<SpecName>()
return new value. -
Call
compile()
to build thekernel_bundle
intoobject
state. -
Check the same.
-
Call
link()
to build thekernel_bundle
intoexecutable
state. -
Check the same.