Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/nvexec/stream/common.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ namespace nv::execution
{
// The stream_domain is how the stream scheduler customizes the sender algorithms. All of the
// algorithms use the current scheduler's domain to transform senders before starting them.
struct stream_domain : STDEXEC::default_domain
struct stream_domain
{
template <::exec::sender_for Sender, class Tag = STDEXEC::tag_of_t<Sender>, class Env>
requires _strm::has_stream_transform<Sender, Env>
Expand Down
21 changes: 7 additions & 14 deletions include/stdexec/__detail/__domain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,10 @@ namespace STDEXEC
//! @c default_domain when passed the same arguments. The concept is modeled when either
//! of the following is
template <class _Domain, class _OpTag, class _Sndr, class _Env>
concept __default_domain_like = __same_as<
__decay_t<__detail::__transform_sender_result_t<default_domain, _OpTag, _Sndr, _Env>>,
__decay_t<__mcall<
__mtry_catch_q<
__detail::__transform_sender_result_t,
__mconst<__detail::__transform_sender_result_t<default_domain, _OpTag, _Sndr, _Env>>>,
_Domain,
_OpTag,
_Sndr,
_Env>>>;
concept __default_domain_like =
(!__detail::__has_transform_sender<_Domain, _OpTag, _Sndr, _Env>)
|| __same_as<__detail::__transform_sender_result_t<_Domain, _OpTag, _Sndr, _Env>,
__detail::__transform_sender_result_t<default_domain, _OpTag, _Sndr, _Env>>;

template <class... _Domains>
struct indeterminate_domain
Expand All @@ -127,15 +121,14 @@ namespace STDEXEC
//! same arguments. If this check fails, the @c static_assert triggers with: "ERROR:
//! indeterminate domains: cannot pick an algorithm customization"
template <class _OpTag, class _Sndr, class _Env>
requires __detail::__has_transform_sender<tag_of_t<_Sndr>, _OpTag, _Sndr, _Env>
[[nodiscard]]
static constexpr auto transform_sender(_OpTag, _Sndr &&__sndr, _Env const &__env)
noexcept(__detail::__has_nothrow_transform_sender<tag_of_t<_Sndr>, _OpTag, _Sndr, _Env>)
-> __detail::__transform_sender_result_t<tag_of_t<_Sndr>, _OpTag, _Sndr, _Env>
noexcept(__detail::__has_nothrow_transform_sender<default_domain, _OpTag, _Sndr, _Env>)
-> __detail::__transform_sender_result_t<default_domain, _OpTag, _Sndr, _Env>
{
static_assert((__default_domain_like<_Domains, _OpTag, _Sndr, _Env> && ...),
"ERROR: indeterminate domains: cannot pick an algorithm customization");
return tag_of_t<_Sndr>{}.transform_sender(_OpTag{}, static_cast<_Sndr &&>(__sndr), __env);
return default_domain().transform_sender(_OpTag{}, static_cast<_Sndr &&>(__sndr), __env);
}
};

Expand Down
14 changes: 14 additions & 0 deletions test/nvexec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,17 @@ target_link_libraries(test.nvexec
# endif()

catch_discover_tests(test.nvexec PROPERTIES TIMEOUT 30)

icm_add_build_failure_test(
NAME when_all_fail
TARGET when_all_fail
SOURCES PARSE when_all_fail.cpp
LIBRARIES stdexec nvexec
FOLDER test
)
set_target_properties(when_all_fail
PROPERTIES
LANGUAGE CUDA
LINKER_LANGUAGE CUDA)
target_compile_options(when_all_fail PRIVATE
$<$<CXX_COMPILER_ID:Clang>:-x cuda>)
35 changes: 35 additions & 0 deletions test/nvexec/when_all_fail.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2021-2024 NVIDIA Corporation
*
* Licensed under the Apache License Version 2.0 with LLVM Exceptions
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://llvm.org/LICENSE.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <stdexec/execution.hpp>

#include <exec/single_thread_context.hpp>
#include <nvexec/stream_context.cuh>

namespace ex = STDEXEC;

auto main() -> int
{
nvexec::stream_context stream_ctx{};
exec::single_thread_context thread_ctx{};

auto sndr = ex::when_all(ex::schedule(stream_ctx.get_scheduler()),
ex::schedule(thread_ctx.get_scheduler()))
| ex::continues_on(thread_ctx.get_scheduler());

// build error: ERROR: indeterminate domains: cannot pick an algorithm customization
ex::sync_wait(std::move(sndr));
}
Loading