Skip to content

[BUG] Thread-level current stream #274

@nan2088

Description

@nan2088

It appears that, by design, the current stream is intended to be thread-local, consistent with PyTorch's design:

stream.def("__enter__", &Stream::activate, "Activate the CUDA stream as the current stream for this thread.")

However, the implementation uses a global singleton pattern:

StreamStack::Instance().push(*this);

static StreamStack stack;

This will cause the current stream to return an incorrect stream in multi-threaded scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions