Open Crydsch opened 1 year ago
Hey, i had some time and took another look into this. I initially thought i had to add a special template function to pass the regions, but since noticed that this is not really necessary (although much nicer).
But in principle the functionality could be added as a new operation class.
This could be done entirely in user code just by deriving from OpBase
.
The only necessary change to enable this is to expose the copy region in the tensor class. So changed my approach for this PR and added the required function overloads.
I'll push another PR then with the new operations.
PS: To see if the CI runs successfully with this change I enabled the TestOpTensorSync
, not sure why it was disabled.
If you want to keep it disabled, I'll remove the commit again.
Hey, in my current project I have the need to only copy parts of a tensor to/from the device. I also found your Issue #24 regarding this.
So I had a go at it!
I extended the
kp::OpTensorSyncDevice
by a vector of copyRegions and added function overloads all the way up toSequence.eval()
. I made sure that the overload only add functionality and still copy the entire tensor per default. Additionally there is now a Test, showcasing the approach. All very experimental at this stage..Open questions are:
kp::CopyRegion
which takes offsets and size in number of elements instead of bytes? This would ease usage and fit nicely with kompute's higher level functions.kp::OpTensorSyncDevice
constructor. With a warning of course..I'd like to know what you think of this approach. If you are interested I can work on this an turn it into a PR.