[code-reflection] RFR: ONNX FFM Runtime initial work [v3]

Adam Sotona asotona at openjdk.org
Mon Feb 10 14:10:25 UTC 2025


On Mon, 10 Feb 2025 14:06:45 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxRuntime.java line 224:
>> 
>>> 222:             public int getNumberOfInputs() {
>>> 223:                 try {
>>> 224:                     return retInt(sessionGetInputCount.invokeExact(sessionAddress, ret));
>> 
>> I note the use of this shared `ret` output segment. We plan to add more capabilities to FFM to address the case of recyclable allocation -- this will help code like this to avoid the shared segment, at the same time while avoiding the cost of a malloc per call.
>
> That would be very helpful.
> Truly I haven't found any FFM hints which type of arena is best for specific case.
> My guess is that garbage-collected allocations may be better than creating and disposing individual arena for each allocation (I've seen a lot of objects constructed).
> Simple manual disposal of a memory segment might be a step forward?

Finally I've decided to re-use the `ret` as the thread-safety is not yet a problem.

-------------

PR Review Comment: https://git.openjdk.org/babylon/pull/311#discussion_r1949125220


More information about the babylon-dev mailing list