Skip to content

Lit tests for cuda_add_cufft_to_target #1508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 4 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
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 @@ -508,6 +508,7 @@
Out: ""
MatchMode: Full
RuleId: "remove_-static-libstdc++"

- Rule: rule_cuda_compile_fatbin
Kind: CMakeRule
Priority: Fallback
Expand All @@ -527,3 +528,11 @@
CmakeSyntax: cuda_compile_fatbin_opts
In: dpct_helper_compile_sycl_code(${value} OPTIONS ${options})
Out: dpct_helper_compile_sycl_code(${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()