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
8 changes: 5 additions & 3 deletions .github/workflows/ci.cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ jobs:
- { name: "CPU (clang 16, Debug, TSAN)", build: "Debug", tag: llvm16-cuda12.9, cxxstd: "20", cxxflags: "-fsanitize=thread" }
- { name: "CPU (clang 16, Release)", build: "Release", tag: llvm16-cuda12.9, cxxstd: "20", cxxflags: "-stdlib=libc++" }
- { name: "CPU (clang 16, Release, ASAN)", build: "Release", tag: llvm16-cuda12.9, cxxstd: "20", cxxflags: "-stdlib=libc++ -fsanitize=address -fsanitize-ignorelist=/home/coder/stdexec/sanitizer-ignorelist.txt" }
- { name: "CPU (gcc 11, Debug)", build: "Debug", tag: gcc11-cuda12.9, cxxstd: "20", cxxflags: "", }
- { name: "CPU (gcc 11, Release)", build: "Release", tag: gcc11-cuda12.9, cxxstd: "20", cxxflags: "", }
- { name: "CPU (gcc 11, Release, ASAN)", build: "Release", tag: gcc11-cuda12.9, cxxstd: "20", cxxflags: "-fsanitize=address" }
- { name: "CPU (gcc 12, Debug)", build: "Debug", tag: gcc12-cuda12.9, cxxstd: "20", cxxflags: "", }
- { name: "CPU (gcc 12, Release)", build: "Release", tag: gcc12-cuda12.9, cxxstd: "20", cxxflags: "", }
# With the following config, 2 tests mysteriously time out, but only in CI and not locally.
# - { name: "CPU (gcc 12, Release, ASAN)", build: "Release", tag: gcc12-cuda12.9, cxxstd: "20", cxxflags: "-fsanitize=address" }
- { name: "CPU (gcc 12, Release, TSAN)", build: "Release", tag: gcc12-cuda12.9, cxxstd: "20", cxxflags: "-fsanitize=thread" }
- { name: "CPU (gcc 13, Debug)", build: "Debug", tag: gcc13-cuda12.9, cxxstd: "20", cxxflags: "", }
- { name: "CPU (gcc 14, Debug)", build: "Debug", tag: gcc14-cuda12.9, cxxstd: "20", cxxflags: "", }
- { name: "CPU (gcc 14, Debug, ASAN)", build: "Debug", tag: gcc14-cuda12.9, cxxstd: "20", cxxflags: "-fsanitize=address" }
- { name: "CPU (gcc 14, Debug, TSAN)", build: "Debug", tag: gcc14-cuda12.9, cxxstd: "20", cxxflags: "-fsanitize=thread" }
- { name: "CPU (gcc 14, Release, ASAN)", build: "Release", tag: gcc14-cuda12.9, cxxstd: "20", cxxflags: "-fsanitize=address" }
- { name: "CPU (gcc 14, Release, LEAK)", build: "Release", tag: gcc14-cuda12.9, cxxstd: "20", cxxflags: "-fsanitize=leak", }
- { name: "CPU (gcc 14, Release, c++23)", build: "Release", tag: gcc14-cuda12.9, cxxstd: "23", cxxflags: "", }
container:
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ set(BUILD_TESTING ${STDEXEC_BUILD_TESTS})
if (STDEXEC_BUILD_TESTS)
# CTest automatically calls enable_testing() if BUILD_TESTING is ON
# https://cmake.org/cmake/help/latest/module/CTest.html#module:CTest
list(APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure")
include(CTest)
endif()

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ below](#nvhpc-sdk) for more details).
`stdexec` requires compiling with C++20 (`-std=c++20`) but otherwise does not have any
dependencies and only requires a sufficiently new compiler:

- gcc 11+
- gcc 12+
- clang 16+
- MSVC 14.43+
- XCode 16+
Expand Down
2 changes: 2 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ function(def_example example)
PRIVATE STDEXEC::stdexec
stdexec_executable_flags
$<TARGET_NAME_IF_EXISTS:TBB::tbb>)
target_compile_options(${target} INTERFACE
$<$<CXX_COMPILER_ID:GNU>:-Wno-maybe-uninitialized>) # warnings being emitted from stdlib headers, why?
endfunction()

