diff --git a/include/nvexec/stream/common.cuh b/include/nvexec/stream/common.cuh index f32f06a1e..1e2a03ac5 100644 --- a/include/nvexec/stream/common.cuh +++ b/include/nvexec/stream/common.cuh @@ -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, class Env> requires _strm::has_stream_transform diff --git a/include/stdexec/__detail/__domain.hpp b/include/stdexec/__detail/__domain.hpp index 5cd90ceb5..627822aa0 100644 --- a/include/stdexec/__detail/__domain.hpp +++ b/include/stdexec/__detail/__domain.hpp @@ -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 - concept __default_domain_like = __same_as< - __decay_t<__detail::__transform_sender_result_t>, - __decay_t<__mcall< - __mtry_catch_q< - __detail::__transform_sender_result_t, - __mconst<__detail::__transform_sender_result_t>>, - _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>; template struct indeterminate_domain @@ -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 - requires __detail::__has_transform_sender, _OpTag, _Sndr, _Env> [[nodiscard]] static constexpr auto transform_sender(_OpTag, _Sndr &&__sndr, _Env const &__env) - noexcept(__detail::__has_nothrow_transform_sender, _OpTag, _Sndr, _Env>) - -> __detail::__transform_sender_result_t, _OpTag, _Sndr, _Env> + noexcept(__detail::__has_nothrow_transform_sender) + -> __detail::__transform_sender_result_t { 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); } }; diff --git a/test/nvexec/CMakeLists.txt b/test/nvexec/CMakeLists.txt index f178ebdba..5f7777676 100644 --- a/test/nvexec/CMakeLists.txt +++ b/test/nvexec/CMakeLists.txt @@ -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 + $<$:-x cuda>) diff --git a/test/nvexec/when_all_fail.cpp b/test/nvexec/when_all_fail.cpp new file mode 100644 index 000000000..d99e30edd --- /dev/null +++ b/test/nvexec/when_all_fail.cpp @@ -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 + +#include +#include + +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)); +}