Skip to content

Commit 1ca1f3f

Browse files
committed
Merge remote-tracking branch 'upstream/main' into syssched-R6-work
2 parents b793a00 + cbeffda commit 1ca1f3f

112 files changed

Lines changed: 1525 additions & 1118 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,12 @@ KeepEmptyLinesAtTheStartOfBlocks: true
8383
LambdaBodyIndentation: Signature
8484
LineEnding: LF
8585
Macros: [
86-
'STDEXEC_MEMFN_DECL(X)=X',
87-
'STDEXEC_MEMFN_DECL(X,Y)=X,Y',
88-
'STDEXEC_MEMFN_DECL(X,Y,Z)=X,Y,Z',
86+
'STDEXEC_MEMFN_DECL(...)=__VA_ARGS__',
8987
'STDEXEC_ATTRIBUTE(X)=[[]]',
90-
'STDEXEC_NO_UNIQUE_ADDRESS=[[no_unique_address]]',
9188
'STDEXEC_IMMOVABLE_NO_UNIQUE_ADDRESS=[[no_unique_address]]',
9289
'STDEXEC_MISSING_MEMBER(X,Y)=true',
93-
'STDEXEC_DEFINE_MEMBER(X)=void foo() {}'
90+
'STDEXEC_DEFINE_MEMBER(X)=void foo() {}',
91+
'STDEXEC_AUTO_RETURN(...)=->decltype(auto){ return __VA_ARGS__; }',
9492
]
9593
MaxEmptyLinesToKeep: 2
9694
NamespaceIndentation: All

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ HeaderFileExtensions:
77
- hh
88
- hpp
99
- hxx
10+
- cuh
1011
ImplementationFileExtensions:
1112
- c
1213
- cc

.clangd

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
# https://clangd.llvm.org/config
22

3-
# Apply a config conditionally to all C files
4-
If:
5-
PathMatch: .*\.(c|h)$
6-
7-
---
8-
93
# Apply a config conditionally to all C++ files except those in the
104
# include/execpools directory which need platform-dependent headers
115
If:
@@ -17,6 +11,7 @@ If:
1711
# Apply a config conditionally to all CUDA files
1812
If:
1913
PathMatch: .*\.cuh?$
14+
PathExclude: examples/nvexec/.*
2015
CompileFlags:
2116
Add:
2217
# Allow variadic CUDA functions
@@ -35,25 +30,28 @@ CompileFlags:
3530

3631
# Use clang++ in CUDA mode to provide intellisense for files with `nvexec` in their path
3732
If:
38-
PathMatch: (include|examples|test)/nvexec.*
33+
PathMatch: [include/nvexec/.*, test/nvexec/.*]
3934
CompileFlags:
4035
Compiler: clang++
4136
Add:
4237
- "-x"
4338
- "cuda"
4439
- "-std=gnu++20"
4540
- "-Wno-unknown-cuda-version"
41+
- "--cuda-host-only"
4642

4743
---
4844

4945
# Tweak the clangd parse settings for all files
5046
CompileFlags:
5147
CompilationDatabase: .
5248
Add:
49+
- "-DLIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE"
5350
# report all errors
5451
- "-ferror-limit=0"
5552
- "-fmacro-backtrace-limit=0"
5653
- "-ftemplate-backtrace-limit=0"
54+
- "-std=gnu++20"
5755
Remove:
5856
- "-stdpar*"
5957
# strip CUDA fatbin args
@@ -74,6 +72,7 @@ CompileFlags:
7472
- "--expt-relaxed-constexpr"
7573
- "-forward-unknown-to-host-compiler"
7674
- "-Werror=cross-execution-space-call"
75+
- "-e1000"
7776
Diagnostics:
7877
Suppress:
7978
- "variadic_device_fn"

.vscode/launch.json

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,61 +5,61 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "C++ Tests (lldb)",
9-
"type": "lldb",
8+
"name": "C++ Current Target (lldb-dap)",
9+
"type": "lldb-dap",
1010
"request": "launch",
11-
"stdio": null,
1211
"stopOnEntry": false,
13-
"terminal": "console",
14-
"console": "internalConsole",
15-
"sourceLanguages": ["cpp", "cuda"],
16-
"internalConsoleOptions": "neverOpen",
12+
"internalConsoleOptions": "openOnFirstSessionStart",
13+
"cwd": "${command:cmake.launchTargetDirectory}",
14+
"program": "${command:cmake.launchTargetPath}",
15+
"initCommands": [
16+
"settings set target.disable-aslr false"
17+
],
18+
"args": "${input:CXX_PROGRAM_ARGS}",
19+
},
20+
{
21+
"name": "C++ Tests (lldb-dap)",
22+
"type": "lldb-dap",
23+
"request": "launch",
24+
"stopOnEntry": false,
25+
"internalConsoleOptions": "openOnFirstSessionStart",
1726
"cwd": "${command:cmake.buildDirectory}",
18-
"relativePathBase": "${command:cmake.buildDirectory}",
1927
"program": "${command:cmake.buildDirectory}/${input:CXX_TEST_SUITE}",
20-
"initCommands": ["settings set target.disable-aslr false"],
21-
"args": ["-v", "normal", "${input:CXX_TEST_TAGS}"],
28+
"initCommands": [
29+
"settings set target.disable-aslr false"
30+
],
31+
"args": [
32+
"-v",
33+
"normal",
34+
"${input:CXX_TEST_TAGS}"
35+
],
2236
},
2337
{
24-
"name": "CUDA Tests (cuda-gdb)",
38+
"name": "CUDA Current Target (cuda-gdb)",
2539
"type": "cuda-gdb",
2640
"request": "launch",
2741
"stopAtEntry": false,
2842
"breakOnLaunch": false,
29-
"internalConsoleOptions": "neverOpen",
30-
"program": "${command:cmake.buildDirectory}/${input:CUDA_TEST_SUITE}",
31-
"cwd": "${command:cmake.buildDirectory}",
32-
"args": "-v normal ${input:CUDA_TEST_TAGS}",
33-
},
34-
{
35-
"name": "C++ Current Target (lldb)",
36-
"type": "lldb",
37-
"request": "launch",
38-
"stdio": null,
39-
"stopOnEntry": false,
40-
"terminal": "console",
41-
"console": "internalConsole",
42-
"sourceLanguages": ["cpp", "cuda"],
43-
"internalConsoleOptions": "neverOpen",
44-
"cwd": "${command:cmake.launchTargetDirectory}",
45-
"relativePathBase": "${command:cmake.launchTargetDirectory}",
43+
"internalConsoleOptions": "openOnFirstSessionStart",
4644
"program": "${command:cmake.launchTargetPath}",
47-
"initCommands": ["settings set target.disable-aslr false"],
45+
"cwd": "${command:cmake.launchTargetDirectory}",
4846
"args": "${input:CXX_PROGRAM_ARGS}",
4947
},
5048
{
51-
"name": "CUDA Current Target (cuda-gdb)",
49+
"name": "CUDA Tests (cuda-gdb)",
5250
"type": "cuda-gdb",
5351
"request": "launch",
5452
"stopAtEntry": false,
5553
"breakOnLaunch": false,
56-
"internalConsoleOptions": "neverOpen",
57-
"program": "${command:cmake.launchTargetPath}",
58-
"cwd": "${command:cmake.launchTargetDirectory}",
59-
"args": "${input:CXX_PROGRAM_ARGS}",
54+
"internalConsoleOptions": "openOnSessionStart",
55+
"program": "${command:cmake.buildDirectory}/${input:CUDA_TEST_SUITE}",
56+
"cwd": "${command:cmake.buildDirectory}",
57+
"args": "-v normal ${input:CUDA_TEST_TAGS}",
6058
},
6159
],
6260
"inputs": [
61+
// These require the Tasks Shell Input extension:
62+
// https://marketplace.visualstudio.com/items?itemName=augustocdias.tasks-shell-input
6363
{
6464
"id": "CXX_PROGRAM_ARGS",
6565
"type": "promptString",
@@ -109,4 +109,4 @@
109109
}
110110
},
111111
],
112-
}
112+
}

