-
Notifications
You must be signed in to change notification settings - Fork 798
[CI][SYCL][Test] Make check-sycl-unittests also run unit tests with ABI breaking changes.
#19687
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b21e042
[SYCL][Test] Add CMake target for running SYCL unit tests with ABI br…
uditagarwal97 2bf9225
Use CMake's copy_if_different to avoid build rule collision
uditagarwal97 e5e5812
Run unittests in preview mode in CI
uditagarwal97 7032e8c
Fix windows
uditagarwal97 63f00e6
Code reuse between preview and non-preview unittests
uditagarwal97 e3fb020
NFC changes, remove incorrect comments, add space at EOF
uditagarwal97 8b63e12
Don't call unittest preview from non-preview call
uditagarwal97 f8b3633
Update unittests CMakefile to explicitly specify preview target
uditagarwal97 880dfc5
NFC changes
uditagarwal97 22d66d0
Make check-sycl-unittests check both prevew and non-preview versions
uditagarwal97 f6b8ff0
Implicitly create two targets, with and without preview
uditagarwal97 61d5b01
Remove extra s from make target
uditagarwal97 ae27b3d
Remove unrelated formatting changes.
uditagarwal97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| # add_sycl_unittest(test_dirname SHARED|OBJECT file1.cpp, file2.cpp ...) | ||
| # | ||
| # Will compile the list of files together and link against SYCL. | ||
| # Produces a binary names `basename(test_dirname)`. | ||
| macro(add_sycl_unittest_preview test_dirname link_variant) | ||
uditagarwal97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # Enable exception handling for these unit tests | ||
| set(LLVM_REQUIRES_EH ON) | ||
| set(LLVM_REQUIRES_RTTI ON) | ||
|
|
||
| get_target_property(SYCL_BINARY_DIR sycl-toolchain BINARY_DIR) | ||
|
|
||
| string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_lower) | ||
| if (MSVC AND build_type_lower MATCHES "debug") | ||
| set(sycl_obj_target "sycl-previewd_object") | ||
| set(sycl_so_target "sycl-previewd") | ||
| else() | ||
| set(sycl_obj_target "sycl-preview_object") | ||
| set(sycl_so_target "sycl-preview") | ||
| endif() | ||
|
|
||
| if ("${link_variant}" MATCHES "SHARED") | ||
| set(SYCL_LINK_LIBS ${sycl_so_target}) | ||
| add_unittest(SYCLUnitTestsPreview ${test_dirname} ${ARGN}) | ||
| else() | ||
| add_unittest(SYCLUnitTestsPreview ${test_dirname} | ||
| $<TARGET_OBJECTS:${sycl_obj_target}> ${ARGN}) | ||
| target_compile_definitions(${test_dirname} | ||
| PRIVATE __SYCL_BUILD_SYCL_DLL) | ||
|
|
||
| get_target_property(SYCL_LINK_LIBS ${sycl_so_target} LINK_LIBRARIES) | ||
| endif() | ||
|
|
||
| if (SYCL_ENABLE_COVERAGE) | ||
| target_compile_options(${test_dirname} PUBLIC | ||
| -fprofile-instr-generate -fcoverage-mapping | ||
| ) | ||
| target_link_options(${test_dirname} PUBLIC | ||
| -fprofile-instr-generate -fcoverage-mapping | ||
| ) | ||
| endif() | ||
|
|
||
| target_compile_definitions(${test_dirname} | ||
| PRIVATE __INTEL_PREVIEW_BREAKING_CHANGES) | ||
|
|
||
| if (SYCL_ENABLE_XPTI_TRACING) | ||
| target_compile_definitions(${test_dirname} | ||
| PRIVATE XPTI_ENABLE_INSTRUMENTATION XPTI_STATIC_LIBRARY) | ||
| endif() | ||
|
|
||
| # check-sycl-unittests was using an old sycl library. So, to get | ||
| # around this problem, we add the new sycl library to the PATH and | ||
| # LD_LIBRARY_PATH on Windows and Linux respectively. | ||
| if (WIN32) | ||
| add_custom_target(check-sycl-${test_dirname} | ||
| ${CMAKE_COMMAND} -E env | ||
| LLVM_PROFILE_FILE="${SYCL_COVERAGE_PATH}/${test_dirname}.profraw" | ||
| SYCL_CONFIG_FILE_NAME=null.cfg | ||
| SYCL_DEVICELIB_NO_FALLBACK=1 | ||
| SYCL_CACHE_DIR="${CMAKE_BINARY_DIR}/sycl_cache" | ||
| "PATH=${CMAKE_BINARY_DIR}/bin;$ENV{PATH}" | ||
| ${CMAKE_CURRENT_BINARY_DIR}/${test_dirname} | ||
| DEPENDS | ||
| ${test_dirname} | ||
| ) | ||
| else() | ||
| add_custom_target(check-sycl-${test_dirname} | ||
| ${CMAKE_COMMAND} -E env | ||
| LLVM_PROFILE_FILE="${SYCL_COVERAGE_PATH}/${test_dirname}.profraw" | ||
| SYCL_CONFIG_FILE_NAME=null.cfg | ||
| SYCL_DEVICELIB_NO_FALLBACK=1 | ||
| SYCL_CACHE_DIR="${CMAKE_BINARY_DIR}/sycl_cache" | ||
| "LD_LIBRARY_PATH=${SYCL_BINARY_DIR}/unittests/lib:${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" | ||
| ${CMAKE_CURRENT_BINARY_DIR}/${test_dirname} | ||
| DEPENDS | ||
| ${test_dirname} | ||
| ) | ||
| endif() | ||
|
|
||
| add_dependencies(check-sycl-unittests-preview check-sycl-${test_dirname}) | ||
|
|
||
| if(WIN32) | ||
| # Windows doesn't support LD_LIBRARY_PATH, so instead we copy the mock OpenCL binary next to the test and ensure | ||
| # that the test itself links to OpenCL (rather than through ur_adapter_opencl.dll) | ||
| set(mock_ocl ${CMAKE_CURRENT_BINARY_DIR}/OpenCL.dll) | ||
| add_custom_command(TARGET ${test_dirname} POST_BUILD | ||
| COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:mockOpenCL> ${mock_ocl} | ||
| DEPENDS mockOpenCL | ||
| BYPRODUCTS ${mock_ocl}_preview | ||
| COMMAND_EXPAND_LISTS | ||
| ) | ||
| endif() | ||
|
|
||
| target_link_libraries(${test_dirname} | ||
| PRIVATE | ||
| mockOpenCL | ||
| LLVMTestingSupport | ||
| OpenCL-Headers | ||
| unified-runtime::mock | ||
| ${SYCL_LINK_LIBS} | ||
| ) | ||
|
|
||
| add_dependencies(${test_dirname} ur_adapter_mock mockOpenCL) | ||
|
|
||
| if(SYCL_ENABLE_EXTENSION_JIT) | ||
| target_link_libraries(${test_dirname} PRIVATE sycl-jit) | ||
| endif(SYCL_ENABLE_EXTENSION_JIT) | ||
|
|
||
| if(WIN32) | ||
| target_link_libraries(${test_dirname} PRIVATE UnifiedRuntimeLoader ur_win_proxy_loader) | ||
| endif() | ||
|
|
||
| target_include_directories(${test_dirname} | ||
| PRIVATE SYSTEM | ||
| ${sycl_inc_dir} | ||
| ${SYCL_SOURCE_DIR}/source/ | ||
| ${SYCL_SOURCE_DIR}/unittests/ | ||
| ) | ||
| if (UNIX) | ||
| # These warnings are coming from Google Test code. | ||
| target_compile_options(${test_dirname} | ||
| PRIVATE | ||
| -Wno-unused-parameter | ||
| -Wno-inconsistent-missing-override | ||
| ) | ||
| endif() | ||
|
|
||
| target_compile_definitions(${test_dirname} PRIVATE SYCL_DISABLE_FSYCL_SYCLHPP_WARNING) | ||
| endmacro() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -221,7 +221,8 @@ sycl::detail::Requirement getMockRequirement(const MemObjT &MemObj) { | |
| class MockHandler : public sycl::handler { | ||
| public: | ||
| MockHandler(sycl::detail::queue_impl &Queue, bool CallerNeedsEvent) | ||
| : sycl::handler(Queue.shared_from_this(), CallerNeedsEvent) {} | ||
| : sycl::handler(std::make_unique<sycl::detail::handler_impl>( | ||
|
||
| Queue, nullptr, CallerNeedsEvent)) {} | ||
| // Methods | ||
| using sycl::handler::addReduction; | ||
| using sycl::handler::getType; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
IMO, existing target should just check both.
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.
Do you mean that
check-sycl-unittestsshould check both preview and non-preview?OR
Was you comment specific to the CI job, like a single job for both preview and non-preview unittest run?
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.
check-sycl-unittestsshould check both preview and non-preview.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.
Done in 22d66d0