Skip to content

Commit d3e0c45

Browse files
authored
Merge branch 'master' into in-place-element-wise-func-casting
2 parents 86d5c69 + cf2a106 commit d3e0c45

File tree

191 files changed

+22416
-4893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+22416
-4893
lines changed

.github/workflows/conda-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
# Follow oneAPI installation instruction for conda, since intel channel is not longer available
1414
# CHANNELS: '-c dppy/label/dev -c intel -c conda-forge --override-channels'
1515
CHANNELS: '-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels'
16-
CONDA_BUILD_VERSION: '24.9.0'
16+
CONDA_BUILD_VERSION: '24.11.2'
1717
CONDA_INDEX_VERSION: '0.5.0'
1818
RERUN_TESTS_ON_FAILURE: 'true'
1919
RUN_TESTS_MAX_ATTEMPTS: 2

.github/workflows/openssf-scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ jobs:
6868

6969
# Upload the results to GitHub's code scanning dashboard.
7070
- name: "Upload to code-scanning"
71-
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
71+
uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
7272
with:
7373
sarif_file: results.sarif

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ repos:
3434
(?x)^(
3535
dpnp/tests/test_arraycreation.py|
3636
dpnp/tests/test_sycl_queue.py|
37-
dpnp/tests/test_usm_type.py
37+
dpnp/tests/test_usm_type.py|
38+
dpnp/tests/third_party/cupy/core_tests/test_nep50_examples.py
3839
)$
3940
- id: python-no-log-warn
4041
- id: python-use-type-annotations

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
### Fixed
1414

1515

