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