Skip to content

Commit 3e591f7

Browse files
Update CMake files
1 parent 862a800 commit 3e591f7

4 files changed

Lines changed: 33 additions & 22 deletions

File tree

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,23 @@ project(
3737
)
3838

3939
option(DPNP_GENERATE_COVERAGE "Enable build DPNP with coverage instrumentation" OFF)
40+
option(
41+
DPNP_TENSOR_GENERATE_COVERAGE_FOR_PYBIND11_EXTENSIONS
42+
"Build dpnp tensor pybind11 offloading extensions with coverage instrumentation"
43+
OFF
44+
)
4045
option(DPNP_BACKEND_TESTS "Enable building of DPNP backend test suite" OFF)
4146
option(
4247
DPNP_WITH_REDIST
4348
"Build DPNP assuming DPC++ redistributable is installed into Python prefix"
4449
OFF
4550
)
51+
option(
52+
DPNP_TENSOR_OFFLOAD_COMPRESS
53+
"Build using offload section compression feature of DPC++ to reduce \
54+
size of shared object with offloading sections"
55+
OFF
56+
)
4657

4758
set(CMAKE_CXX_STANDARD 17)
4859
set(CMAKE_CXX_STANDARD_REQUIRED True)
@@ -352,7 +363,7 @@ endif()
352363
add_library(DpnpTensorCAPI INTERFACE)
353364
target_include_directories(
354365
DpnpTensorCAPI
355-
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/dpnp/include ${CMAKE_BINARY_DIR}/dpnp/tensor
366+
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/dpnp/include
356367
)
357368

358369
add_subdirectory(dpnp)

dpnp/CMakeLists.txt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,32 +86,32 @@ function(build_dpnp_cython_ext _trgt _src _dest)
8686
install(TARGETS ${_trgt} LIBRARY DESTINATION ${_dest})
8787
endfunction()
8888

89-
function(build_dpctl_ext _trgt _src _dest)
89+
function(build_dpnp_tensor_ext _trgt _src _dest)
9090
set(options SYCL)
91-
cmake_parse_arguments(BUILD_DPCTL_EXT "${options}" "RELATIVE_PATH" "" ${ARGN})
91+
cmake_parse_arguments(BUILD_DPNP_TENSOR "${options}" "RELATIVE_PATH" "" ${ARGN})
9292
add_cython_target(${_trgt} ${_src} CXX OUTPUT_VAR _generated_src)
9393
set(_cythonize_trgt "${_trgt}_cythonize_pyx")
9494
python_add_library(${_trgt} MODULE WITH_SOABI ${_generated_src})
95-
if(BUILD_DPCTL_EXT_SYCL)
95+
if(BUILD_DPNP_SYCL)
9696
add_sycl_to_target(TARGET ${_trgt} SOURCES ${_generated_src})
9797
target_compile_options(${_trgt} PRIVATE -fno-sycl-id-queries-fit-in-int)
9898
target_link_options(${_trgt} PRIVATE -fsycl-device-code-split=per_kernel)
99-
if(DPCTL_OFFLOAD_COMPRESS)
99+
if(DPNP_TENSOR_OFFLOAD_COMPRESS)
100100
target_link_options(${_trgt} PRIVATE --offload-compress)
101101
endif()
102-
if(_dpctl_sycl_targets)
102+
if(_dpnp_sycl_targets)
103103
# make fat binary
104104
target_compile_options(
105105
${_trgt}
106-
PRIVATE ${_dpctl_sycl_target_compile_options}
106+
PRIVATE ${_dpnp_sycl_target_compile_options}
107107
)
108-
target_link_options(${_trgt} PRIVATE ${_dpctl_sycl_target_link_options})
108+
target_link_options(${_trgt} PRIVATE ${_dpnp_sycl_target_link_options})
109109
endif()
110110
endif()
111111
target_link_libraries(${_trgt} PRIVATE Python::NumPy)
112-
if(DPCTL_GENERATE_COVERAGE)
112+
if(DPNP_GENERATE_COVERAGE)
113113
target_compile_definitions(${_trgt} PRIVATE CYTHON_TRACE=1 CYTHON_TRACE_NOGIL=1)
114-
if(BUILD_DPCTL_EXT_SYCL)
114+
if(BUILD_DPNP_TENSOR_SYCL)
115115
target_compile_options(${_trgt} PRIVATE -fno-sycl-use-footer)
116116
endif()
117117
endif()
@@ -129,16 +129,16 @@ function(build_dpctl_ext _trgt _src _dest)
129129
# TODO: create separate folder inside build folder that contains only
130130
# headers related to this target and appropriate folder structure to
131131
# eliminate shadow dependencies
132-
# Go up two levels to build root for "dpctl_ext/tensor/_usmarray.h" resolution
132+
# Go up two levels to build root for "dpnp/tensor/_usmarray.h" resolution
133133
get_filename_component(_parent_dir ${_generated_src_dir} DIRECTORY)
134134
get_filename_component(_build_root ${_parent_dir} DIRECTORY)
135135
# TODO: do not set directory if we did not generate header
136136
target_include_directories(${_trgt} INTERFACE ${_build_root})
137137
set(_rpath_value "$ORIGIN")
138-
if(BUILD_DPCTL_EXT_RELATIVE_PATH)
139-
set(_rpath_value "${_rpath_value}/${BUILD_DPCTL_EXT_RELATIVE_PATH}")
138+
if(BUILD_DPNP_TENSOR_RELATIVE_PATH)
139+
set(_rpath_value "${_rpath_value}/${BUILD_DPNP_TENSOR_RELATIVE_PATH}")
140140
endif()
141-
if(DPCTL_WITH_REDIST)
141+
if(DPNP_WITH_REDIST)
142142
set(_rpath_value "${_rpath_value}:${_rpath_value}/../../..")
143143
endif()
144144
set_target_properties(${_trgt} PROPERTIES INSTALL_RPATH ${_rpath_value})
@@ -154,7 +154,7 @@ function(build_dpctl_ext _trgt _src _dest)
154154
DESTINATION ${CMAKE_INSTALL_PREFIX}/dpnp/include/${_dest}
155155
OPTIONAL
156156
)
157-
if(DPCTL_GENERATE_COVERAGE)
157+
if(DPNP_GENERATE_COVERAGE)
158158
get_filename_component(_original_src_dir ${_src} DIRECTORY)
159159
file(RELATIVE_PATH _rel_dir ${CMAKE_SOURCE_DIR} ${_original_src_dir})
160160
install(FILES ${_generated_src} DESTINATION ${CMAKE_INSTALL_PREFIX}/${_rel_dir})
@@ -183,6 +183,7 @@ install(
183183
)
184184