set(stdexec_examples
Expand Down
16 changes: 8 additions & 8 deletions include/stdexec/__detail/__as_awaitable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <functional> // for std::identity
#include <system_error>
#include <thread>
#include <variant>

STDEXEC_PRAGMA_PUSH()
STDEXEC_PRAGMA_IGNORE_GNU("-Wmissing-braces")
Expand Down Expand Up @@ -307,8 +306,7 @@ namespace STDEXEC
}

constexpr auto
await_suspend([[maybe_unused]] __std::coroutine_handle<_Promise> __hcoro) noexcept //
-> __std::coroutine_handle<>
await_suspend([[maybe_unused]] __std::coroutine_handle<_Promise> __hcoro) noexcept -> bool
{
STDEXEC_ASSERT(this->__continuation_ == __hcoro);

Expand All @@ -330,14 +328,14 @@ namespace STDEXEC
// The operation completed inline with set_value or set_error, so we can just
// resume the current coroutine. await_resume will either return the value or
// throw as appropriate.
return __hcoro;
return false;
}
else
{
// If __ready_ was still false when executing the CAS, then the operation did not
// complete inline. The continuation will be resumed when the operation
// completes, so we return a noop_coroutine to suspend the current coroutine.
return __std::noop_coroutine();
return true;
}
}

Expand All @@ -363,7 +361,7 @@ namespace STDEXEC
{}

auto await_suspend([[maybe_unused]] __std::coroutine_handle<_Promise> __hcoro)
-> __std::coroutine_handle<>
-> STDEXEC_PP_IF(STDEXEC_GCC(), bool, __std::coroutine_handle<>)
{
STDEXEC_ASSERT(this->__continuation_ == __hcoro);
{
Expand All @@ -379,14 +377,16 @@ namespace STDEXEC
// unhandled_stopped() on the promise to propagate the stop signal. That will
// result in the coroutine being torn down, so beware. We then resume the
// returned coroutine handle (which may be a noop_coroutine).
return __hcoro.promise().unhandled_stopped();
return STDEXEC_PP_IF(STDEXEC_GCC(),
(__hcoro.promise().unhandled_stopped().resume(), true),
__hcoro.promise().unhandled_stopped());
}
else
{
// The operation completed with set_value or set_error, so we can just resume
// the current coroutine. await_resume will either return the value or throw as
// appropriate.
return __hcoro;
return STDEXEC_PP_IF(STDEXEC_GCC(), false, __hcoro);
}
}

Expand Down
6 changes: 6 additions & 0 deletions include/stdexec/__detail/__task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,17 @@ namespace STDEXEC
return __attrs{};
}

# if !STDEXEC_GCC()
// This transforms a task into an __awaiter that can perform symmetric transfer when
// co_awaited. It is disabled on GCC due to
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94794, which causes unbounded stack
// growth.
template <class _ParentPromise>
constexpr auto as_awaitable(_ParentPromise& __parent) && noexcept
{
return __awaiter<_ParentPromise>(static_cast<task&&>(*this), __parent);
}
# endif

private:
using __on_stopped_t = __forward_stop_request<stop_source_type>;
Expand Down
12 changes: 8 additions & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ set_target_properties(common_test_settings PROPERTIES
target_include_directories(common_test_settings INTERFACE "${CMAKE_CURRENT_LIST_DIR}")
target_compile_definitions(common_test_settings INTERFACE STDEXEC_NAMESPACE=std::execution)
target_compile_options(common_test_settings INTERFACE
$<$<CXX_COMPILER_ID:MSVC>:/wd4714>) # function marked as __forceinline not inlined
$<$<CXX_COMPILER_ID:MSVC>:/wd4714> # function marked as __forceinline not inlined
$<$<CXX_COMPILER_ID:GNU>:-Wno-maybe-uninitialized> # warnings being emitted from stdlib headers, why?
)
target_link_libraries(common_test_settings INTERFACE $<TARGET_NAME_IF_EXISTS:TBB::tbb>)
# target_compile_definitions(
# common_test_settings INTERFACE
Expand Down Expand Up @@ -133,10 +135,12 @@ include(${Catch2_SOURCE_DIR}/contrib/Catch.cmake)
# For testing that builds fail as expected
include(${icm_SOURCE_DIR}/icm_build_failure_testing.cmake)

