Skip to content

Commit

Permalink
[SYCLomatic] Support migration of cmake syntax cuda_add_cufft_to_targ…
Browse files Browse the repository at this point in the history
…et (#1508)
  • Loading branch information
TejaX-Alaghari authored Jan 10, 2024
1 parent ac19a51 commit 86472bf
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: rm -rf %T && mkdir -p %T
// RUN: cd %T
// RUN: cp %S/input.cmake ./input.cmake
// RUN: dpct -in-root ./ -out-root out ./input.cmake --migrate-cmake-script-only
// RUN: echo "begin" > %T/diff.txt
// RUN: diff --strip-trailing-cr %S/expected.txt %T/out/input.cmake >> %T/diff.txt
// RUN: echo "end" >> %T/diff.txt

// CHECK: begin
// CHECK-NEXT: end
4 changes: 4 additions & 0 deletions clang/test/dpct/cmake_migration/case_012/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dpct_helper_add_mkl_to_target(culib)
dpct_helper_add_mkl_to_target(
culib
)
4 changes: 4 additions & 0 deletions clang/test/dpct/cmake_migration/case_012/input.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CUDA_ADD_CUFFT_TO_TARGET(culib)
cuda_add_cufft_to_target(
culib
)
Original file line number Diff line number Diff line change
Expand Up @@ -539,3 +539,10 @@
In: cuda_include_directories(${value})
Out: include_directories(${value})

- Rule: rule_cuda_add_cufft_to_target
Kind: CMakeRule
Priority: Fallback
CmakeSyntax: cuda_add_cufft_to_target
In: cuda_add_cufft_to_target(${target})
Out: dpct_helper_add_mkl_to_target(${target})

13 changes: 13 additions & 0 deletions clang/tools/dpct/cmake/dpct.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,16 @@ if(WIN32)
else()
set(DNN_LIB "dnnl")
endif()

# Link MKL library to target
macro(DPCT_HELPER_ADD_MKL_TO_TARGET target)
if(WIN32)
target_compile_options(${target} PUBLIC -fsycl /DMKL_ILP64 /Qmkl:parallel /Qtbb /MD)
target_link_libraries(${target} PUBLIC -fsycl OpenCL.lib)
elseif(UNIX AND NOT APPLE)
target_compile_options(${target} PUBLIC -fsycl -DMKL_ILP64 -qmkl=parallel -qtbb)
target_link_libraries(${target} PUBLIC -qmkl=parallel -qtbb -fsycl)
else()
message(FATAL_ERROR "Unsupported platform")
endif()
endmacro()

0 comments on commit 86472bf

Please sign in to comment.