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

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


On Mon, 10 Feb 2025 13:16:10 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   minor rename
>
> cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxRuntime.java line 524:
> 
>> 522: 
>> 523:     private void checkStatus(Object res) {
>> 524:         if (!res.equals(MemorySegment.NULL) && res instanceof MemorySegment status) {
> 
> This is another example of "hardwired logic". There's a struct definition for this:
> 
> 
> struct OrtStatus {
>   OrtErrorCode code;
>   char msg[1];  // a null-terminated string
> };
> 
> 
> And the code is optimistically assuming that this layout will hold (across different versions of the API and across different platforms). Ok for a prototype of course, but that's another thing jextract might help you with.

I agree the code is hard-wired to the ONNX library, however any significant changes in the API (more than reordering of the functions in the struct) will break the compatibility anyway. 
Jextracted code is also hard-wired to the specific library version.

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

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


More information about the babylon-dev mailing list