185185
add_subdirectory(tensor)
186+
186187
add_subdirectory(backend)
187188
add_subdirectory(backend/extensions/blas)
188189
add_subdirectory(backend/extensions/fft)

dpnp/include/dpnp_tensor_capi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
//===---------------------------------------------------------------------===//
3030
///
3131
/// \file
32-
/// This file provides access to dpctl_ext's C-API, including:
32+
/// This file provides access to dpnp tensor's C-API, including:
3333
/// - dpctl C-API (from external dpctl package - SYCL interface)
3434
/// - dpnp tensor C-API (usm_ndarray)
3535
//===---------------------------------------------------------------------===//

dpnp/tensor/CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
find_package(Python COMPONENTS Development.Module)
3131

32-
# Tensor-specific debug flags (preserved from dpctl_ext)
32+
# Tensor-specific debug flags
3333
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "DEBUG")
3434
if(WIN32)
3535
add_compile_options(-Xsycl-target-frontend=spir64 "-g0")
@@ -45,7 +45,7 @@ add_compile_options(-Wno-unused-parameter)
4545
file(GLOB _cython_sources *.pyx)
4646
foreach(_cy_file ${_cython_sources})
4747
get_filename_component(_trgt ${_cy_file} NAME_WLE)
48-
build_dpctl_ext(${_trgt} ${_cy_file} "dpnp/tensor" RELATIVE_PATH "..")
48+
build_dpnp_tensor_ext(${_trgt} ${_cy_file} "dpnp/tensor" RELATIVE_PATH "..")
4949
target_include_directories(${_trgt} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
5050
target_link_libraries(DpnpTensorCAPI INTERFACE ${_trgt}_headers)
5151
endforeach()
@@ -318,8 +318,7 @@ foreach(python_module_name ${_py_trgts})
318318
${python_module_name}
319319
PRIVATE -fsycl-device-code-split=per_kernel
320320
)
321-
# TODO: expand DPCTL_OFFLOAD_COMPRESS to the whole dpnp level
322-
if(DPCTL_OFFLOAD_COMPRESS)
321+
if(DPNP_TENSOR_OFFLOAD_COMPRESS)
323322
target_link_options(${python_module_name} PRIVATE --offload-compress)
324323
endif()
325324

@@ -332,8 +331,8 @@ foreach(python_module_name ${_py_trgts})
332331
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/
333332
)
334333
target_link_options(${python_module_name} PRIVATE ${_linker_options})
335-
if(DPCTL_GENERATE_COVERAGE)
336-
if(DPCTL_GENERATE_COVERAGE_FOR_PYBIND11_EXTENSIONS)
334+
if(DPNP_GENERATE_COVERAGE)
335+
if(DPNP_TENSOR_GENERATE_COVERAGE_FOR_PYBIND11_EXTENSIONS)
337336
target_compile_options(
338337
${python_module_name}
339338
PRIVATE -fprofile-instr-generate -fcoverage-mapping

0 commit comments

Comments
 (0)