Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Revert "Merge remote-tracking branch 'origin/main' into type-traits-b…
Browse files Browse the repository at this point in the history
…ackport"

This reverts commit 13df8ca, reversing
changes made to 2f8a182.
  • Loading branch information
jrhemstad committed Oct 30, 2020
1 parent 2f212ba commit 30cdf58
Show file tree
Hide file tree
Showing 26 changed files with 334 additions and 434 deletions.
2 changes: 1 addition & 1 deletion .upstream-tests/utils/nvidia/nvrtc/nvrtc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ cg_include_dir=$(
| xargs dirname)
ext_include_dir=$(
echo '#include <cuda/pipeline>' \
| ${nvcc} -x cu - -M -E "${includes[@]}" -arch sm_70 -std=c++11 \
| ${nvcc} -x cu - -M -E "${includes[@]}" -arch sm_70 \
| grep -e ' /.*/cuda/pipeline' -o \
| xargs dirname | xargs dirname)

Expand Down
147 changes: 145 additions & 2 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,115 @@ defaults:
values:
title: Overview
nav_order: 0
-
scope:
path: setup.md
values:
has_children: true
has_toc: true
nav_order: 1
-
scope:
path: setup/requirements.md
values:
parent: Setup
nav_order: 0
-
scope:
path: setup/getting.md
values:
parent: Setup
nav_order: 1
-
scope:
path: setup/building_and_testing.md
values:
parent: Setup
nav_order: 2
-
scope:
path: api.md
values:
has_children: true
has_toc: false
nav_order: 2
-
scope:
path: api/synchronization_library.md
values:
parent: API
has_children: true
has_toc: false
nav_order: 0
-
scope:
path: api/synchronization_library/header_table.md
values:
parent: API
nav_exclude: true
-
scope:
path: api/synchronization_library/thread_scopes.md
values:
grand_parent: API
parent: Synchronization Library
nav_order: 0
-
scope:
path: api/synchronization_library/atomic.md
values:
grand_parent: API
parent: Synchronization Library
nav_order: 1
-
scope:
path: api/synchronization_library/barrier.md
values:
grand_parent: API
parent: Synchronization Library
nav_order: 2
-
scope:
path: api/synchronization_library/latch.md
values:
grand_parent: API
parent: Synchronization Library
nav_order: 3
-
scope:
path: api/synchronization_library/semaphore.md
values:
grand_parent: API
parent: Synchronization Library
nav_order: 4
-
scope:
path: api/time_library.md
values:
parent: API
has_children: true
has_toc: false
nav_order: 1
-
scope:
path: api/time_library/header_table.md
values:
parent: API
nav_exclude: true
-
scope:
path: api/time_library/chrono.md
values:
grand_parent: API
parent: Time Library
-
scope:
path: api/utility_library.md
values:
parent: API
has_children: true
has_toc: false
nav_order: 2
-
scope:
path: api/utility_library/header_table.md
Expand All @@ -46,7 +143,53 @@ defaults:
nav_exclude: true
-
scope:
path: contributing/code_of_conduct.md
path: api/utility_library/functional.md
values:
parent: Contributing
grand_parent: API
parent: Utility Library
nav_order: 0
-
scope:
path: api/utility_library/tuple.md
values:
grand_parent: API
parent: Utility Library
nav_order: 2
-
scope:
path: api/utility_library/utility.md
values:
grand_parent: API
parent: Utility Library
nav_order: 3
-
scope:
path: api/utility_library/version.md
values:
grand_parent: API
parent: Utility Library
nav_order: 4
-
scope:
path: releases.md
values:
has_children: true
has_toc: true
nav_order: 3
-
scope:
path: releases/*
values:
parent: Releases
-
scope:
path: contributing.md
values:
has_children: true
has_toc: true
nav_order: 4
-
scope:
path: contributing/*
values:
parent: Contributing
6 changes: 0 additions & 6 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
---
has_children: true
has_toc: false
nav_order: 2
---

# API

Any header not listed below is omitted.
Expand Down
17 changes: 2 additions & 15 deletions docs/api/synchronization_library.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
---
parent: API
has_children: true
has_toc: false
nav_order: 0
---

# Synchronization Library

Most synchronization primitives have an additional thread scope template
parameter, which defines the set of threads that may interact with the object.
Most synchronization primitives have an additional thread scope template parameter,
which defines the set of threads that may interact with the object.
Please see the [thread scope section] for more details.

Any header not listed below is omitted.

*: Some the Standard C++ facilities in this header are omitted, see the libcu++
Addendum for details.

{% include_relative synchronization_library/header_table.md %}


[thread scope section]: ./synchronization_library/thread_scopes.md

77 changes: 29 additions & 48 deletions docs/api/synchronization_library/atomic.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,56 @@
---
grand_parent: API
parent: Synchronization Library
nav_order: 1
---

# `<cuda/std/atomic>`, `<cuda/atomic>`

## Extensions
## Extensions in the `cuda::` namespace

The class template `atomic` takes an additional [thread scope] argument,
defaulted to `thread_scope_system`.
The class template `atomic` takes an additional scope argument, defaulted to `thread_scope_system`.

```c++
// This atomic is suitable for all threads in the system.
cuda::atomic<int, cuda::thread_scope_system> a;
// This object is atomic for all threads in the system
cuda::atomic<int> a;

// This atomic has the same type as the previous one (`a`).
cuda::atomic<int> b;
// This object has the same type as the previous
cuda::atomic<int, cuda::thread_scope_system> b;

// This atomic is suitable for threads in the same thread block.
cuda::atomic<int, cuda::thread_scope_block> c;
// This object is atomic for threads in the same thread block
cuda::atomic<int, cuda::thread_scope_block> c;
```

The `atomic` class template specializations for integral and pointer types are
extended with members `fetch_min` and `fetch_max`.
These conform to the requirements in section [atomics.types.int] and
[atomics.types.pointer] of ISO/IEC IS 14882 (the C++ Standard),
with keys _min_ and _max_, and operations `min` and `max`, respectively.
The `atomic` class template specializations for integral and pointer types are extended with members `fetch_min` and `fetch_max`. These conform to the requirements in `[atomics.types.int]` and `[atomics.types.pointer]`, with keys _min_ and _max_, and operations `min` and `max`, respectively.

Note that conformance to these requirements include implicit conversions to
unsigned types, if applicable.
Note that conformance to these requirements include implicit conversions to unsigned types, if applicable.

```c++
cuda::atomic<int> a(1);
auto x = a.fetch_min(0); // Operates as if unsigned.
cuda::atomic<int> a(1);
auto x = a.fetch_min(0); // operates as if unsigned
auto y = a.load();
assert(x == 1 && y == 0);
```
## Restrictions
## Omissions
An object of type `atomic` shall not be accessed concurrently by CPU and GPU
threads unless:
- it is in unified memory and the [`concurrentManagedAccess` property] is 1, or
- it is in CPU memory and the [`hostNativeAtomicSupported` property] is 1.
None relative to libcxx.
Note, for objects of scopes other than `thread_scope_system` this is a
data-race, and thefore also prohibited regardless of memory characteristics.
## Restrictions
Under CUDA Compute Capability 6 (Pascal), an object of type `atomic` may not be
used:
- with automatic storage duration, or
- if `is_always_lock_free()` is `false`.
An object of type `atomic` shall not be accessed concurrently by CPU and GPU threads unless:
1. it is in managed memory, with `concurrentManagedAccess==1`, or
2. it is in host memory, with `hostNativeAtomicSupported==1`.
Under CUDA Compute Capability prior to 6 (Pascal), objects of type `atomic` may
not be used.
(Note, for objects of scopes other than `thread_scope_system` this is a data-race, and thefore also prohibited regardless of memory characteristics.)
## Implementation-Defined Behavior
Under Compute Capability 6, an object of type `atomic` may not be used:
1. with automatic storage duration, or
2. if `is_always_lock_free()` returns `false`.
For each type `T` and [thread scope] `S`, the value of
`atomic<T, S>::is_always_lock_free()` is as follows:
Under Compute Capability prior to 6, objects of type `atomic` may not be used.
|Type `T`|Thread Scope `S`|`atomic<T, S>::is_always_lock_free()`|
|--------|----------------|-------------------------------------|
|Any |Any |`sizeof(T) <= 8` |
## Implementation-Defined Behavior
For each type `T` and scope `S`, the value of `atomic<T,S>::is_always_lock_free()` is as follows:
[thread scope]: ./thread_scopes.md
|Type `T`|Scope `S`|`atomic<T,S>::is_always_lock_free()`|
|-|-|-|
|Any|Any|`sizeof(T) <= 8`|
[atomics.types.int]: https://eel.is/c++draft/atomics.types.int
[atomics.types.pointer]: https://eel.is/c++draft/atomics.types.pointer
[`concurrentManagedAccess` property]: https://docs.nvidia.com/cuda/cuda-runtime-api/structcudaDeviceProp.html#structcudaDeviceProp_116f9619ccc85e93bc456b8c69c80e78b
[`hostNativeAtomicSupported` property]: https://docs.nvidia.com/cuda/cuda-runtime-api/structcudaDeviceProp.html#structcudaDeviceProp_1ef82fd7d1d0413c7d6f33287e5b6306f
Objects in namespace `cuda::std::` have the same behavior as corresponding objects in namespace `cuda::` when instantiated with a scope of `cuda::thread_scope_system`.
Loading

0 comments on commit 30cdf58

Please sign in to comment.