Skip to content

Perf: Fusion search for composed optimization #3258

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 33 commits into from
Jun 6, 2025

Conversation

nathanielsimard
Copy link
Member

@nathanielsimard nathanielsimard commented Jun 5, 2025

I added the ability to re-order operations in the execution stream to find more optimizations.

For the custom GELU fusion benchmarks, if I put an unrelated tensor operation in the middle of the computation, I get a 3x slowdown with the old method, since it broke fusion. With these changes, I don't experience any slowdown since the unrelated operation executes out of order.

@nathanielsimard nathanielsimard requested a review from laggui June 5, 2025 16:31
Copy link

codecov bot commented Jun 5, 2025

Codecov Report

Attention: Patch coverage is 89.77177% with 121 lines in your changes missing coverage. Please review.

Project coverage is 82.32%. Comparing base (d8dc28c) to head (3b9d523).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...es/burn-cubecl-fusion/src/shared/trace/executor.rs 17.14% 29 Missing ⚠️
crates/burn-fusion/src/search/merging.rs 91.18% 29 Missing ⚠️
crates/burn-fusion/src/stream/context.rs 60.71% 11 Missing ⚠️
crates/burn-cubecl-fusion/src/base.rs 37.50% 10 Missing ⚠️
...ates/burn-fusion/src/search/optimization/stream.rs 94.81% 10 Missing ⚠️
crates/burn-fusion/src/search/block.rs 95.03% 8 Missing ⚠️
...ates/burn-cubecl-fusion/src/reduce/optimization.rs 33.33% 6 Missing ⚠️
crates/burn-fusion/src/stream/execution/tests.rs 95.34% 4 Missing ⚠️
crates/burn-cubecl-fusion/src/shared/builder.rs 0.00% 3 Missing ⚠️
crates/burn-fusion/src/backend.rs 0.00% 3 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3258      +/-   ##
==========================================
+ Coverage   82.22%   82.32%   +0.09%     
==========================================
  Files         973      978       +5     
  Lines      124018   124864     +846     
==========================================
+ Hits       101971   102790     +819     
- Misses      22047    22074      +27     

☔ 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.

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.

All CI failures are unrelated to the changes in this PR 🙃

Windows and mac failed because the url is unreachable for the text-generation example tokenizer.

Linux failed on tests::cube::kernel::bernoulli::tests::wald_wolfowitz_runs_test (seems to be failing intermittently since the kernel was ported to cubecl repo).

Gonna re-run the jobs for sanity.

@nathanielsimard nathanielsimard merged commit 1f5ccd4 into main Jun 6, 2025
16 of 20 checks passed
@nathanielsimard nathanielsimard deleted the feat/fusion-composed-opt branch June 6, 2025 15:38
Helios113 pushed a commit to Helios113/burn that referenced this pull request Jul 1, 2025
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