Skip to content

Commit 2f9d8e9

Browse files
author
Protonu Basu
committed
avoid redundant calls to cudaFree
1 parent af048f8 commit 2f9d8e9

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
@@ -931,14 +931,6 @@ void CudaCodeGen::call(const std::vector<CallArg>& args) {
931931
USE_TRIGGER(cuda_codegen_executed);
932932
}
933933

934-
void CudaSetContext(CUcontext pctx) {
935-
if (!pctx) {
936-
std::unique_lock<std::mutex> cudaFreeMutexLock(
937-
*(c10::cuda::CUDACachingAllocator::getFreeMutex()));
938-
cudaFree(0);
939-
}
940-
}
941-
942934
void CudaCodeGen::CompileToNVRTC(
943935
const std::string& code,
944936
const std::string& func_name) {
@@ -952,7 +944,6 @@ void CudaCodeGen::CompileToNVRTC(
952944
}
953945
// cudaSetDevice does not have to really change the underlying device if it
954946
// doesn't have to, so calling cudaFree to force that change
955-
CudaSetContext(pctx);
956947
if (!pctx) {
957948
std::unique_lock<std::mutex> cudaFreeMutexLock(
958949
*(c10::cuda::CUDACachingAllocator::getFreeMutex()));

0 commit comments

Comments
 (0)