Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ option(ENABLE_CUSPARSE_BACKEND "Enable the cuSPARSE backend for the SPARSE_BLAS
option(ENABLE_ROCSPARSE_BACKEND "Enable the rocSPARSE backend for the SPARSE_BLAS interface" OFF)

set(ONEMATH_SYCL_IMPLEMENTATION "dpc++" CACHE STRING "Name of the SYCL compiler")
set(CUDA_TARGETS "" CACHE STRING "Target CUDA architectures")
set(HIP_TARGETS "" CACHE STRING "Target HIP architectures")

## Testing
Expand Down
18 changes: 15 additions & 3 deletions src/blas/backends/cublas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,24 @@ target_include_directories(${LIB_OBJ}
)
target_compile_options(${LIB_OBJ} PRIVATE ${ONEMATH_BUILD_COPT})

if(NOT ${ONEMATH_SYCL_IMPLEMENTATION} STREQUAL "adaptivecpp")
if (NOT "${ONEMATH_SYCL_IMPLEMENTATION}" STREQUAL "adaptivecpp")
target_compile_options(ONEMATH::SYCL::SYCL INTERFACE
-fsycl-targets=nvptx64-nvidia-cuda -fsycl-unnamed-lambda
)
target_link_options(ONEMATH::SYCL::SYCL INTERFACE
-fsycl-targets=nvptx64-nvidia-cuda
)

if (DEFINED CUDA_TARGETS AND NOT "${CUDA_TARGETS}" STREQUAL "")
target_compile_options(ONEMATH::SYCL::SYCL INTERFACE
-fsycl-targets=nvptx64-nvidia-cuda -fsycl-unnamed-lambda)
-Xsycl-target-backend --cuda-gpu-arch=${CUDA_TARGETS}
)
target_link_options(ONEMATH::SYCL::SYCL INTERFACE
-fsycl-targets=nvptx64-nvidia-cuda)
-Xsycl-target-backend --cuda-gpu-arch=${CUDA_TARGETS}
)
endif()
endif()

target_link_libraries(${LIB_OBJ} PUBLIC ONEMATH::SYCL::SYCL ONEMATH::cuBLAS::cuBLAS)
target_compile_features(${LIB_OBJ} PUBLIC cxx_std_11)
set_target_properties(${LIB_OBJ} PROPERTIES
Expand Down
6 changes: 3 additions & 3 deletions src/blas/backends/generic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ if(GENERIC_BLAS_TUNING_TARGET)
-fsycl-targets=nvptx64-nvidia-cuda -fsycl-unnamed-lambda)
target_link_options(ONEMATH::SYCL::SYCL INTERFACE
-fsycl-targets=nvptx64-nvidia-cuda)
if(DEFINED CUDA_TARGET)
if(DEFINED CUDA_TARGETS)
target_compile_options(ONEMATH::SYCL::SYCL INTERFACE
-Xsycl-target-backend --cuda-gpu-arch=${CUDA_TARGET})
-Xsycl-target-backend --cuda-gpu-arch=${CUDA_TARGETS})
target_link_options(ONEMATH::SYCL::SYCL INTERFACE
-Xsycl-target-backend --cuda-gpu-arch=${CUDA_TARGET})
-Xsycl-target-backend --cuda-gpu-arch=${CUDA_TARGETS})
endif()
else()
message(WARNING "Compiler is not supported."
Expand Down
18 changes: 18 additions & 0 deletions src/sparse_blas/backends/cusparse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ target_include_directories(${LIB_OBJ}

target_compile_options(${LIB_OBJ} PRIVATE ${ONEMATH_BUILD_COPT})

if (NOT "${ONEMATH_SYCL_IMPLEMENTATION}" STREQUAL "adaptivecpp")
target_compile_options(ONEMATH::SYCL::SYCL INTERFACE
-fsycl-targets=nvptx64-nvidia-cuda -fsycl-unnamed-lambda
)
target_link_options(ONEMATH::SYCL::SYCL INTERFACE
-fsycl-targets=nvptx64-nvidia-cuda
)

if (DEFINED CUDA_TARGETS AND NOT "${CUDA_TARGETS}" STREQUAL "")
target_compile_options(ONEMATH::SYCL::SYCL INTERFACE
-Xsycl-target-backend --cuda-gpu-arch=${CUDA_TARGETS}
)
target_link_options(ONEMATH::SYCL::SYCL INTERFACE
-Xsycl-target-backend --cuda-gpu-arch=${CUDA_TARGETS}
)
endif()
endif()

Comment on lines +46 to +63

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine, it is same update as for BLAS, for CUDA + SYCL linking, so no reason to object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, was just adding it for consistency between the domains. Having a way to add AoT support too and to avoid issues with newer CUDA versions
Context: CUDA 13 dropped support for several older NVIDIA GPU architectures, specifically Maxwell (compute capability 5.x), Pascal (compute capability 6.x), and Volta (compute capability 7.0, 7.2) architectures.

if (${CMAKE_VERSION} VERSION_LESS "3.17.0")
find_package(CUDA 12.2 REQUIRED)
target_include_directories(${LIB_OBJ} PRIVATE ${CUDA_INCLUDE_DIRS})
Expand Down
Loading