Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark MemmappedTensorAllocator as returning opaque handle. #45513

Conversation

mihaimaruseac
Copy link
Collaborator

This allocator is used for ImmutableConstantOp and it returns a handle to the contents of a memory mapped file which is supposed to represent a tensor.

For tensors of complex types (resources, variables and strings), allocators which are not marked as returning opaque handles will call placement new to initialize each element. This means writing to the buffer. However, in our case, the buffer is immutable and already contains the tensor data. Hence, writing to it is both destructive and causes a crash.

PiperOrigin-RevId: 345786451
Change-Id: I46369c50fa60b3431709ffe068a728d3061f49c4

This allocator is used for `ImmutableConstantOp` and it returns a handle to the contents of a memory mapped file which is supposed to represent a tensor.

For tensors of complex types (resources, variables and strings), allocators which are not marked as returning opaque handles will call placement new to initialize each element. This means writing to the buffer. However, in our case, the buffer is immutable and already contains the tensor data. Hence, writing to it is both destructive and causes a crash.

PiperOrigin-RevId: 345786451
Change-Id: I46369c50fa60b3431709ffe068a728d3061f49c4
@mihaimaruseac mihaimaruseac added the waiting for patch release PR will be reviewed and merged only if we do a patch release since PR is not on master branch label Dec 9, 2020
@mihaimaruseac mihaimaruseac self-assigned this Dec 9, 2020
@google-cla google-cla bot added the cla: yes label Dec 9, 2020
@mihaimaruseac mihaimaruseac merged commit 4f8c22c into r2.2 Dec 17, 2020
@mihaimaruseac mihaimaruseac deleted the mm-cherrypick-c1e1fc899ad5f8c725dcbb6470069890b5060bc7-on-r2.2 branch December 17, 2020 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes waiting for patch release PR will be reviewed and merged only if we do a patch release since PR is not on master branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant