Expose CopyRegions for tensor copy operations#329
Expose CopyRegions for tensor copy operations#329Crydsch wants to merge 2 commits intoKomputeProject:masterfrom
Conversation
Signed-off-by: crydsch <crydsch@lph.zone>
Signed-off-by: crydsch <crydsch@lph.zone>
|
Hey, i had some time and took another look into this. But in principle the functionality could be added as a new operation class. The only necessary change to enable this is to expose the copy region in the tensor class. I'll push another PR then with the new operations. |
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::OpTensorSyncDeviceby a vector of copyRegionsand added function overloads all the way up to
Sequence.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::CopyRegionwhich takes offsets and size in number of elements instead of bytes?This would ease usage and fit nicely with kompute's higher level functions.
I suggest just clamping the region to the tensor size in the
kp::OpTensorSyncDeviceconstructor.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.