Skip to content

Commit

Permalink
added -fsycl -fsycl-device-code-split=per_kernel at the linking stage…
Browse files Browse the repository at this point in the history
… to have device code
  • Loading branch information
egrabovskaya committed Jul 15, 2024
1 parent 8abfdfc commit 5890883
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
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 5890883

Please sign in to comment.