Skip to content

Add c10::Stream, make at::cuda::CUDAStream use it.#13133

Closed
ezyang wants to merge 33 commits intomasterfrom
export-D10855883
Closed

Add c10::Stream, make at::cuda::CUDAStream use it.#13133
ezyang wants to merge 33 commits intomasterfrom
export-D10855883

Conversation

@ezyang
Copy link
Copy Markdown
Contributor

@ezyang ezyang commented Oct 25, 2018

Stack:
    :black_circle:  #13133 Add c10::Stream, make at::cuda::CUDAStream use it.  💛
    :white_circle:  #13232 Delete DeviceGuard(int64_t) constructor.  💛
    :white_circle:  #13275 Replace CUDA-specific set_index(_from) method from DeviceGuard with set_device.  💛
    :white_circle:  #13342 Generalize DeviceGuard to work with arbitrary DeviceType.  💛

c10::Stream is a device agnostic object which represents a stream
on some device (defined as c10::Device). The primary benefit of
introducing this object is that we can easily refer to it from code
in the non-CUDA library (since it doesn't actually refer to any
CUDA specific bits.)

Streams are identified by an ID into an appropriate pool. There's
some work to translate to and from pointers to the pool; see inline
comments.

Differential Revision: D10855883

ezyang added 19 commits October 23, 2018 11:34
Differential Revision: D10513246
Differential Version: 61419882
Differential Revision: D10513246
Differential Version: 61420227
Differential Revision: D10513246
Differential Version: 61434145
Differential Revision: D10513246
Differential Version: 61443861
Differential Revision: D10520295
Differential Version: 61458546
Differential Revision: D10520421
Differential Version: 61459119
Differential Revision: D10520421
Differential Version: 61459533
Differential Revision: D10520421
Differential Version: 61461399
Differential Revision: D10520421
Differential Version: 61510016
Differential Revision: D10528061
Differential Version: 61512798
Differential Revision: D10520421
Differential Version: 61514357
Differential Revision: D10520421
Differential Version: 61514849
Differential Revision: D10520421
Differential Version: 61532957
Differential Revision: D10520421
Differential Version: 61650165
Differential Revision: D10520421
Differential Version: 61651201
Differential Revision: D10853224
Differential Version: 61658841
Differential Revision: D10853224
Differential Version: 61671204
Differential Revision: D10520421
Differential Version: 61671479
Differential Revision: D10855883
Differential Version: 61676909
Differential Revision: D10853224
Differential Version: 61685989
Differential Revision: D10520421
Differential Version: 61686215
Differential Revision: D10855883
Differential Version: 61686353
const bool isHighPriority
, int64_t device) {
return detail::CUDAStream_getStreamFromPool(isHighPriority, device);
return CUDAStream(detail::CUDAStream_getStreamFromPool(isHighPriority, device));

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

Differential Revision: D10853224
Differential Version: 61786872
Differential Revision: D10520421
Differential Version: 61786871
Differential Revision: D10853224
Differential Version: 61828004
Differential Revision: D10520421
Differential Version: 61828001
Differential Revision: D10855883
Differential Version: 61828003
Differential Revision: D10853224
Differential Version: 61911843
Differential Revision: D10520421
Differential Version: 61911845
Differential Revision: D10855883
Differential Version: 61911844
Differential Revision: D10855883
Differential Version: 61939683
@ezyang ezyang changed the base branch from export-D10520421 to master October 29, 2018 16:00
Differential Revision: D10855883
Differential Version: 61985545
return std::greater_equal<const T*>()(ptr, arr.data()) && std::less<const T*>()(ptr, arr.data() + arr.size());
}

static StreamId CUDAStream_getStreamId(const CUDAStreamInternals* ptr) {

This comment was marked as off-topic.

This comment was marked as off-topic.

Comment thread c10/Stream.h
* functionality (e.g., get the cudaStream_t of a CUDA stream.) There are
* wrapper classes which provide this functionality, e.g., CUDAStream.
*/
class Stream {

This comment was marked as off-topic.

This comment was marked as off-topic.

Differential Revision: D10855883
Differential Version: 62135957
zdevito pushed a commit to zdevito/ATen that referenced this pull request Oct 31, 2018
Summary:
Pull Request resolved: pytorch/pytorch#13133

c10::Stream is a device agnostic object which represents a stream
on some device (defined as c10::Device).  The primary benefit of
introducing this object is that we can easily refer to it from code
in the non-CUDA library (since it doesn't actually refer to any
CUDA specific bits.)

Streams are identified by an ID into an appropriate pool.  There's
some work to translate to and from pointers to the pool; see inline
comments.

Reviewed By: gchanan

Differential Revision: D10855883

fbshipit-source-id: cc447f11a528432e41c2edc789f40e7a6f17bdd3
@ezyang ezyang added the merged label Jun 25, 2019
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Pull Request resolved: pytorch#13133

c10::Stream is a device agnostic object which represents a stream
on some device (defined as c10::Device).  The primary benefit of
introducing this object is that we can easily refer to it from code
in the non-CUDA library (since it doesn't actually refer to any
CUDA specific bits.)

Streams are identified by an ID into an appropriate pool.  There's
some work to translate to and from pointers to the pool; see inline
comments.

Reviewed By: gchanan

Differential Revision: D10855883

fbshipit-source-id: cc447f11a528432e41c2edc789f40e7a6f17bdd3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants