Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
78 changes: 0 additions & 78 deletions .github/workflows/Windows-IntelLLVM_3.26.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# THE POSSIBILITY OF SUCH DAMAGE.
# *****************************************************************************

cmake_minimum_required(VERSION 3.21...3.27 FATAL_ERROR)
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
Comment thread
antonwolfy marked this conversation as resolved.

project(
dpnp
Expand Down
14 changes: 0 additions & 14 deletions conda-recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,6 @@ FOR %%V IN (17.0.0 17 18.0.0 18 19.0.0 19 20.0.0 20 21.0.0 21 22.0.0 22) DO @(
)
)

set "PATCHED_CMAKE_VERSION=3.26"
set "PLATFORM_DIR=%PREFIX%\Library\share\cmake-%PATCHED_CMAKE_VERSION%\Modules\Platform"
set "FN=Windows-IntelLLVM.cmake"

rem Save the original file, and copy patched file to
rem fix the issue with IntelLLVM integration with cmake on Windows
if EXIST "%PLATFORM_DIR%" (
dir "%PLATFORM_DIR%\%FN%"
copy /Y "%PLATFORM_DIR%\%FN%" .
if errorlevel 1 exit 1
copy /Y ".github\workflows\Windows-IntelLLVM_%PATCHED_CMAKE_VERSION%.cmake" "%PLATFORM_DIR%\%FN%"
if errorlevel 1 exit 1
)

set "CC=icx"
set "CXX=icx"

Expand Down
75 changes: 75 additions & 0 deletions dpnp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,81 @@ function(build_dpnp_cython_ext_with_backend _trgt _src _dest)
target_link_libraries(${_trgt} PRIVATE dpnp_backend_library)
endfunction()

# Builds a pybind11 extension of dpnp/backend/extensions with the options all of
# them share. INCLUDE_DIRS come before the common include directories, and
# LARGE_RANGES is for modules whose kernels can be launched over more than
# INT_MAX work-items.
function(build_dpnp_pybind11_ext _trgt _dest)
cmake_parse_arguments(PARSE_ARGV 2 _arg "LARGE_RANGES" "" "SOURCES;INCLUDE_DIRS")

pybind11_add_module(${_trgt} MODULE ${_arg_SOURCES})
add_sycl_to_target(TARGET ${_trgt} SOURCES ${_arg_SOURCES})

# Ensure Cython modules build first so _usmarray.h exists
add_dependencies(${_trgt} _usmarray)

if(_dpnp_sycl_targets)
# make fat binary
target_compile_options(${_trgt} PRIVATE ${_dpnp_sycl_target_compile_options})
target_link_options(${_trgt} PRIVATE ${_dpnp_sycl_target_link_options})
endif()

set_target_properties(${_trgt} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON)

