Skip to content

Commit 323f0f7

Browse files
Merge branch 'main' into dev/skopienko/simplify_tests_new_kernel_name_impl
2 parents 9777bf8 + d936366 commit 323f0f7

20 files changed

+474
-307
lines changed

.github/workflows/scorecard.yml

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ jobs:
3636
with:
3737
persist-credentials: false
3838

39-
- name: "Scorecard Analysis (Attempt 1/3) - Retries on API errors"
40-
id: scorecard_attempt_1
41-
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
42-
continue-on-error: true
39+
- name: "Run analysis"
40+
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
4341
with:
4442
results_file: results.sarif
4543
results_format: sarif
@@ -58,50 +56,6 @@ jobs:
5856
# of the value entered here.
5957
publish_results: true
6058

61-
- name: "Wait before retry"
62-
if: steps.scorecard_attempt_1.outcome == 'failure'
63-
run: |
64-
echo "First attempt failed, waiting 60 seconds before retry..."
65-
sleep 60
66-
67-
- name: "Scorecard Analysis (Attempt 2/3) - Retry after API failure"
68-
id: scorecard_attempt_2
69-
if: steps.scorecard_attempt_1.outcome == 'failure'
70-
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
71-
continue-on-error: true
72-
with:
73-
results_file: results.sarif
74-
results_format: sarif
75-
publish_results: true
76-
77-
- name: "Wait before final retry"
78-
if: steps.scorecard_attempt_1.outcome == 'failure' && steps.scorecard_attempt_2.outcome == 'failure'
79-
run: |
80-
echo "Second attempt failed, waiting 120 seconds before final retry..."
81-
sleep 120
82-
83-
- name: "Scorecard Analysis (Final Attempt 3/3)"
84-
id: scorecard_final
85-
if: steps.scorecard_attempt_1.outcome == 'failure' && steps.scorecard_attempt_2.outcome == 'failure'
86-
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
87-
with:
88-
results_file: results.sarif
89-
results_format: sarif
90-
publish_results: true
91-
92-
- name: "Report status"
93-
run: |
94-
if [ "${{ steps.scorecard_attempt_1.outcome }}" == "success" ]; then
95-
echo "Scorecard analysis completed successfully on first attempt"
96-
elif [ "${{ steps.scorecard_attempt_2.outcome }}" == "success" ]; then
97-
echo "Scorecard analysis completed successfully on second attempt"
98-
elif [ "${{ steps.scorecard_final.outcome }}" == "success" ]; then
99-
echo "Scorecard analysis completed successfully on final attempt"
100-
else
101-
echo "::error::All Scorecard attempts failed. Please try running the workflow again later."
102-
exit 1
103-
fi
104-
10559
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
10660
# format to the repository Actions tab.
10761
#- name: "Upload artifact"

include/oneapi/dpl/pstl/algorithm_impl.h

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "parallel_backend.h"
3434
#include "parallel_impl.h"
3535
#include "iterator_impl.h"
36-
#include "functional_impl.h" // for oneapi::dpl::identity
36+
#include "functional_impl.h" // for oneapi::dpl::identity, std::invoke
3737

