Skip to content

Commit 3f95465

Browse files
[Doc] Add guidelines for adding FE tests (#3122)
1 parent d6f6bf6 commit 3f95465

File tree

2 files changed

+57
-34
lines changed

2 files changed

+57
-34
lines changed

CONTRIBUTING.md

+57
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,63 @@ see [ABI Policy Guide](sycl/doc/ABIPolicyGuide.md) for more information.
5454
- Run regression tests -
5555
[instructions](sycl/doc/GetStartedGuide.md#test-dpc-toolchain).
5656

57+
### Tests development
58+
59+
Every product change should be accompanied with corresponding test modification
60+
(adding new test(s), extending, removing or modifying existing test(s)).
61+
62+
There are 3 types of tests which are used for DPC++ toolchain validation:
63+
* DPC++ in-tree LIT tests including [check-llvm](../../llvm/test),
64+
[check-clang](../../clang/test), [check-llvm-spirv](../../llvm-spirv/test) and
65+
[check-sycl](../../sycl/test) targets stored in this repository. These tests
66+
should not have hardware (e.g. GPU, FPGA, etc.) or external software
67+
dependencies (e.g. OpenCL, Level Zero, CUDA runtimes). All tests not following
68+
this approach should be moved to DPC++ end-to-end or SYCL-CTS tests.
69+
However, the tests for a feature under active development requiring atomic
70+
change for tests and product can be put to
71+
[sycl/test/on-device](../../sycl/test/on-device) temporarily. It is developer
72+
responsibility to move the tests to DPC++ E2E test suite or SYCL-CTS once
73+
the feature is stabilized.
74+
75+
**Guidelines for adding DPC++ in-tree LIT tests (DPC++ Clang FE tests)**:
76+
- Use `sycl::` namespace instead of `cl::sycl::`
77+
78+
- Include sycl mock headers as system headers.
79+
Example: `-internal-isystem %S/Inputs`
80+
`#include "sycl.hpp"`
81+
82+
- Use SYCL functions for invoking kernels from the mock header `(single_task, parallel_for, parallel_for_work_group)`
83+
Example:
84+
```bash
85+
`#include "Inputs/sycl.hpp"`
86+
sycl::queue q;
87+
q.submit([&](cl::sycl::handler &h) {
88+
h.single_task( { //code });
89+
});
90+
```
91+
92+
- Add a helpful comment describing what the test does at the beginning and other comments throughout the test as necessary.
93+
94+
- Try to follow descriptive naming convention for variables, functions as much as possible.
95+
Please refer [LLVM naming convention](https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly)
96+
97+
* DPC++ end-to-end (E2E) tests which are extension to
98+
[LLVM\* test suite](https://github.com/intel/llvm-test-suite/tree/intel/SYCL).
99+
A test which requires full stack including backend runtimes (e.g. OpenCL,
100+
Level Zero or CUDA) should be put to DPC++ E2E test suite following
101+
[CONTRIBUTING](https://github.com/intel/llvm-test-suite/blob/intel/CONTRIBUTING.md).
102+
103+
* SYCL-CTS are official
104+
[Khronos\* SYCL\* conformance tests](https://github.com/KhronosGroup/SYCL-CTS).
105+
They verify SYCL specification compatibility. All implementation details or
106+
extensions are out of scope for the tests. If SYCL specification has changed
107+
(SYCL CTS tests conflict with recent version of SYCL specification) or change
108+
is required in the way the tests are built with DPC++ compiler (defined in
109+
[FindIntel_SYCL](https://github.com/KhronosGroup/SYCL-CTS/blob/SYCL-1.2.1/master/cmake/FindIntel_SYCL.cmake))
110+
pull request should be created under
111+
[KhronosGroup/SYCL-CTS](https://github.com/KhronosGroup/SYCL-CTS) with required
112+
patch.
113+
57114
### Commit message
58115
59116
- When writing your commit message, please make sure to follow

sycl/doc/GetStartedGuide.md

-34
Original file line numberDiff line numberDiff line change
@@ -334,40 +334,6 @@ Make sure that these binaries are available in `PATH` environment variable:
334334
* `aocl-ioc64` from `<oneAPI installation location>/compiler/<version>/<OS>/bin`
335335
336336
### Test DPC++ toolchain
337-
338-
Every product change should be accompanied with corresponding test modification
339-
(adding new test(s), extending, removing or modifying existing test(s)).
340-
341-
There are 3 types of tests which are used for DPC++ toolchain validation:
342-
* DPC++ in-tree LIT tests including [check-llvm](../../llvm/test),
343-
[check-clang](../../clang/test), [check-llvm-spirv](../../llvm-spirv/test) and
344-
[check-sycl](../../sycl/test) targets stored in this repository. These tests
345-
should not have hardware (e.g. GPU, FPGA, etc.) or external software
346-
dependencies (e.g. OpenCL, Level Zero, CUDA runtimes). All tests not following
347-
this approach should be moved to DPC++ end-to-end or SYCL-CTS tests.
348-
However, the tests for a feature under active development requiring atomic
349-
change for tests and product can be put to
350-
[sycl/test/on-device](../../sycl/test/on-device) temporarily. It is developer
351-
responsibility to move the tests to DPC++ E2E test suite or SYCL-CTS once
352-
the feature is stabilized.
353-
354-
* DPC++ end-to-end (E2E) tests which are extension to
355-
[LLVM\* test suite](https://github.com/intel/llvm-test-suite/tree/intel/SYCL).
356-
A test which requires full stack including backend runtimes (e.g. OpenCL,
357-
Level Zero or CUDA) should be put to DPC++ E2E test suite following
358-
[CONTRIBUTING](https://github.com/intel/llvm-test-suite/blob/intel/CONTRIBUTING.md).
359-
360-
* SYCL-CTS are official
361-
[Khronos\* SYCL\* conformance tests](https://github.com/KhronosGroup/SYCL-CTS).
362-
They verify SYCL specification compatibility. All implementation details or
363-
extensions are out of scope for the tests. If SYCL specification has changed
364-
(SYCL CTS tests conflict with recent version of SYCL specification) or change
365-
is required in the way the tests are built with DPC++ compiler (defined in
366-
[FindIntel_SYCL](https://github.com/KhronosGroup/SYCL-CTS/blob/SYCL-1.2.1/master/cmake/FindIntel_SYCL.cmake))
367-
pull request should be created under
368-
[KhronosGroup/SYCL-CTS](https://github.com/KhronosGroup/SYCL-CTS) with required
369-
patch.
370-
371337
#### Run in-tree LIT tests
372338
373339
To verify that built DPC++ toolchain is working correctly, run:

0 commit comments

Comments
 (0)