Skip to content

Commit 1b731ae

Browse files
authored
Merge branch 'master' into specify-array-api-version
2 parents aae6824 + 15b7644 commit 1b731ae

50 files changed

Lines changed: 1714 additions & 749 deletions

Some content is hidden

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

.github/workflows/conda-package.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ jobs:
218218
- name: Run tests
219219
if: env.rerun-tests-on-failure != 'true'
220220
run: |
221-
if [[ ${{ matrix.python }} == ${{ env.python-ver-test-all-dtypes }} ]]; then
221+
if [[ "${{ matrix.python }}" == "${{ env.python-ver-test-all-dtypes }}" ]]; then
222222
export DPNP_TEST_ALL_INT_TYPES=1
223223
python -m pytest -ra --pyargs ${{ env.package-name }}.tests
224224
else
@@ -238,7 +238,7 @@ jobs:
238238
. $CONDA/etc/profile.d/mamba.sh
239239
mamba activate ${{ env.test-env-name }}
240240
241-
if [[ ${{ matrix.python }} == ${{ env.python-ver-test-all-dtypes }} ]]; then
241+
if [[ "${{ matrix.python }}" == "${{ env.python-ver-test-all-dtypes }}" ]]; then
242242
export DPNP_TEST_ALL_INT_TYPES=1
243243
python -m pytest -ra --pyargs ${{ env.package-name }}.tests
244244
else
@@ -383,9 +383,10 @@ jobs:
383383
384384
- name: Run tests
385385
if: env.rerun-tests-on-failure != 'true'
386+
shell: pwsh
386387
run: |
387388
if (${{ matrix.python }} -eq ${{ env.python-ver-test-all-dtypes }}) {
388-
set DPNP_TEST_ALL_INT_TYPES=1
389+
$env:DPNP_TEST_ALL_INT_TYPES=1
389390
python -m pytest -ra --pyargs ${{ env.package-name }}.tests
390391
} else {
391392
python -m pytest -n auto -ra --pyargs ${{ env.package-name }}.tests
@@ -399,9 +400,10 @@ jobs:
399400
timeout_minutes: ${{ env.rerun-tests-timeout }}
400401
max_attempts: ${{ env.rerun-tests-max-attempts }}
401402
retry_on: any
403+
shell: pwsh
402404
command: |
403405
if ( ${{ matrix.python }} -eq ${{ env.python-ver-test-all-dtypes }} ) {
404-
set DPNP_TEST_ALL_INT_TYPES=1
406+
$env:DPNP_TEST_ALL_INT_TYPES=1
405407
python -m pytest -ra --pyargs ${{ env.package-name }}.tests
406408
} else {
407409
python -m pytest -n auto -ra --pyargs ${{ env.package-name }}.tests

.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@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10
71+
uses: github/codeql-action/upload-sarif@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3.28.11
7272
with:
7373
sarif_file: results.sarif

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010

1111
* Added implementation of `dpnp.hamming` [#2341](https://github.com/IntelPython/dpnp/pull/2341), [#2357](https://github.com/IntelPython/dpnp/pull/2357)
12+
* Added implementation of `dpnp.hanning` [#2358](https://github.com/IntelPython/dpnp/pull/2358)
13+
* Added implementation of `dpnp.blackman` [#2363](https://github.com/IntelPython/dpnp/pull/2363)
14+
* Added implementation of `dpnp.bartlett` [#2366](https://github.com/IntelPython/dpnp/pull/2366)
1215

1316
### Changed
1417

18+
* Allowed input array of `uint64` dtype in `dpnp.bincount` [#2361](https://github.com/IntelPython/dpnp/pull/2361)
19+
1520
### Fixed
1621

1722

doc/known_words.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Mises
5757
multinomial
5858
multivalued
5959
namespace
60+
namespaces
6061
namedtuple
6162
NaN
6263
NaT

dpnp/backend/extensions/lapack/gesv.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@ static sycl::event gesv_impl(sycl::queue &exec_q,
144144
is_exception_caught = true;
145145
gesv_utils::handle_lapack_exc(exec_q, lda, a, scratchpad_size,
146146
scratchpad, ipiv, e, error_msg);
147+
} catch (oneapi::mkl::computation_error const &e) {
148+
// TODO: remove this catch when gh-642(oneMath) is fixed
149+
// Workaround for oneMath interfaces
150+
// oneapi::mkl::computation_error is thrown instead of
151+
// oneapi::mkl::lapack::computation_error.
152+
if (scratchpad != nullptr)
153+
sycl_free_noexcept(scratchpad, exec_q);
154+
if (ipiv != nullptr)
155+
sycl_free_noexcept(ipiv, exec_q);
156+
throw LinAlgError("The input coefficient matrix is singular.");
147157
} catch (sycl::exception const &e) {
148158
is_exception_caught = true;
149159
error_msg << "Unexpected SYCL exception caught during getrf() or "

dpnp/backend/extensions/lapack/getrf.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ static sycl::event getrf_impl(sycl::queue &exec_q,
120120
"call:\nreason: "
121121
<< e.what() << "\ninfo: " << e.info();
122122
}
123+
} catch (oneapi::mkl::computation_error const &e) {
124+
// TODO: remove this catch when gh-642(oneMath) is fixed
125+
// Workaround for oneMath interfaces
126+
// oneapi::mkl::computation_error is thrown instead of
127+
// oneapi::mkl::lapack::computation_error.
128+
is_exception_caught = false;
129+
// computation_error means the input matrix is singular
130+
// dev_info must be set to any positive value.
131+
dev_info[0] = 2;
123132
} catch (sycl::exception const &e) {
124133
is_exception_caught = true;
125134
error_msg << "Unexpected SYCL exception caught during getrf() call:\n"

dpnp/backend/extensions/statistics/bincount.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct BincountEdges
7272
template <typename dT>
7373
bool in_bounds(const dT *val, const boundsT &bounds) const
7474
{
75-
return check_in_bounds(val[0], std::get<0>(bounds),
75+
return check_in_bounds(static_cast<T>(val[0]), std::get<0>(bounds),
7676
std::get<1>(bounds));
7777
}
7878

@@ -81,16 +81,17 @@ struct BincountEdges
8181
T max;
8282
};
8383

84-
template <typename T, typename HistType = size_t>
84+
using DefaultHistType = int64_t;
85+
86+
template <typename T, typename HistType = DefaultHistType>
8587
struct BincountF
8688
{
8789
static sycl::event impl(sycl::queue &exec_q,
8890
const void *vin,
89-
const int64_t min,
90-
const int64_t max,
91+
const uint64_t min,
92+
const uint64_t max,
9193
const void *vweights,
9294
void *vout,
93-
const size_t,
9495
const size_t size,
9596
const std::vector<sycl::event> &depends)
9697
{
@@ -145,9 +146,12 @@ struct BincountF
145146
}
146147
};
147148

148-
using SupportedTypes = std::tuple<std::tuple<int64_t, int64_t>,
149+
using SupportedTypes = std::tuple<std::tuple<int64_t, DefaultHistType>,
150+
std::tuple<uint64_t, DefaultHistType>,
149151
std::tuple<int64_t, float>,
150-
std::tuple<int64_t, double>>;
152+
std::tuple<uint64_t, float>,
153+
std::tuple<int64_t, double>,
154+
std::tuple<uint64_t, double>>;
151155

152156
} // namespace
153157

@@ -158,8 +162,8 @@ Bincount::Bincount() : dispatch_table("sample", "histogram")
158162

159163
std::tuple<sycl::event, sycl::event> Bincount::call(
160164
const dpctl::tensor::usm_ndarray &sample,
161-
const int64_t min,
162-
const int64_t max,
165+
const uint64_t min,
166+
const uint64_t max,
163167
const std::optional<const dpctl::tensor::usm_ndarray> &weights,
164168
dpctl::tensor::usm_ndarray &histogram,
165169
const std::vector<sycl::event> &depends)
@@ -182,8 +186,7 @@ std::tuple<sycl::event, sycl::event> Bincount::call(
182186
weights.has_value() ? weights.value().get_data() : nullptr;
183187

184188
auto ev = bincount_func(exec_q, sample.get_data(), min, max, weights_ptr,
185-
histogram.get_data(), histogram.get_shape(0),
186-
sample.get_shape(0), depends);
189+
histogram.get_data(), sample.get_size(), depends);
187190

188191
sycl::event args_ev;
189192
if (weights.has_value()) {

dpnp/backend/extensions/statistics/bincount.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,11 @@ struct Bincount
3939
{
4040
using FnT = sycl::event (*)(sycl::queue &,
4141
const void *,
42-
const int64_t,
43-
const int64_t,
42+
const uint64_t,
43+
const uint64_t,
4444
const void *,
4545
void *,
4646
const size_t,
47-
const size_t,
4847
const std::vector<sycl::event> &);
4948

5049
common::DispatchTable2<FnT> dispatch_table;
@@ -53,8 +52,8 @@ struct Bincount
5352

5453
std::tuple<sycl::event, sycl::event>
5554
call(const dpctl::tensor::usm_ndarray &input,
56-
const int64_t min,
57-
const int64_t max,
55+
const uint64_t min,
56+
const uint64_t max,
5857
const std::optional<const dpctl::tensor::usm_ndarray> &weights,
5958
dpctl::tensor::usm_ndarray &output,
6059
const std::vector<sycl::event> &depends);

dpnp/backend/extensions/statistics/histogram.cpp

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ using CachedEdges = HistogramEdges<T, CachedData<const T, 1>>;
106106
template <typename T>
107107
using UncachedEdges = HistogramEdges<T, UncachedData<const T, 1>>;
108108

109-
template <typename T, typename BinsT, typename HistType = size_t>
109+
using DefaultHistType = int64_t;
110+
111+
template <typename T, typename BinsT, typename HistType = DefaultHistType>
110112
struct HistogramF
111113
{
112114
static sycl::event impl(sycl::queue &exec_q,
@@ -186,26 +188,27 @@ using HistogramF_ = HistogramF<SampleType, SampleType, HistType>;
186188

187189
} // namespace
188190

189-
using SupportedTypes = std::tuple<std::tuple<uint64_t, int64_t>,
190-
std::tuple<int64_t, int64_t>,
191-
std::tuple<uint64_t, float>,
192-
std::tuple<int64_t, float>,
193-
std::tuple<uint64_t, double>,
194-
std::tuple<int64_t, double>,
195-
std::tuple<uint64_t, std::complex<float>>,
196-
std::tuple<int64_t, std::complex<float>>,
197-
std::tuple<uint64_t, std::complex<double>>,
198-
std::tuple<int64_t, std::complex<double>>,
199-
std::tuple<float, int64_t>,
200-
std::tuple<double, int64_t>,
201-
std::tuple<float, float>,
202-
std::tuple<double, double>,
203-
std::tuple<float, std::complex<float>>,
204-
std::tuple<double, std::complex<double>>,
205-
std::tuple<std::complex<float>, int64_t>,
206-
std::tuple<std::complex<double>, int64_t>,
207-
std::tuple<std::complex<float>, float>,
208-
std::tuple<std::complex<double>, double>>;
191+
using SupportedTypes =
192+
std::tuple<std::tuple<uint64_t, DefaultHistType>,
193+
std::tuple<int64_t, DefaultHistType>,
194+
std::tuple<uint64_t, float>,
195+
std::tuple<int64_t, float>,
196+
std::tuple<uint64_t, double>,
197+
std::tuple<int64_t, double>,
198+
std::tuple<uint64_t, std::complex<float>>,
199+
std::tuple<int64_t, std::complex<float>>,
200+
std::tuple<uint64_t, std::complex<double>>,
201+
std::tuple<int64_t, std::complex<double>>,
202+
std::tuple<float, DefaultHistType>,
203+
std::tuple<double, DefaultHistType>,
204+
std::tuple<float, float>,
205+
std::tuple<double, double>,
206+
std::tuple<float, std::complex<float>>,
207+
std::tuple<double, std::complex<double>>,
208+
std::tuple<std::complex<float>, DefaultHistType>,
209+
std::tuple<std::complex<double>, DefaultHistType>,
210+
std::tuple<std::complex<float>, float>,
211+
std::tuple<std::complex<double>, double>>;
209212

210213
Histogram::Histogram() : dispatch_table("sample", "histogram")
211214
{

dpnp/backend/extensions/ufunc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
# *****************************************************************************
2525

2626
set(_elementwise_sources
27+
${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/bitwise_count.cpp
2728
${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/common.cpp
2829
${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/degrees.cpp
2930
${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/fabs.cpp

0 commit comments

Comments
 (0)