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.
So I've left the Julia files in a separate folder and not really incorporated into the main codebase because I don't know where to place them. So for now this is more of a look at what I did and give me a few pointers because I barely know XLA, Reactant and even Git.
Relevant issue: ##1362
Some comments:
from_dlpackfunction convention because I wasn't sure what the best approach would be, i.e, just use their for exampleDLPack.from_dlpack(::ArrayType,::MemoryLayout, pyobject)or simply create somerarray_from_dlpackoutside of DLPack.jl.client->CreateViewOfDeviceBuffer) I usedclient->BufferFromHostBufferwithHostBufferSemantics::kMutableZeroCopybecause otherwise the buffer would get copied when being donated (I think, all I know about XLA was by just reading its source code while programming this). From my tests the same thing happens in Jax even though it shouldn't (No error message but failing zero-copy? jax-ml/jax#30228)?GetBufferComputeStream,WaitUntilBufferReadyOnStream). I believe they work, but I don't know how to test it properly. Some tests I did:I didn't test the reverse order because for whatever the reason Reactant always seems to sync for me.
@lassepe