catch_discover_tests(test.stdexec)
catch_discover_tests(test.scratch)
catch_discover_tests(test.stdexec PROPERTIES TIMEOUT 30)

catch_discover_tests(test.scratch PROPERTIES TIMEOUT 30)

if(STDEXEC_BUILD_SYSTEM_CONTEXT AND NOT STDEXEC_ENABLE_CUDA)
catch_discover_tests(test.system_context_replaceability)
catch_discover_tests(test.system_context_replaceability PROPERTIES TIMEOUT 30)
endif()

add_subdirectory(exec)
Expand Down
2 changes: 1 addition & 1 deletion test/exec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ target_link_libraries(test.exec
common_test_settings)

# Discover the Catch2 test built by the application
catch_discover_tests(test.exec)
catch_discover_tests(test.exec PROPERTIES TIMEOUT 30)

if(STDEXEC_ENABLE_ASIO)
add_subdirectory(asio)
Expand Down
2 changes: 1 addition & 1 deletion test/exec/asio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ target_link_libraries(test.asioexec
PRIVATE
common_test_settings)

catch_discover_tests(test.asioexec)
catch_discover_tests(test.asioexec PROPERTIES TIMEOUT 30)
2 changes: 1 addition & 1 deletion test/exec/taskflow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ target_link_libraries(test.taskflowexec
PRIVATE
common_test_settings)

catch_discover_tests(test.taskflowexec)
catch_discover_tests(test.taskflowexec PROPERTIES TIMEOUT 30)
2 changes: 1 addition & 1 deletion test/exec/tbb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ target_link_libraries(test.tbbexec
PRIVATE
common_test_settings)

catch_discover_tests(test.tbbexec)
catch_discover_tests(test.tbbexec PROPERTIES TIMEOUT 30)
2 changes: 1 addition & 1 deletion test/nvexec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ target_link_libraries(test.nvexec
# target_compile_options(test.nvexec PRIVATE "-ftemplate-backtrace-limit=9999")
# endif()

catch_discover_tests(test.nvexec)
catch_discover_tests(test.nvexec PROPERTIES TIMEOUT 30)
18 changes: 18 additions & 0 deletions test/rrd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
include(FetchContent)

# Relacy has its own runtime checks and does not compose with compiler sanitizers.
# Strip any -fsanitize* flags in this directory so Relacy-linked targets run cleanly.
function(_stdexec_strip_sanitize_flags out_var in_value)
separate_arguments(_flags UNIX_COMMAND "${in_value}")
list(FILTER _flags EXCLUDE REGEX "^-fsanitize")
string(JOIN " " _joined ${_flags})
set(${out_var} "${_joined}" PARENT_SCOPE)
endfunction()

foreach(_cfg "" "_DEBUG" "_RELEASE" "_RELWITHDEBINFO" "_MINSIZEREL")
set(_var "CMAKE_CXX_FLAGS${_cfg}")
if(DEFINED ${_var} AND NOT "${${_var}}" STREQUAL "")
_stdexec_strip_sanitize_flags(_stripped "${${_var}}")
set(${_var} "${_stripped}")
endif()
endforeach()

FetchContent_Declare(
relacy
GIT_REPOSITORY https://github.com/dvyukov/relacy
Expand Down Expand Up @@ -29,6 +46,7 @@ function(add_relacy_test target_name)
CXX_EXTENSIONS OFF)

add_test(NAME relacy-${target_name} COMMAND ${target_name})
set_tests_properties(relacy-${target_name} PROPERTIES TIMEOUT 120)
endfunction()

set(relacy_tests
Expand Down
5 changes: 0 additions & 5 deletions test/stdexec/types/test_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@ namespace
CHECK(i == 42);
}

# if !STDEXEC_GCC() || (STDEXEC_GCC_VERSION >= 13'00 && defined(__OPTIMIZE__))
// This test is disabled on GCC due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94794

auto sync() -> ex::task<int>
{
co_return 42;
Expand Down Expand Up @@ -281,8 +278,6 @@ namespace
CHECK(i == 84'000'042);
}

# endif

// FUTURE TODO: add support so that `co_await sndr` can return a reference.
// auto test_task_awaits_just_ref_sender() -> ex::task<void> {
// int value = 42;
Expand Down
Loading