The HIT framework automatically finds and adds test cases to the CMAKE testing environment. It achives this by parsing all files in the tests/src folder.
In the above, BUILD commands provide instructions on how to build the test case while TEST commands provide instructions on how to execute the test case.
%s: refers to current source file name. Additional source files needed for the test can be specified by name (including relative path).
%t: refers to target executable named derived by removing the extension from the current source file. Alternatively a target executable name can be specified.
%s: refers to current source file name. Additional source files needed for the test can be specified by name (including relative path).
%t: refers to target executable named derived by removing the extension from the current source file. Alternatively a target executable name can be specified.
%hc: refers to hipcc pointed to by $CMAKE_INSTALL_PREFIX/bin/hipcc.
%t: refers to target executable named derived by removing the extension from the current source file. Alternatively a target executable name can be specified.
Note that if the test has been excluded for a specific platform/runtime/compiler in the BUILD command, it is automatically excluded from the TEST command as well for the sameplatform.
When using the TEST command, HIT will squash and append the arguments specified to the test executable name to generate the CMAKE test name. Sometimes we might want to specify a more descriptive name. The TEST_NAMED command is used for that. The supported syntax for the TEST_NAMED command is:
1. Move all its kernels to `tests/catch/kernels` (one file per kernel):
1. Kernel **functions** should use the file extension `.cpp` and include `kernels.hh`
2. Kernel **templates** should use the file extension `.inl`
2. Update `tests/catch/kernels/CMakeLists.txt` (i.e. add the new kernel **functions** to `TEST_SRC`)
3. Update `tests/catch/include/kernels.hh`:
1. Declare the new kernel **functions**
2. Include the new .inl files that contain kernel **templates**
3. Call the `FUNCTION_WRAPPER` and `TEMPLATE_WRAPPER` macros for each new function and template respectively.
4. Update `tests/catch/include/kernel_mapping.hh` with the mapping between the new files and respective function / template names.
5. Include `kernels.hh`
6. Call the `hipTest::launchKernel()` function instead of `hipLaunchKernelGGL()`
**Note:** HIP RTC does not do implicit casting of kernel parameters. This **requires** the test writer to explicitly do all the casting before running the kernel. There is a `static_assert` inside `hipTest::launchKernel()` that checks that this was done correctly. However, due to limitations, the assertion is only performed when `-DRTC_TESTING` option is **disabled**. This means that runtime errors can occur if the casts are not performed correctly and `-DRTC_TESTING` is enabled.
- Prefer to enhance an existing test as opposed to writing a new one. Tests have overhead to start and many small tests spend precious test time on startup and initialization issues.
- Make the test run standalone without requirement for command-line arguments. THis makes it easier to debug since the name of the test is shown in the test report and if you know the name of the test you can the run the test.
- For long-running tests or tests with multiple phases, consider using the --tests option as an optional mechanism to allow debuggers to start with the failing subset of the test.