Skip to content

Commit 1992b6f

Browse files
Optimize tensor coverage build to match dpctl
1 parent bf0c6b1 commit 1992b6f

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

dpnp/tensor/CMakeLists.txt

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,29 @@
2929

3030
find_package(Python COMPONENTS Development.Module)
3131

32+
# Remove global coverage flags for tensor
33+
# use link-time only approach like dpctl
34+
if(DPNP_GENERATE_COVERAGE)
35+
string(REPLACE "-fprofile-instr-generate " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
36+
string(REPLACE "-fcoverage-mapping " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
37+
string(REPLACE "-fno-sycl-use-footer " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
38+
endif()
39+
3240
# Tensor-specific debug flags
33-
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "DEBUG")
41+
# Disable device code debug info for Debug and Coverage builds to speed up linking
42+
if(
43+
CMAKE_BUILD_TYPE STREQUAL "Debug"
44+
OR CMAKE_BUILD_TYPE STREQUAL "DEBUG"
45+
OR CMAKE_BUILD_TYPE STREQUAL "Coverage"
46+
)
3447
if(WIN32)
3548
add_compile_options(-Xsycl-target-frontend=spir64 "-g0")
3649
elseif(UNIX)
37-
string(REPLACE "-g1" "-g" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
38-
string(REPLACE "-g1" "-g" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
50+
add_compile_options(-Xsycl-target-frontend=spir64 "-g0")
51+
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "DEBUG")
52+
string(REPLACE "-g1" "-g" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
53+
string(REPLACE "-g1" "-g" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
54+
endif()
3955
endif()
4056
endif()
4157

@@ -313,18 +329,10 @@ foreach(python_module_name ${_py_trgts})
313329
${python_module_name}
314330
PRIVATE -fno-sycl-id-queries-fit-in-int
315331
)
316-
# For coverage builds, use per_source instead of per_kernel to reduce memory
317-
if(DPNP_GENERATE_COVERAGE)
318-
target_link_options(
319-
${python_module_name}
320-
PRIVATE -fsycl-device-code-split=per_source
321-
)
322-
else()
323-
target_link_options(
324-
${python_module_name}
325-
PRIVATE -fsycl-device-code-split=per_kernel
326-
)
327-
endif()
332+
target_link_options(
333+
${python_module_name}
334+
PRIVATE -fsycl-device-code-split=per_kernel
335+
)
328336
if(DPNP_TENSOR_OFFLOAD_COMPRESS)
329337
target_link_options(${python_module_name} PRIVATE --offload-compress)
330338
endif()

0 commit comments

Comments
 (0)