-
Notifications
You must be signed in to change notification settings - Fork 30
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
Static method of _Memory to create from external allocation #430
Merged
oleksandr-pavlyk
merged 2 commits into
master
from
feature/create_MemoryObject_from_external_allocation
May 6, 2021
Merged
Static method of _Memory to create from external allocation #430
oleksandr-pavlyk
merged 2 commits into
master
from
feature/create_MemoryObject_from_external_allocation
May 6, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oleksandr-pavlyk
force-pushed
the
feature/create_MemoryObject_from_external_allocation
branch
from
May 6, 2021 00:03
5b537af
to
1676f34
Compare
diptorupd
reviewed
May 6, 2021
diptorupd
reviewed
May 6, 2021
diptorupd
reviewed
May 6, 2021
diptorupd
reviewed
May 6, 2021
diptorupd
reviewed
May 6, 2021
diptorupd
reviewed
May 6, 2021
diptorupd
reviewed
May 6, 2021
diptorupd
reviewed
May 6, 2021
oleksandr-pavlyk
force-pushed
the
feature/create_MemoryObject_from_external_allocation
branch
from
May 6, 2021 01:39
1676f34
to
3aced4c
Compare
diptorupd
reviewed
May 6, 2021
diptorupd
reviewed
May 6, 2021
Method takes USMRef, number of bytes and queue reference. If USMRef is bound to context in the queue and USM type comes back not 'unknown', appropriate MemoryUSM* object is created which assumes ownership of this memory. Optional `memory_owner` keyword argument may be specified to set the recorded reference object to something other than None (signaling that _Memory is responsible for memory deallocation). This can be used to create MemoryUSM* Python object from natively allocated memory, populate it, but leave deallocation to the caller. It could also be set to a PyCapsule object that carries a custom deleter.
oleksandr-pavlyk
force-pushed
the
feature/create_MemoryObject_from_external_allocation
branch
from
May 6, 2021 01:59
3aced4c
to
8fed78b
Compare
diptorupd
reviewed
May 6, 2021
diptorupd
reviewed
May 6, 2021
if (!QRef) { | ||
std::cerr << "Input QRef is nullptr\n"; | ||
return nullptr; | ||
} | ||
auto Q = unwrap(QRef); | ||
auto Ptr = malloc_host(size, *Q); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we not check for an exception here? At least a bad_alloc
exception?
diptorupd
reviewed
May 6, 2021
oleksandr-pavlyk
force-pushed
the
feature/create_MemoryObject_from_external_allocation
branch
from
May 6, 2021 16:02
69c5783
to
7247207
Compare
CI failure is network related, timing out when trying to retrieve NumPy for pip installation
|
diptorupd
approved these changes
May 6, 2021
oleksandr-pavlyk
deleted the
feature/create_MemoryObject_from_external_allocation
branch
May 6, 2021 18:39
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Method takes USMRef, number of bytes and queue reference.
If USMRef is bound to context in the queue and USM type comes
back not 'unknown', appropriate MemoryUSM* object is created
which assumes ownership of this memory.
Optional
memory_owner
keyword argument may be specified to setthe recorded reference object to something other than None (signaling
that _Memory is responsible for memory deallocation).
This can be used to create MemoryUSM* Python object from natively
allocated memory, populate it, but leave deallocation to the caller.
It could also be set to a PyCapsule object that carries a custom deleter.