3838
#if _ONEDPL_HETERO_BACKEND
3939
# include "hetero/algorithm_impl_hetero.h" // for __pattern_fill_n, __pattern_generate_n
@@ -2442,7 +2442,9 @@ __pattern_sort_by_key(_Tag, _ExecutionPolicy&&, _RandomAccessIterator1 __keys_fi
24422442

24432443
auto __beg = oneapi::dpl::make_zip_iterator(__keys_first, __values_first);
24442444
auto __end = __beg + (__keys_last - __keys_first);
2445-
auto __cmp_f = [__comp](const auto& __a, const auto& __b) { return __comp(std::get<0>(__a), std::get<0>(__b)); };
2445+
auto __cmp_f = [__comp](const auto& __a, const auto& __b) {
2446+
return std::invoke(__comp, std::get<0>(__a), std::get<0>(__b));
2447+
};
24462448

24472449
__leaf_sort(__beg, __end, __cmp_f);
24482450
}
@@ -2456,7 +2458,9 @@ __pattern_sort_by_key(__parallel_tag<_IsVector>, _ExecutionPolicy&& __exec, _Ran
24562458
{
24572459
auto __beg = oneapi::dpl::make_zip_iterator(__keys_first, __values_first);
24582460
auto __end = __beg + (__keys_last - __keys_first);
2459-
auto __cmp_f = [__comp](const auto& __a, const auto& __b) { return __comp(std::get<0>(__a), std::get<0>(__b)); };
2461+
auto __cmp_f = [__comp](const auto& __a, const auto& __b) {
2462+
return std::invoke(__comp, std::get<0>(__a), std::get<0>(__b));
2463+
};
24602464

24612465
using __backend_tag = typename __parallel_tag<_IsVector>::__backend_tag;
24622466

@@ -2699,8 +2703,9 @@ __pattern_nth_element(__parallel_tag<_IsVector> __tag, _ExecutionPolicy&& __exec
26992703
_RandomAccessIterator __x;
27002704
do
27012705
{
2702-
__x = __internal::__pattern_partition(__tag, ::std::forward<_ExecutionPolicy>(__exec), __first + 1, __last,
2703-
[&__comp, __first](const _Tp& __x) { return __comp(__x, *__first); });
2706+
__x = __internal::__pattern_partition(
2707+
__tag, std::forward<_ExecutionPolicy>(__exec), __first + 1, __last,
2708+
[&__comp, __first](const _Tp& __x) { return std::invoke(__comp, __x, *__first); });
27042709
--__x;
27052710
if (__x != __first)
27062711
{
@@ -2715,7 +2720,7 @@ __pattern_nth_element(__parallel_tag<_IsVector> __tag, _ExecutionPolicy&& __exec
27152720
else if (__x - __nth < 0)
27162721
{
27172722
// if *x == *nth then we start the new partition at the next index where *x != *nth
2718-
while (!__comp(*__nth, *__x) && !__comp(*__x, *__nth) && __x - __nth < 0)
2723+
while (!std::invoke(__comp, *__nth, *__x) && !std::invoke(__comp, *__x, *__nth) && __x - __nth < 0)
27192724
{
27202725
++__x;
27212726
}
@@ -3220,15 +3225,15 @@ __pattern_includes(__parallel_tag<_IsVector> __tag, _ExecutionPolicy&& __exec, _
32203225
if (__first1 == __last1 || __last2 - __first2 > __last1 - __first1 ||
32213226
// {1}: [**********] or [**********]
32223227
// {2}: [***********] [***********]
3223-
__comp(*__first2, *__first1) || __comp(*(__last1 - 1), *(__last2 - 1)))
3228+
std::invoke(__comp, *__first2, *__first1) || std::invoke(__comp, *(__last1 - 1), *(__last2 - 1)))
32243229
return false;
32253230

32263231
__first1 = ::std::lower_bound(__first1, __last1, *__first2, __comp);
32273232
if (__first1 == __last1)
32283233
return false;
32293234

32303235
if (__last2 - __first2 == 1)
3231-
return !__comp(*__first1, *__first2) && !__comp(*__first2, *__first1);
3236+
return !std::invoke(__comp, *__first1, *__first2) && !std::invoke(__comp, *__first2, *__first1);
32323237

32333238
return __internal::__except_handler([&]() {
32343239
return !__internal::__parallel_or(
@@ -3240,7 +3245,7 @@ __pattern_includes(__parallel_tag<_IsVector> __tag, _ExecutionPolicy&& __exec, _
32403245
//1. moving boundaries to "consume" subsequence of equal elements
32413246
auto __is_equal_sorted = [&__comp](_RandomAccessIterator2 __a, _RandomAccessIterator2 __b) -> bool {
32423247
//enough one call of __comp due to compared couple belongs to one sorted sequence
3243-
return !__comp(*__a, *__b);
3248+
return !std::invoke(__comp, *__a, *__b);
32443249
};
32453250

32463251
//1.1 left bound, case "aaa[aaaxyz...]" - searching "x"
@@ -3260,8 +3265,8 @@ __pattern_includes(__parallel_tag<_IsVector> __tag, _ExecutionPolicy&& __exec, _
32603265
//2. testing is __a subsequence of the second range included into the first range
32613266
auto __b = ::std::lower_bound(__first1, __last1, *__i, __comp);
32623267

3263-
assert(!__comp(*(__last1 - 1), *__b));
3264-
assert(!__comp(*(__j - 1), *__i));
3268+
assert(!std::invoke(__comp, *(__last1 - 1), *__b));
3269+
assert(!std::invoke(__comp, *(__j - 1), *__i));
32653270
return !::std::includes(__b, __last1, __i, __j, __comp);
32663271
});
32673272
});
@@ -3846,9 +3851,10 @@ __brick_is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __las
38463851
/* __is_vector = */ ::std::true_type) noexcept
38473852
{
38483853
using _SizeType = typename std::iterator_traits<_RandomAccessIterator>::difference_type;
3849-
return __unseq_backend::__simd_first(
3850-
__first, _SizeType(0), __last - __first,
3851-
[&__comp](_RandomAccessIterator __it, _SizeType __i) { return __comp(__it[(__i - 1) / 2], __it[__i]); });
3854+
return __unseq_backend::__simd_first(__first, _SizeType(0), __last - __first,
3855+
[&__comp](_RandomAccessIterator __it, _SizeType __i) {
3856+
return std::invoke(__comp, __it[(__i - 1) / 2], __it[__i]);
3857+
});
38523858
}
38533859

38543860
template <class _Tag, class _ExecutionPolicy, class _RandomAccessIterator, class _Compare>
@@ -3868,7 +3874,7 @@ __is_heap_until_local(_RandomAccessIterator __first, _DifferenceType __begin, _D
38683874
{
38693875
_DifferenceType __i = __begin;
38703876
for (; __i < __end; ++__i)
3871-
if (__comp(__first[(__i - 1) / 2], __first[__i]))
3877+
if (std::invoke(__comp, __first[(__i - 1) / 2], __first[__i]))
38723878
break;
38733879
return __first + __i;
38743880
}
@@ -3878,9 +3884,10 @@ _RandomAccessIterator
38783884
__is_heap_until_local(_RandomAccessIterator __first, _DifferenceType __begin, _DifferenceType __end, _Compare __comp,
38793885
/* __is_vector = */ ::std::true_type) noexcept
38803886
{
3881-
return __unseq_backend::__simd_first(
3882-
__first, __begin, __end,
3883-
[&__comp](_RandomAccessIterator __it, _DifferenceType __i) { return __comp(__it[(__i - 1) / 2], __it[__i]); });
3887+
return __unseq_backend::__simd_first(__first, __begin, __end,
3888+
[&__comp](_RandomAccessIterator __it, _DifferenceType __i) {
3889+
return std::invoke(__comp, __it[(__i - 1) / 2], __it[__i]);
3890+
});
38843891
}
38853892

38863893
template <class _IsVector, class _ExecutionPolicy, class _RandomAccessIterator, class _Compare>
@@ -3916,7 +3923,7 @@ __brick_is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
39163923
/* __is_vector = */ ::std::true_type) noexcept
39173924
{
39183925
return !__unseq_backend::__simd_or_iter(__first, __last - __first, [__first, &__comp](_RandomAccessIterator __it) {
3919-
return __comp(*(__first + (__it - __first - 1) / 2), *__it);
3926+
return std::invoke(__comp, *(__first + (__it - __first - 1) / 2), *__it);
39203927
});
39213928
}
39223929

@@ -3933,10 +3940,10 @@ bool
39333940
__is_heap_local(_RandomAccessIterator __first, _DifferenceType __begin, _DifferenceType __end, _Compare __comp,
39343941
/* __is_vector = */ ::std::true_type) noexcept
39353942
{
3936-
return !__unseq_backend::__simd_or_iter(__first + __begin, __end - __begin,
3937-
[__first, &__comp](_RandomAccessIterator __it) {
3938-
return __comp(*(__first + (__it - __first - 1) / 2), *__it);
3939-
});
3943+
return !__unseq_backend::__simd_or_iter(
3944+
__first + __begin, __end - __begin, [__first, &__comp](_RandomAccessIterator __it) {
3945+
return std::invoke(__comp, *(__first + (__it - __first - 1) / 2), *__it);
3946+
});
39403947
}
39413948

39423949
template <class _Tag, class _ExecutionPolicy, class _RandomAccessIterator, class _Compare>
@@ -4205,16 +4212,16 @@ __brick_lexicographical_compare(_RandomAccessIterator1 __first1, _RandomAccessIt
42054212
auto __n = ::std::min(__last1 - __first1, __last2 - __first2);
42064213
::std::pair<_RandomAccessIterator1, _RandomAccessIterator2> __result = __unseq_backend::__simd_first(
42074214
__first1, __n, __first2, [__comp](const ref_type1 __x, const ref_type2 __y) mutable {
4208-
return __comp(__x, __y) || __comp(__y, __x);
4215+
return std::invoke(__comp, __x, __y) || std::invoke(__comp, __y, __x);
42094216
});
42104217

42114218
if (__result.first == __last1 && __result.second != __last2)
42124219
{ // if first sequence shorter than second
4213-
return !__comp(*__result.second, *__result.first);
4220+
return !std::invoke(__comp, *__result.second, *__result.first);
42144221
}
42154222
else
42164223
{ // if second sequence shorter than first or both have the same number of elements
4217-
return __comp(*__result.first, *__result.second);
4224+
return std::invoke(__comp, *__result.first, *__result.second);
42184225
}
42194226
}
42204227
}
@@ -4261,7 +4268,7 @@ __pattern_lexicographical_compare(__parallel_tag<_IsVector> __tag, _ExecutionPol
42614268
return __internal::__brick_mismatch(
42624269
__i, __j, __first2 + (__i - __first1), __first2 + (__j - __first1),
42634270
[&__comp](const _RefType1 __x, const _RefType2 __y) {
4264-
return !__comp(__x, __y) && !__comp(__y, __x);
4271+
return !std::invoke(__comp, __x, __y) && !std::invoke(__comp, __y, __x);
42654272
},
42664273
_IsVector{})
42674274
.first;
@@ -4270,11 +4277,11 @@ __pattern_lexicographical_compare(__parallel_tag<_IsVector> __tag, _ExecutionPol
42704277

42714278
if (__result == __last1 && __first2 + (__result - __first1) != __last2)
42724279
{ // if first sequence shorter than second
4273-
return !__comp(*(__first2 + (__result - __first1)), *__result);
4280+
return !std::invoke(__comp, *(__first2 + (__result - __first1)), *__result);
42744281
}
42754282
else
42764283
{ // if second sequence shorter than first or both have the same number of elements
4277-
return __comp(*__result, *(__first2 + (__result - __first1)));
4284+
return std::invoke(__comp, *__result, *(__first2 + (__result - __first1)));
42784285
}
42794286
});
42804287
}

include/oneapi/dpl/pstl/hetero/algorithm_impl_hetero.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,8 +1415,8 @@ struct __pattern_lexicographical_compare_transform_fn
14151415
auto const& __s1_val = __acc1[__gidx];
14161416
auto const& __s2_val = __acc2[__gidx];
14171417

1418-
::std::int32_t __is_s1_val_less = __comp(__s1_val, __s2_val);
1419-
::std::int32_t __is_s1_val_greater = __comp(__s2_val, __s1_val);
1418+
std::int32_t __is_s1_val_less = std::invoke(__comp, __s1_val, __s2_val);
1419+
std::int32_t __is_s1_val_greater = std::invoke(__comp, __s2_val, __s1_val);
14201420

14211421
// 1 if __s1_val < __s2_val, -1 if __s1_val < __s2_val, 0 if __s1_val == __s2_val
14221422
return _ReduceValueType{1 * __is_s1_val_less - 1 * __is_s1_val_greater};

0 commit comments

Comments
 (0)