From 58908830db36a5a361597a159add93523b5624e5 Mon Sep 17 00:00:00 2001 From: "Grabovskaya, Ekaterina" Date: Thu, 11 Jul 2024 02:57:22 -0700 Subject: [PATCH] added -fsycl -fsycl-device-code-split=per_kernel at the linking stage to have device code --- examples/rng/device/CMakeLists.txt | 4 ++++ tests/unit_tests/rng/device/moments/CMakeLists.txt | 10 +++++++--- tests/unit_tests/rng/device/service/CMakeLists.txt | 10 +++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/examples/rng/device/CMakeLists.txt b/examples/rng/device/CMakeLists.txt index b72f51085..1b6ecf2dd 100644 --- a/examples/rng/device/CMakeLists.txt +++ b/examples/rng/device/CMakeLists.txt @@ -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}) diff --git a/tests/unit_tests/rng/device/moments/CMakeLists.txt b/tests/unit_tests/rng/device/moments/CMakeLists.txt index 11f796fef..2da8033bf 100644 --- a/tests/unit_tests/rng/device/moments/CMakeLists.txt +++ b/tests/unit_tests/rng/device/moments/CMakeLists.txt @@ -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 @@ -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() diff --git a/tests/unit_tests/rng/device/service/CMakeLists.txt b/tests/unit_tests/rng/device/service/CMakeLists.txt index a481f2559..03d960e1a 100644 --- a/tests/unit_tests/rng/device/service/CMakeLists.txt +++ b/tests/unit_tests/rng/device/service/CMakeLists.txt @@ -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 @@ -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()