16+
## [0.16.1] - 12/06/2024
17+
18+
This is a bug-fix release.
19+
20+
### Changed
21+
22+
* Changed to use `Miniforge` installer in GitHub actions [#2057](https://github.com/IntelPython/dpnp/pull/2057)
23+
* Updated `README.md` to reflect current installation requirements and available options [#2166](https://github.com/IntelPython/dpnp/pull/2166)
24+
* Corrected the list of owners and code maintainers [#2185](https://github.com/IntelPython/dpnp/pull/2185)
25+
* Bumped the version of `oneMKL` interface used in dpnp build by default to align it with `2025.0` oneAPI release [#2193](https://github.com/IntelPython/dpnp/pull/2193)
26+
27+
### Fixed
28+
29+
* Resolved an issue with Compute Follows Data inconsistency in `dpnp.extract` function [#2172](https://github.com/IntelPython/dpnp/pull/2172)
30+
* Resolved an import error when using `dpnp` in virtual environment on Linux [#2199](https://github.com/IntelPython/dpnp/pull/2199)
31+
* Fixed incorrect result produced by `dpnp.fft.fft` function when input array has negative strides [#2202](https://github.com/IntelPython/dpnp/pull/2202)
32+
* Fixed an issue with `numpy.ndarray` input processing in the `dpnp.from_dlpack` function and updated the documentation [#2209](https://github.com/IntelPython/dpnp/pull/2209)
33+
* Resolved a compilation error when building with DPC++ 2025.1 compiler [#2211](https://github.com/IntelPython/dpnp/pull/2211)
34+
35+
1636
## [0.16.0] - 10/14/2024
1737

1838
This release reaches an important milestone by making offloading fully asynchronous. Calls to `dpnp` submit tasks for execution to DPC++ runtime and return without waiting for execution of these tasks to finish. The sequential semantics a user comes to expect from execution of Python script is preserved though.

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ project(dpnp
66
DESCRIPTION "NumPy-like API accelerated by SYCL."
77
)
88

9-
option(DPNP_GENERATE_COVERAGE "Enable build DPNP with coverage instrumentation" FALSE)
10-
option(DPNP_BACKEND_TESTS "Enable building of DPNP backend test suite" FALSE)
9+
option(DPNP_GENERATE_COVERAGE "Enable build DPNP with coverage instrumentation" OFF)
10+
option(DPNP_BACKEND_TESTS "Enable building of DPNP backend test suite" OFF)
11+
option(DPNP_WITH_REDIST "Build DPNP assuming DPC++ redistributable is installed into Python prefix" OFF)
1112

1213
set(CMAKE_CXX_STANDARD 17)
1314
set(CMAKE_CXX_STANDARD_REQUIRED True)
@@ -111,8 +112,8 @@ if(_use_onemkl_interfaces)
111112
set(ENABLE_CUSOLVER_BACKEND True)
112113
set(ENABLE_CUFFT_BACKEND True)
113114
# set(ENABLE_CURAND_BACKEND True)
114-
set(ENABLE_MKLGPU_BACKEND False)
115-
set(ENABLE_MKLCPU_BACKEND False)
115+
set(ENABLE_MKLGPU_BACKEND True)
116+
set(ENABLE_MKLCPU_BACKEND True)
116117
endif()
117118

118119
if(DPNP_ONEMKL_INTERFACES_DIR)

conda-recipe/bld.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if DEFINED OVERRIDE_INTEL_IPO (
1616
set "SKBUILD_ARGS=%SKBUILD_ARGS% -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=FALSE"
1717
)
1818

19-
FOR %%V IN (14.0.0 14 15.0.0 15 16.0.0 16 17.0.0 17) DO @(
19+
FOR %%V IN (17.0.0 17 18.0.0 18 19.0.0 19) DO @(
2020
REM set DIR_HINT if directory exists
2121
IF EXIST "%BUILD_PREFIX%\Library\lib\clang\%%V\" (
2222
SET "SYCL_INCLUDE_DIR_HINT=%BUILD_PREFIX%\Library\lib\clang\%%V"

conda-recipe/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# This is necessary to help DPC++ find Intel libraries such as SVML, IRNG, etc in build prefix
4-
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${BUILD_PREFIX}/lib"
4+
export LIBRARY_PATH="$LIBRARY_PATH:${BUILD_PREFIX}/lib"
55

66
# Intel LLVM must cooperate with compiler and sysroot from conda
77
echo "--gcc-toolchain=${BUILD_PREFIX} --sysroot=${BUILD_PREFIX}/${HOST}/sysroot -target ${HOST}" > icpx_for_conda.cfg
@@ -18,6 +18,7 @@ export DPL_ROOT_HINT=$PREFIX
1818
export MKL_ROOT_HINT=$PREFIX
1919
SKBUILD_ARGS=(-- "-DCMAKE_C_COMPILER:PATH=icx" "-DCMAKE_CXX_COMPILER:PATH=icpx" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON")
2020
SKBUILD_ARGS=("${SKBUILD_ARGS[@]}" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON")
21+
SKBUILD_ARGS=("${SKBUILD_ARGS[@]}" "-DDPNP_WITH_REDIST:BOOL=ON")
2122

2223
# Build wheel package
2324
WHEELS_BUILD_ARGS=("-p" "manylinux_2_28_x86_64")

doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def _can_document_member(member, *args, **kwargs):
220220
"python": ("https://docs.python.org/3/", None),
221221
"numpy": ("https://docs.scipy.org/doc/numpy/", None),
222222
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", None),
223+
"dpctl": ("https://intelpython.github.io/dpctl/latest/", None),
223224
}
224225

225226
# If true, `todo` and `todoList` produce output, else they produce nothing.

dpnp/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
function(build_dpnp_cython_ext _trgt _src _dest)
22
set(options SYCL)
3-
cmake_parse_arguments(BUILD_DPNP_EXT "${options}" "" "" ${ARGN})
43
add_cython_target(${_trgt} ${_src} CXX OUTPUT_VAR _generated_src)
54
message(STATUS "Using ${_trgt}")
65

@@ -41,15 +40,19 @@ function(build_dpnp_cython_ext _trgt _src _dest)
4140
VERBATIM COMMENT "Copying Cython-generated source for target ${_trgt} to dpnp source layout"
4241
)
4342
endif()
43+
44+
set(_rpath_value "$ORIGIN/..")
45+
if (DPNP_WITH_REDIST)
46+
set(_rpath_value "${_rpath_value}:$ORIGIN/../../../../")
47+
endif()
48+
set_target_properties(${_trgt} PROPERTIES INSTALL_RPATH ${_rpath_value})
49+
4450
install(TARGETS ${_trgt} LIBRARY DESTINATION ${_dest})
4551
endfunction()
4652

4753
function(build_dpnp_cython_ext_with_backend _trgt _src _dest)
4854
build_dpnp_cython_ext(${_trgt} ${_src} ${_dest})
4955
target_link_libraries(${_trgt} PRIVATE dpnp_backend_library)
50-
if (UNIX)
51-
set_target_properties(${_trgt} PROPERTIES INSTALL_RPATH "$ORIGIN/..")
52-
endif()
5356
endfunction()
5457

5558
add_subdirectory(backend)

dpnp/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
[os.getenv("PATH", ""), mypath, dpctlpath]
5050
)
5151

52+
# Borrowed from DPCTL
53+
from dpctl.tensor import DLDeviceType
54+
5255
from dpnp.dpnp_array import dpnp_array as ndarray
5356
from dpnp.dpnp_flatiter import flatiter as flatiter
5457
from dpnp.dpnp_iface_types import *

dpnp/backend/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ add_library(dpnp_backend_library INTERFACE IMPORTED GLOBAL)
100100
target_include_directories(dpnp_backend_library BEFORE INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src)
101101
target_link_libraries(dpnp_backend_library INTERFACE ${_trgt})
102102

103+
if (DPNP_WITH_REDIST)
104+
set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../")
105+
endif()
106+
103107
if (DPNP_BACKEND_TESTS)
104108
add_subdirectory(tests)
105109
endif()

dpnp/backend/extensions/blas/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ else()
9393
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::BLAS)
9494
endif()
9595

96+
if (DPNP_WITH_REDIST)
97+
set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../")
98+
endif()
99+
96100
install(TARGETS ${python_module_name}
97101
DESTINATION "dpnp/backend/extensions/blas"
98102
)

dpnp/backend/extensions/blas/gemm.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ typedef sycl::event (*gemm_impl_fn_ptr_t)(sycl::queue &,
5555
const std::int64_t,
5656
char *,
5757
const std::int64_t,
58+
#if !defined(USE_ONEMKL_CUBLAS)
5859
const bool,
60+
#endif // !USE_ONEMKL_CUBLAS
5961
const std::vector<sycl::event> &);
6062

6163
static gemm_impl_fn_ptr_t gemm_dispatch_table[dpctl_td_ns::num_types]
@@ -74,7 +76,9 @@ static sycl::event gemm_impl(sycl::queue &exec_q,
7476
const std::int64_t ldb,
7577
char *resultC,
7678
const std::int64_t ldc,
79+
#if !defined(USE_ONEMKL_CUBLAS)
7780
const bool is_row_major,
81+
#endif // !USE_ONEMKL_CUBLAS
7882
const std::vector<sycl::event> &depends)
7983
{
8084
type_utils::validate_type_for_device<Tab>(exec_q);
@@ -236,6 +240,7 @@ std::tuple<sycl::event, sycl::event, bool>
236240
std::int64_t lda;
237241
std::int64_t ldb;
238242

243+
// cuBLAS supports only column-major storage
239244
#if defined(USE_ONEMKL_CUBLAS)
240245
const bool is_row_major = false;
241246

@@ -315,9 +320,15 @@ std::tuple<sycl::event, sycl::event, bool>
315320
const char *b_typeless_ptr = matrixB.get_data();
316321
char *r_typeless_ptr = resultC.get_data();
317322

323+
#if defined(USE_ONEMKL_CUBLAS)
324+
sycl::event gemm_ev =
325+
gemm_fn(exec_q, transA, transB, m, n, k, a_typeless_ptr, lda,
326+
b_typeless_ptr, ldb, r_typeless_ptr, ldc, depends);
327+
#else
318328
sycl::event gemm_ev = gemm_fn(exec_q, transA, transB, m, n, k,
319329
a_typeless_ptr, lda, b_typeless_ptr, ldb,
320330
r_typeless_ptr, ldc, is_row_major, depends);
331+
#endif // USE_ONEMKL_CUBLAS
321332

322333
sycl::event args_ev = dpctl::utils::keep_args_alive(
323334
exec_q, {matrixA, matrixB, resultC}, {gemm_ev});

dpnp/backend/extensions/blas/gemm_batch.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ typedef sycl::event (*gemm_batch_impl_fn_ptr_t)(
6060
const char *,
6161
const char *,
6262
char *,
63+
#if !defined(USE_ONEMKL_CUBLAS)
6364
const bool,
65+
#endif // !USE_ONEMKL_CUBLAS
6466
const std::vector<sycl::event> &);
6567

6668
static gemm_batch_impl_fn_ptr_t
@@ -83,7 +85,9 @@ static sycl::event gemm_batch_impl(sycl::queue &exec_q,
8385
const char *matrixA,
8486
const char *matrixB,
8587
char *resultC,
88+
#if !defined(USE_ONEMKL_CUBLAS)
8689
const bool is_row_major,
90+
#endif // !USE_ONEMKL_CUBLAS
8791
const std::vector<sycl::event> &depends)
8892
{
8993
type_utils::validate_type_for_device<Tab>(exec_q);
@@ -311,6 +315,7 @@ std::tuple<sycl::event, sycl::event, bool>
311315
std::int64_t lda;
312316
std::int64_t ldb;
313317

318+
// cuBLAS supports only column-major storage
314319
#if defined(USE_ONEMKL_CUBLAS)
315320
const bool is_row_major = false;
316321

@@ -391,10 +396,17 @@ std::tuple<sycl::event, sycl::event, bool>
391396
const char *b_typeless_ptr = matrixB.get_data();
392397
char *r_typeless_ptr = resultC.get_data();
393398

399+
#if defined(USE_ONEMKL_CUBLAS)
400+
sycl::event gemm_batch_ev =
401+
gemm_batch_fn(exec_q, m, n, k, batch_size, lda, ldb, ldc, stridea,
402+
strideb, stridec, transA, transB, a_typeless_ptr,
403+
b_typeless_ptr, r_typeless_ptr, depends);
404+
#else
394405
sycl::event gemm_batch_ev =
395406
gemm_batch_fn(exec_q, m, n, k, batch_size, lda, ldb, ldc, stridea,
396407
strideb, stridec, transA, transB, a_typeless_ptr,
397408
b_typeless_ptr, r_typeless_ptr, is_row_major, depends);
409+
#endif // USE_ONEMKL_CUBLAS
398410

399411
sycl::event args_ev = dpctl::utils::keep_args_alive(
400412
exec_q, {matrixA, matrixB, resultC}, {gemm_batch_ev});

dpnp/backend/extensions/blas/gemv.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ typedef sycl::event (*gemv_impl_fn_ptr_t)(sycl::queue &,
5353
const std::int64_t,
5454
char *,
5555
const std::int64_t,
56+
#if !defined(USE_ONEMKL_CUBLAS)
5657
const bool,
58+
#endif // !USE_ONEMKL_CUBLAS
5759
const std::vector<sycl::event> &);
5860

5961
static gemv_impl_fn_ptr_t gemv_dispatch_vector[dpctl_td_ns::num_types];
@@ -69,7 +71,9 @@ static sycl::event gemv_impl(sycl::queue &exec_q,
6971
const std::int64_t incx,
7072
char *vectorY,
7173
const std::int64_t incy,
74+
#if !defined(USE_ONEMKL_CUBLAS)
7275
const bool is_row_major,
76+
#endif // !USE_ONEMKL_CUBLAS
7377
const std::vector<sycl::event> &depends)
7478
{
7579
type_utils::validate_type_for_device<T>(exec_q);
@@ -190,6 +194,7 @@ std::pair<sycl::event, sycl::event>
190194
oneapi::mkl::transpose transA;
191195
std::size_t src_nelems;
192196

197+
// cuBLAS supports only column-major storage
193198
#if defined(USE_ONEMKL_CUBLAS)
194199
const bool is_row_major = false;
195200
std::int64_t m;
@@ -299,9 +304,15 @@ std::pair<sycl::event, sycl::event>
299304
y_typeless_ptr -= (y_shape[0] - 1) * std::abs(incy) * y_elemsize;
300305
}
301306

307+
#if defined(USE_ONEMKL_CUBLAS)
308+
sycl::event gemv_ev =
309+
gemv_fn(exec_q, transA, m, n, a_typeless_ptr, lda, x_typeless_ptr, incx,
310+
y_typeless_ptr, incy, depends);
311+
#else
302312
sycl::event gemv_ev =
303313
gemv_fn(exec_q, transA, m, n, a_typeless_ptr, lda, x_typeless_ptr, incx,
304314
y_typeless_ptr, incy, is_row_major, depends);
315+
#endif // USE_ONEMKL_CUBLAS
305316

306317
sycl::event args_ev = dpctl::utils::keep_args_alive(
307318
exec_q, {matrixA, vectorX, vectorY}, {gemv_ev});

dpnp/backend/extensions/fft/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ else()
8989
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::DFT)
9090
endif()
9191

92+
if (DPNP_WITH_REDIST)
93+
set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../")
94+
endif()
95+
9296
install(TARGETS ${python_module_name}
9397
DESTINATION "dpnp/backend/extensions/fft"
9498
)

dpnp/backend/extensions/lapack/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ else()
107107
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::LAPACK)
108108
endif()
109109

110+
if (DPNP_WITH_REDIST)
111+
set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../")
112+
endif()
113+
110114
install(TARGETS ${python_module_name}
111115
DESTINATION "dpnp/backend/extensions/lapack"
112116
)

dpnp/backend/extensions/statistics/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@
2626

2727
set(python_module_name _statistics_impl)
2828
set(_module_src
29-
${CMAKE_CURRENT_SOURCE_DIR}/common.cpp
3029
${CMAKE_CURRENT_SOURCE_DIR}/bincount.cpp
30+
${CMAKE_CURRENT_SOURCE_DIR}/common.cpp
3131
${CMAKE_CURRENT_SOURCE_DIR}/histogram.cpp
32+
${CMAKE_CURRENT_SOURCE_DIR}/histogramdd.cpp
3233
${CMAKE_CURRENT_SOURCE_DIR}/histogram_common.cpp
34+
${CMAKE_CURRENT_SOURCE_DIR}/sliding_dot_product1d.cpp
35+
${CMAKE_CURRENT_SOURCE_DIR}/sliding_window1d.cpp
3336
${CMAKE_CURRENT_SOURCE_DIR}/statistics_py.cpp
37+
${CMAKE_CURRENT_SOURCE_DIR}/validation_utils.cpp
3438
)
3539

3640
pybind11_add_module(${python_module_name} MODULE ${_module_src})
@@ -84,6 +88,10 @@ if (DPNP_GENERATE_COVERAGE)
8488
target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping)
8589
endif()
8690

91+
if (DPNP_WITH_REDIST)
92+
set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../")
93+
endif()
94+
8795
install(TARGETS ${python_module_name}
8896
DESTINATION "dpnp/backend/extensions/statistics"
8997
)

dpnp/backend/extensions/statistics/bincount.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@
2525

2626
#pragma once
2727

28-
#include <dpctl4pybind11.hpp>
28+
#include <pybind11/pybind11.h>
2929
#include <sycl/sycl.hpp>
3030

3131
#include "dispatch_table.hpp"
32+
#include "dpctl4pybind11.hpp"
3233

3334
namespace dpctl_td_ns = dpctl::tensor::type_dispatch;
3435

35-
namespace statistics
36-
{
37-
namespace histogram
36+
namespace statistics::histogram
3837
{
3938
struct Bincount
4039
{
@@ -62,5 +61,4 @@ struct Bincount
6261
};
6362

6463
void populate_bincount(py::module_ m);
65-
} // namespace histogram
66-
} // namespace statistics
64+
} // namespace statistics::histogram

0 commit comments

Comments
 (0)