Skip to content

Refactor: Move op_configuration.rs from burn-import to onnx-ir #3126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
May 9, 2025

Conversation

antimora
Copy link
Collaborator

@antimora antimora commented Apr 30, 2025

Pull Request Template

Checklist

  • Confirmed that the run-checks all script has been executed.
  • Ensured the book is updated with changes in this PR.

Related Issues/PRs

Fixes #3091

Changes

  1. Moved op_configuration.rs from burn-import to onnx-ir. The onnx-ir module does not depend on any data types from burn-import or burn. Configurations are now organized by node type.
  2. Added unit tests for the moved node configurations.
  3. Relocated rank inference functions to node folders in onnx-ir and added corresponding unit tests.
  4. Updated the developer book and README files.

Testing

  1. Existing integration tests are passing.
  2. New unit tests have been added.

@antimora antimora marked this pull request as draft April 30, 2025 17:08
Copy link

codecov bot commented Apr 30, 2025

Codecov Report

Attention: Patch coverage is 93.16003% with 421 lines in your changes missing coverage. Please review.

Project coverage is 82.15%. Comparing base (78a2f24) to head (86d8c72).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
crates/onnx-ir/src/node/test_utils.rs 65.01% 141 Missing ⚠️
crates/onnx-ir/src/node/conv_transpose1d.rs 82.85% 24 Missing ⚠️
crates/onnx-ir/src/node/padding.rs 78.49% 20 Missing ⚠️
crates/onnx-ir/src/node/constant.rs 80.45% 17 Missing ⚠️
crates/onnx-ir/src/node/reshape.rs 82.55% 15 Missing ⚠️
crates/onnx-ir/src/node/unsqueeze.rs 92.78% 14 Missing ⚠️
crates/onnx-ir/src/node/split.rs 95.59% 13 Missing ⚠️
crates/onnx-ir/src/node/resize.rs 93.20% 11 Missing ⚠️
crates/onnx-ir/src/node/expand.rs 94.28% 10 Missing ⚠️
crates/onnx-ir/src/node/pad.rs 96.60% 9 Missing ⚠️
... and 44 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3126      +/-   ##
==========================================
+ Coverage   81.57%   82.15%   +0.57%     
==========================================
  Files         904      956      +52     
  Lines      118064   121759    +3695     
==========================================
+ Hits        96314   100026    +3712     
+ Misses      21750    21733      -17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@antimora antimora self-assigned this May 2, 2025
@antimora antimora added the onnx label May 2, 2025
@antimora antimora marked this pull request as ready for review May 2, 2025 03:28
@antimora antimora requested review from laggui and Copilot May 2, 2025 03:28
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors configuration usage by moving op_configuration.rs from burn-import to onnx-ir and updates the associated node implementations and tests accordingly. Key changes include replacing direct imports from burn::nn with onnx_ir equivalents, updating test configurations for various convolution and pooling nodes, and revising documentation in both the onnx-tests and contributor guide files.

Reviewed Changes

Copilot reviewed 88 out of 88 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/burn-import/src/burn/node/linear.rs Replaces LinearConfig import from burn::nn with onnx_ir::node::linear::LinearConfig.
crates/burn-import/src/burn/node/layer_norm.rs Updates LayerNorm configuration by importing from onnx_ir instead of burn::nn.
crates/burn-import/src/burn/node/expand.rs Adjusts ExpandShape handling and test configuration to use Argument-based parameters.
crates/burn-import/src/burn/node/dropout.rs Swaps out DropoutConfig import from burn::nn to onnx_ir::node::dropout::DropoutConfig.
crates/burn-import/src/burn/node/conv_transpose_3d.rs Modifies ConvTranspose3d configuration to use a new parameter ordering and values.
crates/burn-import/src/burn/node/conv_transpose_2d.rs Updates ConvTranspose2d configuration with revised parameters and stride values.
... Other files include similar updates for conv1d/conv2d/conv3d, pooling nodes, and documentation updates.
Comments suppressed due to low confidence (2)

crates/burn-import/src/burn/node/conv_transpose_3d.rs:186

  • The stride values are set to [0, 0, 0] which may result in invalid behavior during execution. Verify whether a zero stride is intentional or if non-zero values should be used.
.with_stride([0, 0, 0])

crates/burn-import/src/burn/node/conv_transpose_2d.rs:186

  • Stride values are set to [0, 0] which might cause incorrect behavior. Confirm that a zero stride is intended for this configuration.
.with_stride([0, 0])

Copy link
Member

@laggui laggui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lot of lines to go over to essentially 1) move the node configs to onnx-ir and 2) move the node rank inference functions from rank_inference.rs to a file per node 😅

I understand the objective to get onnx-ir standalone (no dependency to burn), but I have some comments below.

@antimora antimora requested a review from laggui May 8, 2025 19:29
Copy link
Member

@laggui laggui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The node builder pattern is a big improvement, thanks! This addresses my main concern.

@antimora antimora merged commit f18cb7f into tracel-ai:main May 9, 2025
11 checks passed
Helios113 pushed a commit to Helios113/burn that referenced this pull request Jul 1, 2025
…l-ai#3126)

* Move conv1d, avg_pool1d, max_pool1d and conv_transpose1d to onnx-ir

* Fix format

* Fix format

* Move conv1d rank update

* Move conv_transpose1d_update_outputs

* Removed and replaced as same_as_input

* Move op config from burn-import

* Moved 2d and 3d config functions

* Move some config functions to node

* Moved op configs to individual node modules

Still remaining:

expand_config
tile_config
top_k_config
trilu_config
pad_config
unsqueeze_config
split_config

* Break down reduce module into individual modules

* Move rank inference functions

* Move rank updates to node module

* Add documentation

* Repoint config function from onnx-ir

* Remove burn types from onnx-ir

* Fixed left over tests

* No default init for config structs

* Fix format

* remove op_configuration.rs

* Decouple burn-import types from op_configuration

* Moved remaining configs from burn-import to onnx-ir

* Update the documentation

* Remove "Features" section

* Converted links to resources

* Remove deadcode

* Shorten burn-import readme

* Remove inline comments

* Add NodeBuilder and refactor test code

* Refactor tests to use NodeBuilder

* Refactored tests to use NodeBuilder

* Refactored tests to use NodeBuilder

* Refactored tests to use NodeBuilder

* Refactored tests to use NodeBuilder

* Refactored tests to use NodeBuilder

* Refactored tests to use NodeBuilder

* Remove inline comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move op_configuration.rs from burn-import to onnx-ir
2 participants