[pt1][tensor] New in StaticContext returns at::DataPtr#12029
[pt1][tensor] New in StaticContext returns at::DataPtr#12029jerryzh168 wants to merge 27 commits intomasterfrom
Conversation
Differential Revision: D9779821 Differential Version: 57806436
Differential Revision: D9779821 Differential Version: 58713403
Differential Revision: D9779821 Differential Version: 58748651
Differential Revision: D9889990 Differential Version: 58748485
Differential Revision: D9889990 Differential Version: 58751934
Differential Revision: D10033396 Differential Version: 58815881
Differential Revision: D9889990 Differential Version: 58856304
Differential Revision: D10033396 Differential Version: 58856963
Differential Revision: D9889990 Differential Version: 58875107
caffe2/core/allocator.h
Outdated
| memset(data, 0, nbytes); | ||
| } | ||
| return {data, Delete}; | ||
| LOG(INFO) << "allocated data: " << data; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
caffe2/core/allocator.h
Outdated
| } | ||
| #else | ||
| static void Delete(void* data) { | ||
| LOG(INFO) << "destructed " << data; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
caffe2/core/context_gpu.h
Outdated
| auto ptr_and_deleter = baseAllocator_.New(nbytes); | ||
| data = ptr_and_deleter.first; | ||
| auto data_ptr = baseAllocator_.allocate(nbytes); | ||
| data = data_ptr.move_context().release(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
caffe2/core/hip/context_hip.h
Outdated
| auto ptr_and_deleter = baseAllocator_.New(nbytes); | ||
| data = ptr_and_deleter.first; | ||
| auto data_ptr = baseAllocator_.allocate(nbytes); | ||
| data = data_ptr.move_context().release(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
caffe2/core/hip/miopen_wrapper.h
Outdated
| auto data_and_deleter = HIPContext::New(nbytes); | ||
| data_ = {data_and_deleter.first, data_and_deleter.second}; | ||
| auto data_ptr = HIPContext::New(nbytes); | ||
| data_ = {data_ptr.move_context().release(), data_ptr.get_deleter()}; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
caffe2/core/qtensor.h
Outdated
| static_cast<unsigned char*>(ptr_and_deleter.first), | ||
| ptr_and_deleter.second); | ||
| static_cast<unsigned char*>(data_ptr.move_context().release()), | ||
| data_ptr.get_deleter()); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
caffe2/core/tensor_impl.h
Outdated
| deleter(local_ptr); | ||
| }, | ||
| storage_.set_data_ptr(PlacementDeleteContext::makeDataPtr( | ||
| std::move(data_ptr.move_context()), |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Differential Revision: D9889990 Differential Version: 59110247
Differential Revision: D10033396 Differential Version: 59227528
aten/src/ATen/core/TensorImpl.h
Outdated
| ptr_and_deleter.second, | ||
| at::Device(storage_.device_type()))); | ||
| auto data_ptr = GetStaticContext()->New(numel_ * storage_.itemsize()); | ||
| storage_.set_data_ptr(std::move(data_ptr)); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Differential Revision: D9889990 Differential Version: 59619253
Differential Revision: D9889990 Differential Version: 59621759
Differential Revision: D9889990 Differential Version: 59625764
Differential Revision: D9889990 Differential Version: 59628377
Summary: Pull Request resolved: pytorch/pytorch#12029 In order to remove New() function in StaticContext(to remove StaticContext) and converge to the Allocator design, we'll first change the return type of New to at::DataPtr. Reviewed By: ezyang Differential Revision: D9889990 fbshipit-source-id: 3257c763530b987025f428741bdd2e089d11bad4
Stack:
:black_circle: #12029 [pt1][tensor] New in StaticContext returns at::DataPtr 💛
:white_circle: #12105 [pt1][tensor] Split Allocator 💛
:white_circle: #12111 [pt1][tensor] Remove New with Allocator Registry 💛
In order to remove New() function in StaticContext(to remove StaticContext) and converge to the Allocator design, we'll first change the return type of New to at::DataPtr.
Differential Revision: D9889990