Skip to content

Commit 2badc2f

Browse files
committed
Merge branch 'master' into compare-shape
2 parents 209aaf8 + 77702b3 commit 2badc2f

34 files changed

+3650
-1494
lines changed

doc/reference/linalg.rst

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Matrix and vector products
2323
dpnp.outer
2424
dpnp.matmul
2525
dpnp.linalg.matmul (Array API compatible)
26+
dpnp.matvec
27+
dpnp.vecmat
2628
dpnp.tensordot
2729
dpnp.linalg.tensordot (Array API compatible)
2830
dpnp.einsum

dpnp/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ add_subdirectory(backend/extensions/lapack)
6262
add_subdirectory(backend/extensions/vm)
6363
add_subdirectory(backend/extensions/ufunc)
6464
add_subdirectory(backend/extensions/statistics)
65+
add_subdirectory(backend/extensions/indexing)
6566

6667
add_subdirectory(dpnp_algo)
6768
add_subdirectory(dpnp_utils)

dpnp/backend/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ set(DPNP_SRC
2727
kernels/dpnp_krnl_arraycreation.cpp
2828
kernels/dpnp_krnl_common.cpp
2929
kernels/dpnp_krnl_elemwise.cpp
30-
kernels/dpnp_krnl_indexing.cpp
3130
kernels/dpnp_krnl_mathematical.cpp
3231
kernels/dpnp_krnl_random.cpp
3332
kernels/dpnp_krnl_sorting.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# *****************************************************************************
2+
# Copyright (c) 2016-2024, Intel Corporation
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are met:
7+
# - Redistributions of source code must retain the above copyright notice,
8+
# this list of conditions and the following disclaimer.
9+
# - Redistributions in binary form must reproduce the above copyright notice,
10+
# this list of conditions and the following disclaimer in the documentation
11+
# and/or other materials provided with the distribution.
12+
#
13+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
17+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
# THE POSSIBILITY OF SUCH DAMAGE.
24+
# *****************************************************************************
25+
26+
27+
set(python_module_name _indexing_impl)
28+
set(_module_src
29+
${CMAKE_CURRENT_SOURCE_DIR}/choose.cpp
30+
${CMAKE_CURRENT_SOURCE_DIR}/indexing_py.cpp
31+
)
32+
33+
pybind11_add_module(${python_module_name} MODULE ${_module_src})
34+
add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_module_src})
35+
36+
if(_dpnp_sycl_targets)
37+
# make fat binary
38+
target_compile_options(
39+
${python_module_name}
40+
PRIVATE
41+
-fsycl-targets=${_dpnp_sycl_targets}
42+
)
43+
target_link_options(
44+
${python_module_name}
45+
PRIVATE
46+
-fsycl-targets=${_dpnp_sycl_targets}
47+
)
48+
endif()
49+
50+
if (WIN32)
51+
if (${CMAKE_VERSION} VERSION_LESS "3.27")
52+
# this is a work-around for target_link_options inserting option after -link option, cause
53+
# linker to ignore it.
54+
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel")
55+
endif()
56+
endif()
57+
58+
set_target_properties(${python_module_name} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON)
59+
60+
target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
61+
target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../src)
62+
63+
target_include_directories(${python_module_name} PUBLIC ${Dpctl_INCLUDE_DIR})
64+
target_include_directories(${python_module_name} PUBLIC ${Dpctl_TENSOR_INCLUDE_DIR})
65+
66+
if (WIN32)
67+
target_compile_options(${python_module_name} PRIVATE
68+
/clang:-fno-approx-func
69+
/clang:-fno-finite-math-only
70+
)
71+
else()
72+
target_compile_options(${python_module_name} PRIVATE
73+
-fno-approx-func
74+
-fno-finite-math-only
75+
)
76+
endif()
77+
78+
target_link_options(${python_module_name} PUBLIC -fsycl-device-code-split=per_kernel)
79+
80+
if (DPNP_GENERATE_COVERAGE)
81+
target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping)
82+
endif()
83+
84+
if (DPNP_WITH_REDIST)
85+
set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../")
86+
endif()
87+
88+
install(TARGETS ${python_module_name}
89+
DESTINATION "dpnp/backend/extensions/indexing"
90+
)

0 commit comments

Comments
 (0)