Skip to content

Make methods of Memory class for copy to and from another objects #76

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

Closed
PokhodenkoSA opened this issue Sep 29, 2020 · 0 comments · Fixed by #152
Closed

Make methods of Memory class for copy to and from another objects #76

PokhodenkoSA opened this issue Sep 29, 2020 · 0 comments · Fixed by #152
Assignees
Milestone

Comments

@PokhodenkoSA
Copy link
Contributor

PokhodenkoSA commented Sep 29, 2020

Perhaps it would be better to not expose memcpy as a stand-alone symbol, but rather make it two method copyto and copyfrom of Memory object. That way it could copy to/from another Memory object, or host memory of any object that supports a buffer protocol.

Originally posted by @oleksandr-pavlyk in #70 (comment)

The q.memcpy assumes pointers are either host pointers or USM pointers accessible in the context associated with the queue.

It would make sense for SyclQueue.memcpy to raise an exception if this is not the case.

But we still need a way to copy data from one Memory instance to another even if their memory reside in different SYCL contexts. So we could have Memory.copyto(src) and Memory.to_memoryview().

copyto would copy from src or type Memory using host as an intermediary if needed, or from src being Python's object exposing buffer interface.

Memory.to_memoryview() will create host memory, copy content of Memory to host memory and return the result as Python's memoryview object created from the host memory pointer.

Originally posted by @oleksandr-pavlyk in #70 (comment)

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 a pull request may close this issue.

1 participant