Skip to content

Commit 9af8376

Browse files
authored
[SYCLomatic][CMake] Support migrated CUDA-related libraries without prefix "CUDA::" used in target_link_libraries (#2223)
Signed-off-by: chenwei.sun <[email protected]>
1 parent 6fcfc16 commit 9af8376

File tree

4 files changed

+99
-2
lines changed

4 files changed

+99
-2
lines changed

clang/test/dpct/cmake_migration/case_004/expected.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ target_link_libraries(nlm_cuda ${OpenCV_LIBS} stdc++ stdc++fs)
2020
target_link_libraries(cublas-cudnn-test ${MKL_LIB} ${DNN_LIB})
2121

2222
target_link_libraries(tsne ${MKL_LIB} ${MKL_LIB} ${MKL_LIB})
23+
24+
target_link_libraries(mdgx ${MKL_LIB} ${MKL_LIB} ${MKL_LIB} -lccl )

clang/test/dpct/cmake_migration/case_004/input.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ target_link_libraries(nlm_cuda ${OpenCV_LIBS} stdc++ stdc++fs)
2323
target_link_libraries(cublas-cudnn-test cublas cudnn)
2424

2525
target_link_libraries(tsne ${CUDA_CUBLAS_LIBRARIES} ${CUDA_CUFFT_LIBRARIES} ${CUDA_cusparse_LIBRARY})
26+
27+
target_link_libraries(mdgx cufft cusparse curand cudadevrt nccl nvrtc nvidia-ml)

clang/test/dpct/cmake_migration/case_032/expected.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ set(LIBS ${LIBS}
8787

8888
)
8989

90-
target_link_libraries(${target}
91-
${MKL_LIB}
90+
target_link_libraries(${target} ${MKL_LIB}
9291

9392

9493
${MKL_LIB}

clang/tools/dpct/DpctOptRules/cmake_script_migration_rule.yaml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,100 @@
11721172
\${MKL_LIB}
11731173
RuleId: "replace_cufft_with_MKL"
11741174

1175+
- Rule: rule_cufft_without_cuda_prefix
1176+
Kind: CMakeRule
1177+
Priority: Fallback
1178+
MatchMode: Partial
1179+
CmakeSyntax: cufft_without_cuda_prefix
1180+
In: target_link_libraries${empty}(${target} ${libs})
1181+
Out: target_link_libraries(${target} ${libs})
1182+
Subrules:
1183+
libs:
1184+
MatchMode: Full
1185+
In: cufft
1186+
Out: |
1187+
\${MKL_LIB}
1188+
1189+
- Rule: rule_cusparse_without_cuda_prefix
1190+
Kind: CMakeRule
1191+
Priority: Fallback
1192+
MatchMode: Partial
1193+
CmakeSyntax: cusparse_without_cuda_prefix
1194+
In: target_link_libraries${empty}(${target} ${libs})
1195+
Out: target_link_libraries(${target} ${libs})
1196+
Subrules:
1197+
libs:
1198+
MatchMode: Full
1199+
In: cusparse
1200+
Out: |
1201+
\${MKL_LIB}
1202+
1203+
- Rule: rule_curand_without_cuda_prefix
1204+
Kind: CMakeRule
1205+
Priority: Fallback
1206+
MatchMode: Partial
1207+
CmakeSyntax: curand_without_cuda_prefix
1208+
In: target_link_libraries${empty}(${target} ${libs})
1209+
Out: target_link_libraries(${target} ${libs})
1210+
Subrules:
1211+
libs:
1212+
MatchMode: Full
1213+
In: curand
1214+
Out: |
1215+
\${MKL_LIB}
1216+
1217+
- Rule: rule_cudadevrt_without_cuda_prefix
1218+
Kind: CMakeRule
1219+
Priority: Fallback
1220+
MatchMode: Partial
1221+
CmakeSyntax: cudadevrt_without_cuda_prefix
1222+
In: target_link_libraries${empty}(${target} ${libs})
1223+
Out: target_link_libraries(${target} ${libs})
1224+
Subrules:
1225+
libs:
1226+
MatchMode: Full
1227+
In: cudadevrt
1228+
Out: ""
1229+
1230+
- Rule: rule_nccl_without_cuda_prefix
1231+
Kind: CMakeRule
1232+
Priority: Fallback
1233+
MatchMode: Partial
1234+
CmakeSyntax: nccl_without_cuda_prefix
1235+
In: target_link_libraries${empty}(${target} ${libs})
1236+
Out: target_link_libraries(${target} ${libs})
1237+
Subrules:
1238+
libs:
1239+
MatchMode: Full
1240+
In: nccl
1241+
Out: -lccl
1242+
1243+
- Rule: rule_nvrtc_without_cuda_prefix
1244+
Kind: CMakeRule
1245+
Priority: Fallback
1246+
MatchMode: Partial
1247+
CmakeSyntax: nvrtc_without_cuda_prefix
1248+
In: target_link_libraries${empty}(${target} ${libs})
1249+
Out: target_link_libraries(${target} ${libs})
1250+
Subrules:
1251+
libs:
1252+
MatchMode: Full
1253+
In: nvrtc
1254+
Out: ""
1255+
1256+
- Rule: rule_ml_without_cuda_prefix
1257+
Kind: CMakeRule
1258+
Priority: Fallback
1259+
MatchMode: Partial
1260+
CmakeSyntax: ml_without_cuda_prefix
1261+
In: target_link_libraries${empty}(${target} ${libs})
1262+
Out: target_link_libraries(${target} ${libs})
1263+
Subrules:
1264+
libs:
1265+
MatchMode: Full
1266+
In: nvidia-ml
1267+
Out: ""
1268+
11751269
- Rule: rule_cufftw
11761270
Kind: CMakeRule
11771271
Priority: Fallback

0 commit comments

Comments
 (0)