[code-reflection] RFR: Support for Onnx functions [v2]
Adam Sotona
asotona at openjdk.org
Mon Apr 14 13:12:47 UTC 2025
> Support for Onnx functions:
> - Onnx model is represented by `ModuleOp`.
> - Initializers are self-described by `OnnxType.Initializer` type (no more by-passing initializers values from `OnnxTransformer`).
> - `OnnxTransformer` is decomposed into small independent transformations.
> - Single-use functions are inlined, multiple-use functions are declared in the model.
> - Protobuf model is improved to better reflect Onnx model.
>
> Sample Onnx model:
>
> module ()void -> {
> func @"step" (%0 : tensor<int64>, %1 : tensor<int64>, %2 : init<tensor<int64>, oracle.code.onnx.WalkTheMazeTest.directionEast>, %3 : init<tensor<int64>, oracle.code.onnx.WalkTheMazeTest.stepEast>, %4 : init<tensor<int64>, oracle.code.onnx.WalkTheMazeTest.directionNorth>, %5 : init<tensor<int64>, oracle.code.onnx.WalkTheMazeTest.stepNorth>, %6 : init<tensor<int64>, oracle.code.onnx.WalkTheMazeTest.directionWest>, %7 : init<tensor<int64>, oracle.code.onnx.WalkTheMazeTest.stepWest>, %8 : init<tensor<int64>, oracle.code.onnx.WalkTheMazeTest.stepSouth>)tensor<int64> -> {
> %9 : tensor<bool> = Equal %1 %2;
> %10 : tensor<int64> = If %9
> ()tensor<int64> -> {
> %11 : tensor<int64> = Add %0 %3;
> return %11 @loc="102:17";
> }
> ()tensor<int64> -> {
> %12 : tensor<bool> = Equal %1 %4;
> %13 : tensor<int64> = If %12
> ()tensor<int64> -> {
> %14 : tensor<int64> = Add %0 %5;
> return %14 @loc="104:25";
> }
> ()tensor<int64> -> {
> %15 : tensor<bool> = Equal %1 %6;
> %16 : tensor<int64> = If %15
> ()tensor<int64> -> {
> %17 : tensor<int64> = Add %0 %7;
> return %17 @loc="106:29";
> }
> ()tensor<int64> -> {
> %18 : tensor<int64> = Add %0 %8;
> return %18 @loc="107:29";
> };
> return %16 @loc="105:25";
> };
> return %13 @loc="103:17";
> };
> return %10 @loc="101:9";
> };
> func @"turnLeft" (%19 : tensor<int64>, %20 : init<tensor<int64>, oracle.code.onnx.WalkTheMazeTest.directionEast>, %21 : init<tensor<int64>, oracle.code.onnx.WalkTheMazeTest.directionNorth>, %22 : init<tensor<int64>, ...
Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
Protobuf model input and output names prefixed with % to match code model names.
-------------
Changes:
- all: https://git.openjdk.org/babylon/pull/378/files
- new: https://git.openjdk.org/babylon/pull/378/files/3c68af28..1b97c6d6
Webrevs:
- full: https://webrevs.openjdk.org/?repo=babylon&pr=378&range=01
- incr: https://webrevs.openjdk.org/?repo=babylon&pr=378&range=00-01
Stats: 2 lines in 2 files changed: 0 ins; 1 del; 1 mod
Patch: https://git.openjdk.org/babylon/pull/378.diff
Fetch: git fetch https://git.openjdk.org/babylon.git pull/378/head:pull/378
PR: https://git.openjdk.org/babylon/pull/378
More information about the babylon-dev
mailing list