[KERNEL_GEN] Cache cuda stream to avoid OOM.
PiperOrigin-RevId: 336719808 Change-Id: I6422a64e897b75f4259eb4c0d6dad0f1f50affc9
This commit is contained in:
parent
c32906c588
commit
e2aa1ff751
@ -64,8 +64,13 @@ extern "C" void mgpuLaunchKernel(CUfunction function, intptr_t gridX,
|
||||
}
|
||||
|
||||
extern "C" CUstream mgpuStreamCreate() {
|
||||
CUstream stream = nullptr;
|
||||
CUDA_REPORT_IF_ERROR(cuStreamCreate(&stream, CU_STREAM_NON_BLOCKING));
|
||||
static CUstream stream = []() {
|
||||
// TODO(b/170649852): This is neither thread-safe nor handles
|
||||
// creation/descruction of one stream per context.
|
||||
CUstream stream = nullptr;
|
||||
CUDA_REPORT_IF_ERROR(cuStreamCreate(&stream, CU_STREAM_NON_BLOCKING));
|
||||
return stream;
|
||||
}();
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user