This new invoke will pack a list of argument before calling the
invokePacked method. It accepts returned value as output argument
wrapped in ExecutionEngine::Result<T>, and delegate the packing of
arguments to a trait to allow for customization for some types.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| mlir/include/mlir/ExecutionEngine/ExecutionEngine.h | ||
|---|---|---|
| 118 | No it is actually load bearing, I use it in the trait specialization. This is tricky to describe in a comment though, this is due to our ABI where we take every operand by pointers: float foo(float, float); is turned into this interface: void foo_ifcase(**float) {
float *arg0 = float[0];
float *arg1 = float[1];
float *arg2 = float[2];
*arg2 = foo(*arg0, *arg1);
}Now from C++ we would want to invoke the jit like this: float result;
float input = 1.0f
jit->invoke("foo", 1.f, input, result);To be able to accept the literal argument, we can't just take a non-const reference so I take the arguments by values instead. But we want a reference to the result, this wrapper achieves this here: jit->invoke("foo", 1.f, input, ExecutionEngine::Result<float>(result));That way we carry the address of result into the invoke. An alternative would be to not allow literal and other const objects on the interface I think. | |
| mlir/include/mlir/ExecutionEngine/ExecutionEngine.h | ||
|---|---|---|
| 148 | Better than mine, but I don't see this changed? Did you upload? | |
| mlir/include/mlir/ExecutionEngine/ExecutionEngine.h | ||
|---|---|---|
| 150 | friendly ping on this | |
| mlir/include/mlir/ExecutionEngine/ExecutionEngine.h | ||
|---|---|---|
| 148 | Indeed I amended it in the wrong commit in my chain... | |