target_include_directories(
${_trgt}
PRIVATE
${_arg_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/dpnp/include
${CMAKE_SOURCE_DIR}/dpnp/tensor/libtensor/include
)

# treat below headers as system to suppress the warnings there during the build
target_include_directories(
${_trgt}
SYSTEM
PRIVATE
${SYCL_INCLUDE_DIR}
${Dpctl_INCLUDE_DIRS}
${CMAKE_BINARY_DIR} # For generated Cython headers
)

if(WIN32)
target_compile_options(
${_trgt}
PRIVATE /clang:-fno-approx-func /clang:-fno-finite-math-only
)
else()
target_compile_options(${_trgt} PRIVATE -fno-approx-func -fno-finite-math-only)
endif()

if(_arg_LARGE_RANGES)
target_compile_options(${_trgt} PUBLIC -fno-sycl-id-queries-fit-in-int)
endif()

target_link_options(${_trgt} PUBLIC -fsycl-device-code-split=per_kernel)
if(_arg_LARGE_RANGES)
# DPC++ 2026.2 records the ID range at link time, so pass it there too
target_link_options(${_trgt} PUBLIC -fno-sycl-id-queries-fit-in-int)
endif()

if(DPNP_GENERATE_COVERAGE)
target_link_options(
${_trgt}
PRIVATE -fprofile-instr-generate -fcoverage-mapping
)
endif()

if(DPNP_WITH_REDIST)
set_target_properties(
${_trgt}
PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../"
)
endif()

install(TARGETS ${_trgt} DESTINATION ${_dest})
endfunction()

add_subdirectory(tensor)

add_subdirectory(backend)
Expand Down
15 changes: 1 addition & 14 deletions dpnp/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ set(DPNP_SRC

set(_trgt "dpnp_backend_c")

if(WIN32)
if(${CMAKE_VERSION} VERSION_LESS "3.27")
# this is a work-around for target_link_options inserting option after -link option, cause
# linker to ignore it.
set(CMAKE_CXX_LINK_FLAGS
"${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel"
)
endif()
endif()

add_library(${_trgt} SHARED ${DPNP_SRC})
set_target_properties(${_trgt} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand Down Expand Up @@ -111,10 +101,7 @@ target_include_directories(
target_link_libraries(dpnp_backend_library INTERFACE ${_trgt})

if(DPNP_WITH_REDIST)
set_target_properties(
${python_module_name}
PROPERTIES INSTALL_RPATH "$ORIGIN/../../../"
)
set_target_properties(${_trgt} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../")
endif()

if(DPNP_BACKEND_TESTS)
Expand Down
84 changes: 5 additions & 79 deletions dpnp/backend/extensions/blas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,79 +36,14 @@ set(_module_src
${CMAKE_CURRENT_SOURCE_DIR}/syrk.cpp
)

pybind11_add_module(${python_module_name} MODULE ${_module_src})
add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_module_src})

# Ensure Cython modules build first so _usmarray.h exists
add_dependencies(${python_module_name} _usmarray)

if(_dpnp_sycl_targets)
# make fat binary
target_compile_options(
${python_module_name}
PRIVATE ${_dpnp_sycl_target_compile_options}
)
target_link_options(${python_module_name} PRIVATE ${_dpnp_sycl_target_link_options})
endif()

if(WIN32)
if(${CMAKE_VERSION} VERSION_LESS "3.27")
# this is a work-around for target_link_options inserting option after -link option, cause
# linker to ignore it.
set(CMAKE_CXX_LINK_FLAGS
"${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel"
)
endif()
endif()

set_target_properties(
${python_module_name}
PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON
)

target_include_directories(
${python_module_name}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../common
${CMAKE_SOURCE_DIR}/dpnp/include
${CMAKE_SOURCE_DIR}/dpnp/tensor/libtensor/include
)

# treat below headers as system to suppress the warnings there during the build
target_include_directories(
${python_module_name}
SYSTEM
PRIVATE
${SYCL_INCLUDE_DIR}
${Dpctl_INCLUDE_DIRS}
${CMAKE_BINARY_DIR} # For generated Cython headers
)

if(WIN32)
target_compile_options(
${python_module_name}
PRIVATE /clang:-fno-approx-func /clang:-fno-finite-math-only
)
else()
target_compile_options(
${python_module_name}
PRIVATE -fno-approx-func -fno-finite-math-only
)
endif()

target_compile_options(${python_module_name} PUBLIC -fno-sycl-id-queries-fit-in-int)
target_link_options(
build_dpnp_pybind11_ext(
${python_module_name}
PUBLIC -fsycl-device-code-split=per_kernel -fno-sycl-id-queries-fit-in-int
"dpnp/backend/extensions/blas"
SOURCES ${_module_src}
INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../common
LARGE_RANGES
)

if(DPNP_GENERATE_COVERAGE)
target_link_options(
${python_module_name}
PRIVATE -fprofile-instr-generate -fcoverage-mapping
)
endif()

if(_use_onemath)
target_link_libraries(${python_module_name} PRIVATE ${ONEMATH_LIB})
target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMATH)
Expand All @@ -118,12 +53,3 @@ if(_use_onemath)
else()
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::BLAS)
endif()

if(DPNP_WITH_REDIST)
set_target_properties(
${python_module_name}
PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../"
)
endif()

install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/blas")
Loading
Loading