Skip to content

[pt1][tensor] New in StaticContext returns at::DataPtr#12029

Closed
jerryzh168 wants to merge 27 commits intomasterfrom
export-D9889990
Closed

[pt1][tensor] New in StaticContext returns at::DataPtr#12029
jerryzh168 wants to merge 27 commits intomasterfrom
export-D9889990

Conversation

@jerryzh168
Copy link
Contributor

@jerryzh168 jerryzh168 commented Sep 24, 2018

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

Differential Revision: D9779821
Differential Version: 57806436
Differential Revision: D9779821
Differential Version: 58572220
Differential Revision: D9779821
Differential Version: 58709105
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: D9889990
Differential Version: 58799279
Differential Revision: D10033396
Differential Version: 58815881
Differential Revision: D9889990
Differential Version: 58825947
@jerryzh168 jerryzh168 changed the base branch from export-D9779821 to export-D10033396 September 25, 2018 18:38
Differential Revision: D10033396
Differential Version: 58835275
Differential Revision: D9889990
Differential Version: 58856304
Differential Revision: D10033396
Differential Version: 58856963
Differential Revision: D9889990
Differential Version: 58858304
Differential Revision: D9889990
Differential Version: 58875107
Differential Revision: D9889990
Differential Version: 58881242
memset(data, 0, nbytes);
}
return {data, Delete};
LOG(INFO) << "allocated data: " << data;

This comment was marked as off-topic.

}
#else
static void Delete(void* data) {
LOG(INFO) << "destructed " << data;

This comment was marked as off-topic.

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.

This comment was marked as off-topic.

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.

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.

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.

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.

Differential Revision: D10033396
Differential Version: 59085834
Differential Revision: D10033396
Differential Version: 59088508
Differential Revision: D10033396
Differential Version: 59091126
Differential Revision: D9889990
Differential Version: 59110247
Differential Revision: D10033396
Differential Version: 59227528
Differential Revision: D9889990
Differential Version: 59236356
Differential Revision: D9889990
Differential Version: 59596351
@jerryzh168 jerryzh168 changed the base branch from export-D10033396 to master October 3, 2018 19:54
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.

Differential Revision: D9889990
Differential Version: 59619253
Differential Revision: D9889990
Differential Version: 59621759
Differential Revision: D9889990
Differential Version: 59625764
Differential Revision: D9889990
Differential Version: 59628377
zdevito pushed a commit to zdevito/ATen that referenced this pull request Oct 4, 2018
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
@ezyang ezyang added the merged label Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants