File tree Expand file tree Collapse file tree 6 files changed +74
-43
lines changed Expand file tree Collapse file tree 6 files changed +74
-43
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,30 @@ option(DPCTL_GENERATE_COVERAGE
17
17
"Build dpctl with coverage instrumentation"
18
18
OFF
19
19
)
20
+ option (DPCTL_TARGET_CUDA
21
+ "Build DPCTL to target CUDA devices"
22
+ OFF
23
+ )
20
24
21
25
find_package (IntelSYCL REQUIRED PATHS ${CMAKE_SOURCE_DIR} /cmake NO_DEFAULT_PATH )
22
26
27
+ set (_dpctl_sycl_targets )
28
+ if ("x${DPCTL_SYCL_TARGETS} " STREQUAL "x" )
29
+ if (DPCTL_TARGET_CUDA )
30
+ set (_dpctl_sycl_targets "nvptx64-nvidia-cuda,spir64-unknown-unknown" )
31
+ else ()
32
+ if (DEFINED ENV{DPCTL_TARGET_CUDA} )
33
+ set (_dpctl_sycl_targets "nvptx64-nvidia-cuda,spir64-unknown-unknown" )
34
+ endif ()
35
+ endif ()
36
+ else ()
37
+ set (_dpctl_sycl_targets ${DPCTL_SYCL_TARGETS} )
38
+ endif ()
39
+
40
+ if (_dpctl_sycl_targets )
41
+ message (STATUS "Compiling for -fsycl-targets=${_dpctl_sycl_targets} " )
42
+ endif ()
43
+
23
44
add_subdirectory (libsyclinterface )
24
45
25
46
file (GLOB _dpctl_capi_headers dpctl/apis/include/*.h* )
Original file line number Diff line number Diff line change @@ -144,17 +144,19 @@ function(build_dpctl_ext _trgt _src _dest)
144
144
Python_add_library (${_trgt} MODULE WITH_SOABI ${_generated_src} )
145
145
if (BUILD_DPCTL_EXT_SYCL )
146
146
add_sycl_to_target (TARGET ${_trgt} SOURCES ${_generated_src} )
147
- # make fat binary
148
- target_compile_options (
149
- ${_trgt}
150
- PRIVATE
151
- -fsycl-targets=nvptx64-nvidia-cuda,spir64-unknown-unknown
152
- )
153
- target_link_options (
154
- ${_trgt}
155
- PRIVATE
156
- -fsycl-targets=nvptx64-nvidia-cuda,spir64-unknown-unknown
157
- )
147
+ if (_dpctl_sycl_targets )
148
+ # make fat binary
149
+ target_compile_options (
150
+ ${_trgt}
151
+ PRIVATE
152
+ -fsycl-targets=${_dpctl_sycl_targets}
153
+ )
154
+ target_link_options (
155
+ ${_trgt}
156
+ PRIVATE
157
+ -fsycl-targets=${_dpctl_sycl_targets}
158
+ )
159
+ endif ()
158
160
endif ()
159
161
target_include_directories (${_trgt} PRIVATE ${NumPy_INCLUDE_DIR} ${DPCTL_INCLUDE_DIR} )
160
162
add_dependencies (${_trgt} _build_time_create_dpctl_include_copy ${_cythonize_trgt} )
Original file line number Diff line number Diff line change @@ -141,17 +141,19 @@ list(APPEND _tensor_impl_sources
141
141
set (python_module_name _tensor_impl )
142
142
pybind11_add_module (${python_module_name} MODULE ${_tensor_impl_sources} )
143
143
add_sycl_to_target (TARGET ${python_module_name} SOURCES ${_tensor_impl_sources} )
144
- # make fat binary
145
- target_compile_options (
146
- ${python_module_name}
147
- PRIVATE
148
- -fsycl-targets=nvptx64-nvidia-cuda,spir64-unknown-unknown
149
- )
150
- target_link_options (
151
- ${python_module_name}
152
- PRIVATE
153
- -fsycl-targets=nvptx64-nvidia-cuda,spir64-unknown-unknown
154
- )
144
+ if (_dpctl_sycl_targets )
145
+ # make fat binary
146
+ target_compile_options (
147
+ ${python_module_name}
148
+ PRIVATE
149
+ -fsycl-targets=${_dpctl_sycl_targets}
150
+ )
151
+ target_link_options (
152
+ ${python_module_name}
153
+ PRIVATE
154
+ -fsycl-targets=${_dpctl_sycl_targets}
155
+ )
156
+ endif ()
155
157
156
158
set (_clang_prefix "" )
157
159
if (WIN32 )
Original file line number Diff line number Diff line change @@ -21,17 +21,19 @@ pybind11_add_module(${python_module_name} MODULE
21
21
${_module_src}
22
22
)
23
23
add_sycl_to_target (TARGET ${python_module_name} SOURCES ${_module_src} )
24
- # make fat binary
25
- target_compile_options (
26
- ${python_module_name}
27
- PRIVATE
28
- -fsycl-targets=nvptx64-nvidia-cuda,spir64-unknown-unknown
29
- )
30
- target_link_options (
31
- ${python_module_name}
32
- PRIVATE
33
- -fsycl-targets=nvptx64-nvidia-cuda,spir64-unknown-unknown
34
- )
24
+ if (_dpctl_sycl_targets )
25
+ # make fat binary
26
+ target_compile_options (
27
+ ${python_module_name}
28
+ PRIVATE
29
+ -fsycl-targets=${_dpctl_sycl_targets}
30
+ )
31
+ target_link_options (
32
+ ${python_module_name}
33
+ PRIVATE
34
+ -fsycl-targets=${_dpctl_sycl_targets}
35
+ )
36
+ endif ()
35
37
target_include_directories (${python_module_name}
36
38
PRIVATE
37
39
${CMAKE_CURRENT_SOURCE_DIR} /../include
Original file line number Diff line number Diff line change @@ -206,16 +206,18 @@ add_library(DPCTLSyclInterface
206
206
)
207
207
add_sycl_to_target (TARGET DPCTLSyclInterface SOURCES ${sources} ${helper_sources} )
208
208
# make fat binary
209
- target_compile_options (
210
- DPCTLSyclInterface
211
- PRIVATE
212
- -fsycl-targets=nvptx64-nvidia-cuda,spir64-unknown-unknown
213
- )
214
- target_link_options (
215
- DPCTLSyclInterface
216
- PRIVATE
217
- -fsycl-targets=nvptx64-nvidia-cuda,spir64-unknown-unknown
218
- )
209
+ if (_dpctl_sycl_targets )
210
+ target_compile_options (
211
+ DPCTLSyclInterface
212
+ PRIVATE
213
+ -fsycl-targets=${_dpctl_sycl_targets}
214
+ )
215
+ target_link_options (
216
+ DPCTLSyclInterface
217
+ PRIVATE
218
+ -fsycl-targets=${_dpctl_sycl_targets}
219
+ )
220
+ endif ()
219
221
220
222
if (DPCTL_GENERATE_COVERAGE )
221
223
target_link_options (DPCTLSyclInterface
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ add_sycl_to_target(
52
52
${CMAKE_CURRENT_SOURCE_DIR} /test_sycl_queue_interface.cpp
53
53
${CMAKE_CURRENT_SOURCE_DIR} /test_sycl_usm_interface.cpp
54
54
)
55
+ if (_dpctl_sycl_targets )
55
56
# make fat binary
56
57
target_compile_options (
57
58
dpctl_c_api_tests
@@ -63,6 +64,7 @@ target_link_options(
63
64
PRIVATE
64
65
-fsycl-targets=nvptx64-nvidia-cuda,spir64-unknown-unknown
65
66
)
67
+ endif ()
66
68
67
69
if (DPCTL_GENERATE_COVERAGE )
68
70
target_include_directories (dpctl_c_api_tests
You can’t perform that action at this time.
0 commit comments