Skip to content

Commit 3c9c485

Browse files
authored
Merge pull request #1126 from 0x12CC/sycl_khr_addrspace_cast-plans
Add test plans for `sycl_khr_addrspace_cast` extensions
2 parents 31c03f3 + a346783 commit 3c9c485

File tree

2 files changed

+156
-0
lines changed

2 files changed

+156
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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>`.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
:sectnums:
2+
:xrefstyle: short
3+
4+
= Test plan for SYCL extension KHR static addrspace cast extension
5+
6+
This is a test plan for an extension that defines a new free function for static casts
7+
described in
8+
https://github.com/KhronosGroup/SYCL-Docs/blob/61d8237c37c462f10b2ea0ac0c437aeb544e7882/adoc/extensions/sycl_khr_static_addrspace_cast.adoc[sycl_khr_static_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_STATIC_ADDRSPACE_CAST` macro is
20+
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+
38+
In the kernel scope, do the following:
39+
40+
* Define a `raw_global_ptr` of type `int*` that points to a global buffer element.
41+
* Define a `global_ptr` using `sycl::khr::static_addrspace_cast<sycl::access::address_space::global_space>(raw_global_ptr)`.
42+
* Check that `reinterpret_cast<std::size_t>(raw_global_ptr) == reinterpret_cast<std::size_t>(global_ptr.get_raw())`.
43+
* Store the result of the check in a buffer or USM allocation.
44+
45+
Then, on the host, check that all values in the buffer or USM allocation are
46+
`true`. Repeat this test with `raw_global_ptr` of type `sycl::generic_ptr<int>`,
47+
`sycl::raw_generic_ptr<int>`, and `sycl::decorated_generic_ptr<int>`.
48+
49+
==== `sycl::access::address_space::local_space`
50+
51+
In the kernel scope, do the following:
52+
53+
* Define a `raw_local_ptr` of type `int*` that points to a local accessor element.
54+
* Define a `local_ptr` using `sycl::khr::static_addrspace_cast<sycl::access::address_space::local_space>(raw_local_ptr)`.
55+
* Check that `reinterpret_cast<std::size_t>(raw_local_ptr) == reinterpret_cast<std::size_t>(local_ptr.get_raw())`.
56+
* Store the result of the check in a buffer or USM allocation.
57+
58+
Then, on the host, check that all values in the buffer or USM allocation are
59+
`true`. Repeat this test with `raw_local_ptr` of type `sycl::generic_ptr<int>`,
60+
`sycl::raw_generic_ptr<int>`, and `sycl::decorated_generic_ptr<int>`.
61+
62+
==== `sycl::access::address_space::private_space`
63+
64+
In the kernel scope, do the following:
65+
66+
* Define a `raw_private_ptr` of type `int*` that points to a private variable.
67+
* Define a `private_ptr` using `sycl::khr::static_addrspace_cast<sycl::access::address_space::private_space>(raw_private_ptr)`.
68+
* Check that `reinterpret_cast<std::size_t>(raw_private_ptr) == reinterpret_cast<std::size_t>(private_ptr.get_raw())`.
69+
* Store the result of the check in a buffer or USM allocation.
70+
71+
Then, on the host, check that all values in the buffer or USM allocation are
72+
`true`. Repeat this test with `raw_private_ptr` of type
73+
`sycl::generic_ptr<int>`, `sycl::raw_generic_ptr<int>`, and
74+
`sycl::decorated_generic_ptr<int>`.

0 commit comments

Comments
 (0)