|
| 1 | +:sectnums: |
| 2 | +:xrefstyle: short |
| 3 | + |
| 4 | += Test plan for SYCL extension KHR group interface |
| 5 | + |
| 6 | +This is a test plan for an extension that defines a new interface for groups |
| 7 | +described in |
| 8 | +https://github.com/KhronosGroup/SYCL-Docs/blob/b05db85e72f489ea10d8b87f111624719425614d/adoc/extensions/sycl_khr_group_interface.adoc[sycl_khr_group_interface]. |
| 9 | + |
| 10 | +== Testing scope |
| 11 | + |
| 12 | +=== Device coverage |
| 13 | + |
| 14 | +All of the tests described below are performed only on the default device that |
| 15 | +is selected on the CTS command line. |
| 16 | + |
| 17 | +=== Feature test macro |
| 18 | + |
| 19 | +The tests should statically check that the `SYCL_KHR_GROUP_INTERFACE` macro is |
| 20 | +defined. |
| 21 | + |
| 22 | +== Tests |
| 23 | + |
| 24 | +The test cases should test the interface of each of the following classes |
| 25 | +defined in the extension: |
| 26 | + |
| 27 | +* `sycl::khr::work_group<Dimensions>` |
| 28 | +* `sycl::khr::sub_group` |
| 29 | +* `sycl::khr::work_item<sycl::khr::work_group<Dimensions>>` |
| 30 | +* `sycl::khr::work_item<sycl::khr::sub_group>` |
| 31 | + |
| 32 | +These test cases should run ND-range kernels with `Dimensions` equal to 1, 2, |
| 33 | +and 3. |
| 34 | + |
| 35 | +=== Test description |
| 36 | + |
| 37 | +==== `work_group<Dimensions>` class |
| 38 | + |
| 39 | +In the kernel scope, do the following: |
| 40 | + |
| 41 | +* Define a `sycl::khr::work_group<Dimensions>` named `work_group` using `it.get_group()`. |
| 42 | +* Define a `sycl::group<Dimensions>` named `group` using `it.get_group()`. |
| 43 | +* Check that `work_group.id()` returns a `work_group<Dimensions>::id_type`. |
| 44 | +* Check that `work_group.id() == group.get_group_id()`. |
| 45 | +* Check that `work_group.linear_id()` returns a `work_group<Dimensions>::linear_id_type`. |
| 46 | +* Check that `work_group.linear_id() == group.get_group_linear_id()`. |
| 47 | +* Check that `work_group.range()` returns a `work_group<Dimensions>::range_type`. |
| 48 | +* Check that `work_group.range() == group.get_group_range()`. |
| 49 | +* Check that `work_group.size()` returns a `work_group<Dimensions>::size_type`. |
| 50 | +* Check that `work_group.size() == group.get_local_linear_range()`. |
| 51 | +* Check that `sycl::khr::leader_of(work_group)` returns a `bool`. |
| 52 | +* Check that `sycl::khr::leader_of(work_group) == group.leader()`. |
| 53 | + |
| 54 | +Also in the kernel scope, with a `#if __cplusplus >= 202302L` macro guard, do the following: |
| 55 | + |
| 56 | +* Check that `work_group.extents()` returns a `work_group<Dimensions>::extents_type`. |
| 57 | +* Check that `work_group.extents() == std::dextents<std::size_t, Dimensions>(group.get_local_range()[0], ...)`. |
| 58 | +* Check that `work_group.extent(0)` returns a `work_group<Dimensions>::extents_type::index_type`. |
| 59 | +* For each dimension, `d`, check that `work_group.extent(d) == work_group.extents().extent(d)` |
| 60 | +* Check that `work_group<Dimensions>::rank()` returns a `work_group<Dimensions>::extents_type::rank_type`. |
| 61 | +* Check that `decltype(work_group)::rank() == decltype(work_group.extents())::rank()` |
| 62 | +* Check that `work_group<Dimensions>::rank_dynamic()` returns a `work_group<Dimensions>::extents_type::rank_type`. |
| 63 | +* Check that `decltype(work_group)::rank_dynamic() == decltype(work_group.extents())::rank_dynamic()` |
| 64 | +* Check that `work_group<Dimensions>::static_extent(0)` returns a `std::size_t`. |
| 65 | +* For each dimension, `d`, check that `decltype(work_group)::static_extent(d) == decltype(work_group.extents())::static_extent(d)` |
| 66 | + |
| 67 | +==== `sub_group` class |
| 68 | + |
| 69 | +In the kernel scope, do the following: |
| 70 | + |
| 71 | +* Define a `sycl::khr::sub_group` name `sub_group` using `it.get_sub_group()`. |
| 72 | +* Define a `sycl::sub_group` name `group` using `it.get_sub_group()`. |
| 73 | +* Check that `sub_group.id()` returns a `sub_group::id_type`. |
| 74 | +* Check that `sub_group.id() == group.get_group_id()`. |
| 75 | +* Check that `sub_group.linear_id()` returns a `sub_group::linear_id_type`. |
| 76 | +* Check that `sub_group.linear_id() == group.get_group_linear_id()`. |
| 77 | +* Check that `sub_group.range()` returns a `sub_group::range_type`. |
| 78 | +* Check that `sub_group.range() == group.get_group_range()`. |
| 79 | +* Check that `sub_group.size()` returns a `sub_group::size_type`. |
| 80 | +* Check that `sub_group.size() == group.get_local_range()[0]`. |
| 81 | +* Check that `sub_group.max_size()` returns a `sub_group::size_type`. |
| 82 | +* Check that `sub_group.max_size() == group.get_max_local_range()[0]`. |
| 83 | +* Check that `sycl::khr::leader_of(sub_group)` returns a `bool`. |
| 84 | +* Check that `sycl::khr::leader_of(sub_group) == group.leader()`. |
| 85 | + |
| 86 | +Also in the kernel scope, with a `#if __cplusplus >= 202302L` macro guard, do the following: |
| 87 | + |
| 88 | +* Check that `sub_group.extents()` returns a `sub_group::extents_type`. |
| 89 | +* Check that `sub_group.extents() == std::dextents<std::uint32_t, 1>(group.get_local_linear_range())`. |
| 90 | +* Check that `sub_group.extent(0)` returns a `sub_group::extents_type::index_type`. |
| 91 | +* Check that `sub_group.extent(0) == sub_group.extents().extent(0)` |
| 92 | +* Check that `sub_group::rank()` returns a `sub_group::extents_type::rank_type`. |
| 93 | +* Check that `decltype(sub_group)::rank() == decltype(sub_group.extents())::rank()` |
| 94 | +* Check that `sub_group::rank_dynamic()` returns a `sub_group::extents_type::rank_type`. |
| 95 | +* Check that `decltype(sub_group)::rank_dynamic() == decltype(sub_group.extents())::rank_dynamic()` |
| 96 | +* Check that `sub_group::static_extent(0)` returns a `std::size_t`. |
| 97 | +* check that `decltype(sub_group)::static_extent(0) == decltype(sub_group.extents())::static_extent(0)` |
| 98 | + |
| 99 | +==== `work_item<work_group<Dimensions>>` class |
| 100 | + |
| 101 | +In the kernel scope, do the following: |
| 102 | + |
| 103 | +* Define a `sycl::group<Dimensions>` named `group` using `it.get_group()`. |
| 104 | +* Define a `sycl::khr::work_group<Dimensions>` named `work_group` using `it.get_group()`. |
| 105 | +* Define a type alias `wg_item` equal to `sycl::khr::work_item<sycl::khr::work_group<Dimensions>>` |
| 106 | +* Define a `wg_item` named `item` using `sycl::khr::get_item(work_group)`. |
| 107 | +* Check that `item.id()` returns a `wg_item::id_type`. |
| 108 | +* Check that `item.id() == group.get_local_id()`. |
| 109 | +* Check that `item.linear_id()` returns a `wg_item::linear_id_type`. |
| 110 | +* Check that `item.linear_id() == group.get_local_linear_id()`. |
| 111 | +* Check that `item.range()` returns a `wg_item::range_type`. |
| 112 | +* Check that `item.range() == group.get_local_range()`. |
| 113 | +* Check that `item.size()` returns a `wg_item::size_type`. |
| 114 | +* Check that `item.size() == 1`. |
| 115 | + |
| 116 | +Also in the kernel scope, with a `#if __cplusplus >= 202302L` macro guard, do the following: |
| 117 | + |
| 118 | +* Check that `item.extents()` returns a `wg_item::extents_type`. |
| 119 | +* Check that `item.extents() == std::extents<std::size_t, 1, ...>()`. |
| 120 | +* Check that `item.extent(0)` returns a `wg_item::extents_type::index_type`. |
| 121 | +* For each dimension, `d`, check that `item.extent(d) == item.extents().extent(d)` |
| 122 | +* Check that `wg_item::rank()` returns a `wg_item::extents_type::rank_type`. |
| 123 | +* Check that `decltype(item)::rank() == decltype(item.extents())::rank()` |
| 124 | +* Check that `wg_item::rank_dynamic()` returns a `wg_item::extents_type::rank_type`. |
| 125 | +* Check that `decltype(item)::rank_dynamic() == decltype(item.extents())::rank_dynamic()` |
| 126 | +* Check that `wg_item::static_extent(0)` returns a `std::size_t`. |
| 127 | +* For each dimension, `d`, check that `decltype(item)::static_extent(d) == decltype(item.extents())::static_extent(d)` |
| 128 | + |
| 129 | +==== `work_item<sub_group>` class |
| 130 | + |
| 131 | +In the kernel scope, do the following: |
| 132 | + |
| 133 | +* Define a `sycl::sub_group` named `group` using `it.get_sub_group()`. |
| 134 | +* Define a `sycl::khr::sub_group` named `sub_group` using `it.get_sub_group()`. |
| 135 | +* Define a type alias `wg_item` equal to `sycl::khr::work_item<sycl::khr::sub_group>` |
| 136 | +* Define a `wg_item` named `item` using `sycl::khr::get_item(sub_group)`. |
| 137 | +* Check that `item.id()` returns a `wg_item::id_type`. |
| 138 | +* Check that `item.id() == group.get_local_id()`. |
| 139 | +* Check that `item.linear_id()` returns a `wg_item::linear_id_type`. |
| 140 | +* Check that `item.linear_id() == group.get_local_linear_id()`. |
| 141 | +* Check that `item.range()` returns a `wg_item::range_type`. |
| 142 | +* Check that `item.range() == group.get_local_range()`. |
| 143 | +* Check that `item.size()` returns a `wg_item::size_type`. |
| 144 | +* Check that `item.size() == 1`. |
| 145 | + |
| 146 | +Also in the kernel scope, with a `#if __cplusplus >= 202302L` macro guard, do the following: |
| 147 | + |
| 148 | +* Check that `item.extents()` returns a `wg_item::extents_type`. |
| 149 | +* Check that `item.extents() == std::extents<std::uint32_t, 1>()`. |
| 150 | +* Check that `item.extent(0)` returns a `wg_item::extents_type::index_type`. |
| 151 | +* Check that `item.extent(0) == item.extents().extent(0)` |
| 152 | +* Check that `wg_item::rank()` returns a `wg_item::extents_type::rank_type`. |
| 153 | +* Check that `decltype(item)::rank() == decltype(item.extents())::rank()` |
| 154 | +* Check that `wg_item::rank_dynamic()` returns a `wg_item::extents_type::rank_type`. |
| 155 | +* Check that `decltype(item)::rank_dynamic() == decltype(item.extents())::rank_dynamic()` |
| 156 | +* Check that `wg_item::static_extent(0)` returns a `std::size_t`. |
| 157 | +* Check that `decltype(item)::static_extent(0) == decltype(item.extents())::static_extent(0)` |
0 commit comments