Skip to content

Commit 25d8cb6

Browse files
committed
[SYCL][CUDA] Remove obsolete ScopedContext workaround
This is no longer needed with #8197
1 parent 18126d0 commit 25d8cb6

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -188,30 +188,17 @@ pi_result check_error(CUresult result, const char *function, int line,
188188
/// contexts to be restored by SYCL.
189189
class ScopedContext {
190190
public:
191-
ScopedContext(pi_context ctxt) : device(nullptr) {
191+
ScopedContext(pi_context ctxt) {
192192
if (!ctxt) {
193193
throw PI_ERROR_INVALID_CONTEXT;
194194
}
195195

196196
set_context(ctxt->get());
197197
}
198198

199-
ScopedContext(CUcontext ctxt) : device(nullptr) { set_context(ctxt); }
199+
ScopedContext(CUcontext ctxt) { set_context(ctxt); }
200200

201-
// Creating a scoped context from a device will simply use the primary
202-
// context, this should be used when there is no other appropriate context,
203-
// such as for the device infos.
204-
ScopedContext(pi_device device) : device(device) {
205-
CUcontext ctxt;
206-
cuDevicePrimaryCtxRetain(&ctxt, device->get());
207-
208-
set_context(ctxt);
209-
}
210-
211-
~ScopedContext() {
212-
if (device)
213-
cuDevicePrimaryCtxRelease(device->get());
214-
}
201+
~ScopedContext() {}
215202

216203
private:
217204
void set_context(CUcontext desired) {
@@ -225,8 +212,6 @@ class ScopedContext {
225212
PI_CHECK_ERROR(cuCtxSetCurrent(desired));
226213
}
227214
}
228-
229-
pi_device device;
230215
};
231216

232217
/// \cond NODOXY

0 commit comments

Comments
 (0)