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:
To enable RTC testing, cmake needs to be passed the DRTC_TESTING=1 options.
When this option is passed, all tests that support this functionality will be run using HIP RTC to compile and run.
To enable HIP RTC support for a specific test:
1 - Move all its kernels to tests/catch/kernels (one file per kernel)
2 - Update tests/catch/kernels/CMakeLists.txt
3 - Update tests/catch/include/kernels.hh
4 - Update tests/catch/include/kernel_mapping.hh
5 - Include kernels.hh
6 - Call 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. The code will not compile otherwise.
- 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.