Skip to content
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

Feat/op fusion decorator #939

Merged
merged 43 commits into from
Nov 10, 2023
Merged

Feat/op fusion decorator #939

merged 43 commits into from
Nov 10, 2023

Conversation

nathanielsimard
Copy link
Member

@nathanielsimard nathanielsimard commented Nov 9, 2023

Burn Fusion

A new backend decorator to perform graph optimizations on a stream of operations. Backends that want to support this functionality can implement the new FusionBackend trait in addition to the Backend trait.

This allows the backend to provide a list of potential optimizations to be performed instead of executing a list of normal backend operations.

For now, only the Wgpu backend implements the new trait, but it allows to actually test that the new backend works even without optimizations.

Following PRs will bring new optimizations to the Wgpu backend 🔥

Overhead ?

There is some framework overhead introduced by this decorator, but since most backends are async, it shouldn't impact the speed of execution. In fact, I enabled the new backend decorator on the text classification example and the training time isn't longer than before.

The actual overhead introduced is very minimal and is constant per operation. We will introduce a cache to reduce the overhead of fusion operation implementations #935

@nathanielsimard nathanielsimard marked this pull request as draft November 9, 2023 15:18
@nathanielsimard nathanielsimard marked this pull request as ready for review November 9, 2023 16:58
Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Attention: 346 lines in your changes are missing coverage. Please review.

Comparison is base (c4bc96e) 86.44% compared to head (a3e441f) 87.25%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #939      +/-   ##
==========================================
+ Coverage   86.44%   87.25%   +0.81%     
==========================================
  Files         470      486      +16     
  Lines       44326    49666    +5340     
==========================================
+ Hits        38317    43336    +5019     
- Misses       6009     6330     +321     
Files Coverage Δ
burn-fusion/src/ops/binary.rs 100.00% <100.00%> (ø)
burn-fusion/src/ops/module.rs 100.00% <100.00%> (ø)
burn-fusion/src/ops/unary.rs 100.00% <100.00%> (ø)
burn-tensor/src/tensor/ops/modules/conv.rs 99.42% <100.00%> (+0.01%) ⬆️
burn-tensor/src/tensor/shape.rs 84.44% <100.00%> (+2.86%) ⬆️
burn-wgpu/src/lib.rs 100.00% <ø> (ø)
burn-wgpu/src/tensor/base.rs 78.57% <ø> (+13.86%) ⬆️
burn-tensor/src/tensor/data.rs 87.55% <0.00%> (ø)
burn-train/src/renderer/tui/progress.rs 43.75% <75.00%> (ø)
burn-wgpu/src/fusion.rs 93.54% <93.54%> (ø)
... and 12 more

... and 2 files with indirect coverage changes

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

Copy link
Member

@louisfd louisfd left a comment

Choose a reason for hiding this comment

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

I've committed my (superficial) change requests, so it's good to go!

@louisfd louisfd merged commit 322480b into main Nov 10, 2023
9 checks passed
@nathanielsimard nathanielsimard deleted the feat/op-fusion-decorator branch November 17, 2023 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants