-
Notifications
You must be signed in to change notification settings - Fork 755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SYCL][PI] Fix PI unittests and always build them #585
[SYCL][PI] Fix PI unittests and always build them #585
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I think is important the PI API is always tested !
@Ruyk With the change it will be build by default but it is not part of any |
add_subdirectory( tools ) | ||
if (NOT DEFINED LLVM_INCLUDE_TESTS) | ||
set(LLVM_INCLUDE_TESTS ON) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aligns testing and unittests with other LLVM projects CMake usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this as a comment too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit contains a comment that SYCL CMake is now stronger aligned with how the other LLVM projects are set up.
Other LLVM projects I checked do not comment on where they copied and adapted from other LLVM projects though it is clear that they are aligned.
add_custom_target(PiUnitTests) | ||
set_target_properties(PiUnitTests PROPERTIES FOLDER "Tests") | ||
add_custom_target(SYCLUnitTests) | ||
set_target_properties(SYCLUnitTests PROPERTIES FOLDER "SYCL tests") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aligns testing and unittests with other LLVM projects CMake usage, e.g., Clang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other LLVM projects I checked do not comment on where they copied and adapted from other LLVM projects though it is clear that they are aligned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the clarification!
add_subdirectory( tools ) | ||
if (NOT DEFINED LLVM_INCLUDE_TESTS) | ||
set(LLVM_INCLUDE_TESTS ON) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this as a comment too.
add_custom_target(PiUnitTests) | ||
set_target_properties(PiUnitTests PROPERTIES FOLDER "Tests") | ||
add_custom_target(SYCLUnitTests) | ||
set_target_properties(SYCLUnitTests PROPERTIES FOLDER "SYCL tests") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idem.
@@ -0,0 +1,29 @@ | |||
@LIT_SITE_CFG_IN_HEADER@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied and adapted from Clang.
@@ -0,0 +1,59 @@ | |||
# -*- Python -*- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied and adapted from Clang.
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in | ||
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg | ||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in | ||
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aligning with Clang.
|
Great thanks for doing this! The PI tests will be build always, but when/how are they run? |
@smaslov-intel This now works as in Clang and the other LLVM projects:
|
I have addressed the changes requested by @bader and resolved the discussion though GitHub has not marked the change request as resolved. |
Thanks for the detailed explanation, but I still have these questions:
|
After configuring the project CMake (for example with the buildbot config script that now sets To only build and run the SYCL unittests use:
Four ways (I know of):
|
I just noticed that this is not correct: for LLVM and Clang (and some other LLVM projects) special unit test targets exist, e.g.: |
I found it. I will push an update that enables a target called This update will also add build and run targets for all individual LIT tests of SYCL that you can list by doing the following on the command line: ninja -t targets | grep check-sycl- |
LLVM has two CMake options to include/build unittests: * `LLVM_INCLUDE_TESTS` to generate CMake targets for all kind of testing, which is `ON` by default. * `LLVM_BUILD_TESTS` to build the included unittests CMake targets, which is `OFF` by default. Other LLVM projects introduce a `<PROJECT>_INCLUDE_TESTS` option to control if CMake targets should be created for their different tests. If their unittests are build by default is controlled by the `LLVM_BUILD_TESTS` option. This commit aligns SYCL testing and unittesting with other LLVM projects, e.g.: * introduces a `SYCL_INCLUDE_TESTS` option, * renames the SYCL unittest suite to `SYCLUnitTests`, and * introduces the `add_sycl_unittest` CMake function to simplify adding SYCL-specific unittests. * Aligns naming of CMake unittest folder with Clang. * Copies Clang unittest LIT infrastructure to SYCL unittests. * Renames LIT testsuite names of SYCL to "SYCL" and * names the unittests in LIT as "SYCL-Unit". * Adapts other LLVM projects LIT config files naming scheme. * Cleans up CMake variables used by LIT config `.in` files and aligns variable names stronger with other LLVM projects. * Makes the SYCL unittests part of the `check-sycl` target, i.e., builds them on demand. * Adds a CMake target to build/run every SYLC LIT test including unit tests with `check-sycl-unit`. Signed-off-by: Bjoern Knafla <[email protected]>
SYCL examples, e.g., in the Khronos specs, include the SYCL header as system headers. Adapt includes in the `CL/sycl/detail/pi.hpp` header to this style. Signed-off-by: Bjoern Knafla <[email protected]>
) | ||
set_target_properties(check-sycl PROPERTIES FOLDER "SYCL tests") | ||
|
||
add_lit_testsuites(SYCL ${CMAKE_CURRENT_SOURCE_DIR} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds a check-sycl-<subdir>
target for every sub-directory of sycl/test
including for the Unit
sub-directory which will run the unittests from sycl/unittests
.
@@ -14,7 +14,7 @@ | |||
# Configuration file for the 'lit' test runner. | |||
|
|||
# name: The name of this test suite. | |||
config.name = 'SYCLUnitTests' | |||
config.name = 'SYCL' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in line with Clang now.
Thanks @bjoernknafla. Just a comment that in a longer run pi::initialize() can see multiple PI plugins, and hence there should be a way in these PI tests to check running through all of them (or the one that is somehow forced). |
Makes sense. |
Enforce building of SYCL PI API unittests by default to catch build
problems due to CMake changes.
The PI API unittests use LLVM's
add_unittest
infrastructure whichonly builds unittests if the CMake flag
LLVM_BUILD_TESTS
isON
.The fix always sets this CMake variable locally when adding PI API
unittests.
This commit also contains other fixes required to build PI API
unittests again.
Signed-off-by: Bjoern Knafla [email protected]