Add ffi_call
function with a similar signature to pure_callback
.
#21743
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.
Add
ffi_call
function with a similar signature topure_callback
.This could be useful for supporting the most common use cases for FFI custom
calls. It has several benefits over using the
Primitive
based approach, butthe biggest one (in my opinion) is that it doesn't require interacting with
mlir
at all. It does have the limitation that transforms would need to beregistered using interfaces like
custom_vjp
, but many users of custom callsalready do that.
The easiest to-do item (I think) is to implement batching using a
Done.vectorized
parameter likepure_callback
, but we could also think about moresophisticated vmapping interfaces in the future.
The more difficult to-do is to think about how to support sharding, and we
might actually want to expose an interface similar to the one from
custom_partitioning
. I have less experience with this part so I'll have tothink some more about it, and feedback would be appreciated!