in include/unifex/bulk_schedule.hpp [54:127]
void set_value()
noexcept(is_nothrow_receiver_of_v<Receiver> &&
is_nothrow_next_receiver_v<Receiver, Integral>) {
using policy_t = decltype(get_execution_policy(receiver_));
auto stop_token = get_stop_token(receiver_);
const bool stop_possible = !is_stop_never_possible_v<decltype(stop_token)> && stop_token.stop_possible();
if(stop_possible) {
for (Integral chunk_start(0); chunk_start < count_; chunk_start += bulk_cancellation_chunk_size) {
if(stop_token.stop_requested()) {
unifex::set_done(std::move(receiver_));
return;
}
Integral chunk_end = std::min(chunk_start + static_cast<Integral>(bulk_cancellation_chunk_size), count_);
if constexpr (is_one_of_v<policy_t, unsequenced_policy, parallel_unsequenced_policy>) {
UNIFEX_DIAGNOSTIC_PUSH
// Vectorisable version
#if defined(__clang__)
// When optimizing for size (e.g. with -Oz), Clang will not
// vectorize this loop, and will emit a warning. There's
// nothing to be done about the warning, though, so just
// suppress it.
#pragma clang diagnostic ignored "-Wpass-failed"
#pragma clang loop vectorize(enable) interleave(enable)
#elif defined(__GNUC__)
#pragma GCC ivdep
#elif defined(_MSC_VER)
#pragma loop(ivdep)
#endif
for (Integral i(chunk_start); i < chunk_end; ++i) {
unifex::set_next(receiver_, Integral(i));
}
UNIFEX_DIAGNOSTIC_POP
} else {
// Sequenced version
for (Integral i(chunk_start); i < chunk_end; ++i) {
unifex::set_next(receiver_, Integral(i));
}
}
}
} else {
if constexpr (is_one_of_v<policy_t, unsequenced_policy, parallel_unsequenced_policy>) {
UNIFEX_DIAGNOSTIC_PUSH
// Vectorisable version
#if defined(__clang__)
// When optimizing for size (e.g. with -Oz), Clang will not
// vectorize this loop, and will emit a warning. There's
// nothing to be done about the warning, though, so just
// suppress it.
#pragma clang diagnostic ignored "-Wpass-failed"
#pragma clang loop vectorize(enable) interleave(enable)
#elif defined(__GNUC__)
#pragma GCC ivdep
#elif defined(_MSC_VER)
#pragma loop(ivdep)
#endif
for (Integral i(0); i < count_; ++i) {
unifex::set_next(receiver_, Integral(i));
}
UNIFEX_DIAGNOSTIC_POP
} else {
// Sequenced version
for (Integral i(0); i < count_; ++i) {
unifex::set_next(receiver_, Integral(i));
}
}
}
unifex::set_value(std::move(receiver_));
}