static */
| 456 | } |
| 457 | |
| 458 | /* static */ void GpuDriver::DestroyContext(GpuContext* context) { |
| 459 | if (context == nullptr) { |
| 460 | return; |
| 461 | } |
| 462 | CUcontext former_context = CurrentContext(); |
| 463 | CUresult res = cuCtxSetCurrent(context->context()); |
| 464 | CUdevice device; |
| 465 | cuCtxGetDevice(&device); |
| 466 | cuCtxSetCurrent(former_context); |
| 467 | |
| 468 | if (CudaPrimaryContextsMgr::Has(context->context())) { |
| 469 | res = cuDevicePrimaryCtxRelease(device); |
| 470 | } else { |
| 471 | res = cuCtxDestroy(context->context()); |
| 472 | } |
| 473 | |
| 474 | if (res != CUDA_SUCCESS) { |
| 475 | LOG(ERROR) << "failed to release CUDA context; leaking: " << ToString(res); |
| 476 | } |
| 477 | |
| 478 | CreatedContexts::Remove(context->context()); |
| 479 | } |
| 480 | |
| 481 | /* static */ bool GpuDriver::FuncGetAttribute(CUfunction_attribute attribute, |
| 482 | CUfunction func, |
nothing calls this directly
no test coverage detected