|
| 1 | +:sectnums: |
| 2 | +:xrefstyle: short |
| 3 | + |
| 4 | += Test plan for SYCL extension KHR dynamic addrspace cast extension |
| 5 | + |
| 6 | +This is a test plan for an extension that defines a new free function for dynamic casts |
| 7 | +described in |
| 8 | +https://github.com/KhronosGroup/SYCL-Docs/blob/61d8237c37c462f10b2ea0ac0c437aeb544e7882/adoc/extensions/sycl_khr_dynamic_addrspace_cast.adoc[sycl_khr_dynamic_addrspace_cast]. |
| 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_DYNAMIC_ADDRSPACE_CAST` |
| 20 | +macro is defined. |
| 21 | + |
| 22 | +== Tests |
| 23 | + |
| 24 | +The test cases should test the cast function defined in the extension for |
| 25 | +pointers in each of the following address spaces: |
| 26 | + |
| 27 | +* `sycl::access::address_space::global_space` |
| 28 | +* `sycl::access::address_space::local_space` |
| 29 | +* `sycl::access::address_space::private_space` |
| 30 | + |
| 31 | +These test cases should run on 1D, 2D, and 3D kernels. |
| 32 | + |
| 33 | +=== Test description |
| 34 | + |
| 35 | +==== `sycl::access::address_space::global_space` |
| 36 | + |
| 37 | +In the kernel scope, do the following: |
| 38 | + |
| 39 | +* Define a `raw_global_ptr` of type `int*` that points to a global buffer element. |
| 40 | +* Define a `global_ptr` using `sycl::khr::dynamic_addrspace_cast<sycl::access::address_space::global_space>(raw_global_ptr)`. |
| 41 | +* Define a `local_ptr` using `sycl::khr::dynamic_addrspace_cast<sycl::access::address_space::local_space>(raw_global_ptr)`. |
| 42 | +* Define a `private_ptr` using `sycl::khr::dynamic_addrspace_cast<sycl::access::address_space::private_space>(raw_global_ptr)`. |
| 43 | +* Check that `reinterpret_cast<std::size_t>(raw_global_ptr) == reinterpret_cast<std::size_t>(global_ptr.get_raw())`. |
| 44 | +* Check that `local_ptr.get_raw() == nullptr` and `private_ptr.get_raw() == nullptr`. |
| 45 | +* Store the result of the checks in a buffer or USM allocation. |
| 46 | + |
| 47 | +Then, on the host, check that all values in the buffer or USM allocation are |
| 48 | +`true`. Repeat this test with `raw_global_ptr` of type `sycl::generic_ptr<int>`, |
| 49 | +`sycl::raw_generic_ptr<int>`, and `sycl::decorated_generic_ptr<int>`. |
| 50 | + |
| 51 | +==== `sycl::access::address_space::local_space` |
| 52 | + |
| 53 | +In the kernel scope, do the following: |
| 54 | + |
| 55 | +* Define a `raw_local_ptr` of type `int*` that points to a local accessor element. |
| 56 | +* Define a `global_ptr` using `sycl::khr::dynamic_addrspace_cast<sycl::access::address_space::global_space>(raw_local_ptr)`. |
| 57 | +* Define a `local_ptr` using `sycl::khr::dynamic_addrspace_cast<sycl::access::address_space::local_space>(raw_local_ptr)`. |
| 58 | +* Define a `private_ptr` using `sycl::khr::dynamic_addrspace_cast<sycl::access::address_space::private_space>(raw_local_ptr)`. |
| 59 | +* Check that `reinterpret_cast<std::size_t>(raw_local_ptr) == reinterpret_cast<std::size_t>(local_ptr.get_raw())`. |
| 60 | +* Check that `global_ptr.get_raw() == nullptr` and `private_ptr.get_raw() == nullptr`. |
| 61 | +* Store the result of the checks in a buffer or USM allocation. |
| 62 | + |
| 63 | +Then, on the host, check that all values in the buffer or USM allocation are |
| 64 | +`true`. Repeat this test with `raw_local_ptr` of type `sycl::generic_ptr<int>`, |
| 65 | +`sycl::raw_generic_ptr<int>`, and `sycl::decorated_generic_ptr<int>`. |
| 66 | + |
| 67 | +==== `sycl::access::address_space::private_space` |
| 68 | + |
| 69 | +In the kernel scope, do the following: |
| 70 | + |
| 71 | +* Define a `raw_private_ptr` of type `int*` that points to a private variable. |
| 72 | +* Define a `global_ptr` using `sycl::khr::dynamic_addrspace_cast<sycl::access::address_space::global_space>(raw_private_ptr)`. |
| 73 | +* Define a `local_ptr` using `sycl::khr::dynamic_addrspace_cast<sycl::access::address_space::local_space>(raw_private_ptr)`. |
| 74 | +* Define a `private_ptr` using `sycl::khr::dynamic_addrspace_cast<sycl::access::address_space::private_space>(raw_private_ptr)`. |
| 75 | +* Check that `reinterpret_cast<std::size_t>(raw_private_ptr) == reinterpret_cast<std::size_t>(private_ptr.get_raw())`. |
| 76 | +* Check that `global_ptr.get_raw() == nullptr` and `local_ptr.get_raw() == nullptr`. |
| 77 | +* Store the result of the checks in a buffer or USM allocation. |
| 78 | + |
| 79 | +Then, on the host, check that all values in the buffer or USM allocation are |
| 80 | +`true`. Repeat this test with `raw_private_ptr` of type |
| 81 | +`sycl::generic_ptr<int>`, `sycl::raw_generic_ptr<int>`, and |
| 82 | +`sycl::decorated_generic_ptr<int>`. |
0 commit comments