diff options
author | Edward Yang <ezyang@fb.com> | 2019-02-08 09:29:59 -0800 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2019-02-08 09:33:56 -0800 |
commit | b3fbd3eebf50e11f6c9af1f7d74bf295dcb2ffd5 (patch) | |
tree | 2b270e8640106a2428dadb5ad60d62ca2e0941b8 /c10 | |
parent | 5c982622b0c6711e02e4363dc56557c0fcc3517a (diff) | |
download | pytorch-b3fbd3eebf50e11f6c9af1f7d74bf295dcb2ffd5.tar.gz pytorch-b3fbd3eebf50e11f6c9af1f7d74bf295dcb2ffd5.tar.bz2 pytorch-b3fbd3eebf50e11f6c9af1f7d74bf295dcb2ffd5.zip |
Deduplicate instances caching allocator, so that we only have one instance. (#16720)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16720
I'm taking the deduplication slowly because there is something here
that is causing problems, and I want to figure out what it is.
Reviewed By: dzhulgakov
Differential Revision: D13943194
fbshipit-source-id: cbc08fee5862fdcb393b9dd5b1d2ac7250f77c4b
Diffstat (limited to 'c10')
-rw-r--r-- | c10/cuda/CUDACachingAllocator.cpp | 11 | ||||
-rw-r--r-- | c10/cuda/CUDACachingAllocator.h | 6 |
2 files changed, 2 insertions, 15 deletions
diff --git a/c10/cuda/CUDACachingAllocator.cpp b/c10/cuda/CUDACachingAllocator.cpp index 75faf16741..a24df498ae 100644 --- a/c10/cuda/CUDACachingAllocator.cpp +++ b/c10/cuda/CUDACachingAllocator.cpp @@ -660,21 +660,14 @@ std::shared_ptr<void> getIpcDevPtr(std::string handle) { return sp; } -Legacy::Legacy() - : _impl(new THCCachingAllocator()) {} - -Legacy::~Legacy() { - delete _impl; -} - cudaError_t Legacy::Alloc(void** refPtr, size_t nbytes, cudaStream_t stream) { - _impl->malloc(refPtr, nbytes, stream); + caching_allocator.malloc(refPtr, nbytes, stream); return cudaSuccess; } cudaError_t Legacy::Free(void* ptr) { - _impl->free(ptr); + caching_allocator.free(ptr); return cudaSuccess; } diff --git a/c10/cuda/CUDACachingAllocator.h b/c10/cuda/CUDACachingAllocator.h index 43082d10b1..f30036f545 100644 --- a/c10/cuda/CUDACachingAllocator.h +++ b/c10/cuda/CUDACachingAllocator.h @@ -47,14 +47,8 @@ struct THCCachingAllocator; class C10_CUDA_API Legacy { public: - Legacy(); - ~Legacy(); - cudaError_t Alloc(void** refPtr, size_t nbytes, cudaStream_t stream); cudaError_t Free(void* ptr); - - private: - THCCachingAllocator* _impl; }; } // namespace CUDACachingAllocator |