Conversation
Many architectures do not support cfunctions wrapping a closure. This makes it impossible to create user-defined reduction operators at run time. This PR introduces 128 pre-compiled functions as a trampoline pool. This allows using closures on all architectures. (I'm using the same approach in the [mpif](https://github.com/eschnett/mpif) Fortran MPI bindings.)
|
I am not a fan of the added complexity and I was hoping that RegisterOp covered most of the use-cases in particular since it allows for So the user-defined operator case should only be needed for true closures. I was wondering if we could smuggle the additional information through a DataType, but I guess it would be a bit awkard.
|
|
From a user's perspective, having to modify datatypes is even more inconvenient than using a macro to define closures. I'd say: We either keep the current setup (requiring macros until LLVM figures things out), or we use the trampoline pool. Since I'm using a trampoline pool in other MPI-related libraries I didn't think this was too much added complexity. If you want, we can remove the code that automatically extends the trampoline pool at run time. This would simplify things. Of course there's also waiting for MPI 5.1 or MPI 6. They know that reduction operators have this problem. |
Many architectures do not support cfunctions wrapping a closure. This makes it impossible to create user-defined reduction operators at run time.
This PR introduces 128 pre-compiled functions as a trampoline pool. This allows using closures on all architectures.
(I'm using the same approach in the
mpif Fortran MPI bindings.)