Skip to content

Commit 145b9e7

Browse files
[SYCL][Doc] Update test section of the contribution guide (#4814)
* Add a mention of the two types of check-sycl tests (LIT, unit) * Add a note on prioritizing component tests * Fix broken links
1 parent c9128e6 commit 145b9e7

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

CONTRIBUTING.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,37 @@ Every product change should be accompanied with corresponding test modification
6262
(adding new test(s), extending, removing or modifying existing test(s)).
6363

6464
There are 3 types of tests which are used for DPC++ toolchain validation:
65-
* DPC++ in-tree LIT tests including [check-llvm](../../llvm/test),
66-
[check-clang](../../clang/test), [check-llvm-spirv](../../llvm-spirv/test) and
67-
[check-sycl](../../sycl/test) targets stored in this repository. These tests
65+
* DPC++ in-tree tests including [check-llvm](llvm/test),
66+
[check-clang](clang/test), [check-llvm-spirv](llvm-spirv/test) and
67+
[check-sycl](sycl/test) targets stored in this repository. These tests
6868
should not have hardware (e.g. GPU, FPGA, etc.) or external software
6969
dependencies (e.g. OpenCL, Level Zero, CUDA runtimes). All tests not following
7070
this approach should be moved to DPC++ end-to-end or SYCL-CTS tests.
71+
Generally, any functional change to any of the DPC++ toolchain components
72+
should be accompanied by one or more tests of this type when possible. They
73+
allow verifying individual components and tend to be more lightweight than
74+
end-to-end or SYCL-CTS tests.
75+
76+
**General guidelines for adding DPC++ in-tree tests**:
7177

72-
**Guidelines for adding DPC++ in-tree LIT tests (DPC++ Clang FE tests)**:
7378
- Use `sycl::` namespace instead of `cl::sycl::`
7479

80+
- Add a helpful comment describing what the test does at the beginning and
81+
other comments throughout the test as necessary.
82+
83+
- Try to follow descriptive naming convention for variables, functions as
84+
much as possible.
85+
Please refer to
86+
[LLVM naming convention](https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly)
87+
88+
**DPC++ clang FE tests**:
89+
7590
- Include sycl mock headers as system headers.
7691
Example: `-internal-isystem %S/Inputs`
7792
`#include "sycl.hpp"`
7893

79-
- Use SYCL functions for invoking kernels from the mock header `(single_task, parallel_for, parallel_for_work_group)`
94+
- Use SYCL functions for invoking kernels from the mock header
95+
`(single_task, parallel_for, parallel_for_work_group)`
8096
Example:
8197
```bash
8298
`#include "Inputs/sycl.hpp"`
@@ -86,10 +102,14 @@ this approach should be moved to DPC++ end-to-end or SYCL-CTS tests.
86102
});
87103
```
88104
89-
- Add a helpful comment describing what the test does at the beginning and other comments throughout the test as necessary.
105+
**DPC++ headers and runtime tests**:
90106
91-
- Try to follow descriptive naming convention for variables, functions as much as possible.
92-
Please refer [LLVM naming convention](https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly)
107+
- [check-sycl](sycl/test) target contains 2 types of tests: LIT tests and
108+
unit tests. LIT tests make compile-time checks of DPC++ headers, e.g. device
109+
code IR verification, static_assert tests. Unit tests check DPC++ runtime
110+
behavior and do not perform any device code compilation, instead relying on
111+
redefining plugin API with [PiMock](sycl/unittests/helpers/PiMock.hpp) when
112+
necessary.
93113
94114
* DPC++ end-to-end (E2E) tests which are extension to
95115
[LLVM\* test suite](https://github.com/intel/llvm-test-suite/tree/intel/SYCL).

0 commit comments

Comments
 (0)