Skip to content

Commit

Permalink
[RNG] Added -fsycl -fsycl-device-code-split=per_kernel at the linking…
Browse files Browse the repository at this point in the history
… stage to have device code because of failures on windows (#533)
  • Loading branch information
egrabovskaya authored Jul 18, 2024
1 parent f2d2dcb commit 28e7aa9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
1 change: 0 additions & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
install(FILES FindCompiler.cmake
DESTINATION "lib/cmake/${PROJECT_NAME}"
)

if(ENABLE_MKLGPU_BACKEND OR ENABLE_MKLCPU_BACKEND)
install(FILES mkl/MKLConfig.cmake
DESTINATION "lib/cmake/${PROJECT_NAME}"
Expand Down
2 changes: 0 additions & 2 deletions cmake/FindCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
#===============================================================================

include_guard()

include(CheckCXXCompilerFlag)
include(FindPackageHandleStandardArgs)

check_cxx_compiler_flag("-fsycl" is_dpcpp)

if(is_dpcpp)
Expand Down
4 changes: 4 additions & 0 deletions examples/rng/device/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ foreach(rng_device_source ${RNG_DEVICE_SOURCES})
ONEMKL::SYCL::SYCL
)

if(NOT ${ONEMKL_SYCL_IMPLEMENTATION} STREQUAL "hipsycl")
target_link_options(example_${domain}_${rng_device_source} PUBLIC -fsycl -fsycl-device-code-split=per_kernel)
endif()

# Register example as ctest
foreach(device_filter ${DEVICE_FILTERS})
add_test(NAME ${domain}/EXAMPLE/DEVICE/${rng_device_source}/${device_filter} COMMAND example_${domain}_${rng_device_source})
Expand Down
10 changes: 7 additions & 3 deletions tests/unit_tests/rng/device/moments/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#===============================================================================

# Build object from all test sources
set(SERVICE_TESTS_SOURCES "moments.cpp")
set(MOMENTS_DEVICE_TESTS_SOURCES "moments.cpp")

add_library(rng_device_moments_ct OBJECT ${SERVICE_TESTS_SOURCES})
add_library(rng_device_moments_ct OBJECT ${MOMENTS_DEVICE_TESTS_SOURCES})
target_compile_options(rng_device_moments_ct PRIVATE -DNOMINMAX)
target_include_directories(rng_device_moments_ct
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
Expand All @@ -30,7 +30,11 @@ target_include_directories(rng_device_moments_ct
PUBLIC ${CMAKE_BINARY_DIR}/bin
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET rng_device_moments_ct SOURCES ${SERVICE_TESTS_SOURCES})
add_sycl_to_target(TARGET rng_device_moments_ct SOURCES ${MOMENTS_DEVICE_TESTS_SOURCES})
else()
target_link_libraries(rng_device_moments_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()

if(NOT ${ONEMKL_SYCL_IMPLEMENTATION} STREQUAL "hipsycl")
target_link_options(rng_device_moments_ct PUBLIC -fsycl -fsycl-device-code-split=per_kernel)
endif()
10 changes: 7 additions & 3 deletions tests/unit_tests/rng/device/service/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#===============================================================================

# Build object from all test sources
set(SERVICE_TESTS_SOURCES "skip_ahead.cpp")
set(SERVICE_DEVICE_TESTS_SOURCES "skip_ahead.cpp")

add_library(rng_device_service_ct OBJECT ${SERVICE_TESTS_SOURCES})
add_library(rng_device_service_ct OBJECT ${SERVICE_DEVICE_TESTS_SOURCES})
target_compile_options(rng_device_service_ct PRIVATE -DNOMINMAX)
target_include_directories(rng_device_service_ct
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
Expand All @@ -30,7 +30,11 @@ target_include_directories(rng_device_service_ct
PUBLIC ${CMAKE_BINARY_DIR}/bin
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET rng_device_service_ct SOURCES ${SERVICE_TESTS_SOURCES})
add_sycl_to_target(TARGET rng_device_service_ct SOURCES ${SERVICE_DEVICE_TESTS_SOURCES})
else()
target_link_libraries(rng_device_service_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()

if(NOT ${ONEMKL_SYCL_IMPLEMENTATION} STREQUAL "hipsycl")
target_link_options(rng_device_service_ct PUBLIC -fsycl -fsycl-device-code-split=per_kernel)
endif()

0 comments on commit 28e7aa9

Please sign in to comment.