Skip to content

[SYCL][CUDA] Make active context persitent #2016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2020
Merged
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
6 changes: 3 additions & 3 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ class ScopedContext {
if (original_ != desired) {
// Sets the desired context as the active one for the thread
PI_CHECK_ERROR(cuCtxSetCurrent(desired));
if (original_ == nullptr && ctxt->is_primary()) {
// No context is installed and the suggested context is primary
if (original_ == nullptr) {
// No context is installed on the current thread
// This is the most common case. We can activate the context in the
// thread and leave it there until all the PI context referring to the
// same underlying CUDA primary context are destroyed. This emulates
// same underlying CUDA context are destroyed. This emulates
// the behaviour of the CUDA runtime api, and avoids costly context
// switches. No action is required on this side of the if.
} else {
Expand Down