Skip to content

Commit ac205ac

Browse files
author
Protonu Basu
committed
avoid redundant calls to cudaFree
1 parent f6555c4 commit ac205ac

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

torch/csrc/jit/tensorexpr/cuda_codegen.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -937,14 +937,6 @@ void CudaCodeGen::call(const std::vector<CallArg>& args) {
937937
USE_TRIGGER(cuda_codegen_executed);
938938
}
939939

940-
void CudaSetContext(CUcontext pctx) {
941-
if (!pctx) {
942-
std::unique_lock<std::mutex> cudaFreeMutexLock(
943-
*(c10::cuda::CUDACachingAllocator::getFreeMutex()));
944-
cudaFree(0);
945-
}
946-
}
947-
948940
void CudaCodeGen::CompileToNVRTC(
949941
const std::string& code,
950942
const std::string& func_name) {
@@ -958,7 +950,6 @@ void CudaCodeGen::CompileToNVRTC(
958950
}
959951
// cudaSetDevice does not have to really change the underlying device if it
960952
// doesn't have to, so calling cudaFree to force that change
961-
CudaSetContext(pctx);
962953
if (!pctx) {
963954
std::unique_lock<std::mutex> cudaFreeMutexLock(
964955
*(c10::cuda::CUDACachingAllocator::getFreeMutex()));

0 commit comments

Comments
 (0)