[code-reflection] Integrated: Support for Onnx functions
Adam Sotona
asotona at openjdk.org
Tue Apr 15 04:49:01 UTC 2025
On Fri, 4 Apr 2025 09:18:54 GMT, Adam Sotona <asotona at openjdk.org> wrote:
> 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>, ...
This pull request has now been integrated.
Changeset: ddad895d
Author: Adam Sotona <asotona at openjdk.org>
URL: https://git.openjdk.org/babylon/commit/ddad895d66529fdd297b7a02219f19c7e79238cf
Stats: 486 lines in 8 files changed: 314 ins; 78 del; 94 mod
Support for Onnx functions
-------------
PR: https://git.openjdk.org/babylon/pull/378
More information about the babylon-dev
mailing list