examples/benchmark/static_thread_pool_bulk_enqueue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct RunThread {
4545
auto env = exec::make_env(stdexec::prop{stdexec::get_allocator, alloc});
4646
auto [start, end] = exec::_pool_::even_share(total_scheds, tid, pool.available_parallelism());
4747
auto iterate = exec::schedule_all(pool, std::views::iota(start, end))
48-
| exec::ignore_all_values() | exec::write(env);
48+
| exec::ignore_all_values() | exec::write_env(env);
4949
# else
5050
auto [start, end] = exec::_pool_::even_share(total_scheds, tid, pool.available_parallelism());
5151
auto iterate = exec::schedule_all(pool, std::views::iota(start, end))

examples/benchmark/static_thread_pool_bulk_enqueue_nested.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct RunThread {
4646
auto env = exec::make_env(stdexec::prop{stdexec::get_allocator, alloc});
4747
auto [start, end] = exec::_pool_::even_share(total_scheds, tid, pool.available_parallelism());
4848
auto iterate = exec::iterate(std::views::iota(start, end)) | exec::ignore_all_values()
49-
| exec::write(env);
49+
| exec::write_env(env);
5050
# else
5151
auto [start, end] = exec::_pool_::even_share(total_scheds, tid, pool.available_parallelism());
5252
auto iterate = exec::iterate(std::views::iota(start, end)) | exec::ignore_all_values();

examples/nvexec/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ function(def_cpu_example example)
9292
stdexec_executable_flags
9393
)
9494
set_source_files_properties(${source} PROPERTIES LANGUAGE ${_lang_cxx})
95+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
96+
target_link_options(${target} PRIVATE -lc++abi -ltbb)
97+
endif()
9598
endfunction()
9699

97100
foreach(example ${nvexec_cpu_examples})

examples/nvexec/_clangd_helper_file.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
// than those in the parent (for example, if the subdirectory has a CMakeList.txt that defines additional executables).
2929
// This ensures clangd provides useful intellisense for headers in any subdirectory with a CMakeList.txt.
3030

31-
int main(void) {
31+
auto main() -> int {
3232
}

examples/nvexec/bulk.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
namespace ex = stdexec;
2323

24-
int main() {
24+
auto main() -> int {
2525
using nvexec::is_on_gpu;
2626

2727
nvexec::stream_context stream_ctx{};

examples/nvexec/launch.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
#include <algorithm>
1718
#include <nvexec/stream_context.cuh>
1819
#include <stdexec/execution.hpp>
1920

@@ -26,16 +27,18 @@ constexpr std::size_t N = 2 * 1024;
2627
constexpr std::size_t THREAD_BLOCK_SIZE = 128u;
2728
constexpr std::size_t NUM_BLOCKS = (N + THREAD_BLOCK_SIZE - 1) / THREAD_BLOCK_SIZE;
2829

29-
#define scaling 2
30+
enum {
31+
scaling = 2
32+
};
3033

31-
int bench() {
34+
auto bench() -> int {
3235
std::vector<int> input(N, 0);
3336
std::iota(input.begin(), input.end(), 1);
34-
std::transform(input.begin(), input.end(), input.begin(), [](int i) { return i * scaling; });
37+
std::ranges::transform(input, input.begin(), [](int i) { return i * scaling; });
3538
return std::accumulate(input.begin(), input.end(), 0);
3639
}
3740

38-
int main() {
41+
auto main() -> int {
3942
thrust::device_vector<int> input(N, 0);
4043
std::iota(input.begin(), input.end(), 1);
4144
int* first = thrust::raw_pointer_cast(input.data());
@@ -45,7 +48,7 @@ int main() {
4548

4649
auto snd = stdexec::transfer_just(stream.get_scheduler(), first, last)
4750
| nvexec::launch(
48-
{NUM_BLOCKS, THREAD_BLOCK_SIZE},
51+
{.grid_size = NUM_BLOCKS, .block_size = THREAD_BLOCK_SIZE},
4952
[](cudaStream_t stm, int* first, int* last) {
5053
assert(nvexec::is_on_gpu());
5154
int32_t idx = blockIdx.x * blockDim.x + threadIdx.x;

0 commit comments

Comments
 (0)