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

Refactor/fusion optimization #1104

Merged
merged 11 commits into from Jan 6, 2024
Merged

Conversation

nathanielsimard
Copy link
Member

Refactor the fusion operation to support saving the state of the JIT cache so that we can reduce cold start. This is also necessary if we want to combine fusion with autotune, which is planned, since the autotune cache should share the same generated ID from the dynamically created kernel.

This PR doesn't actually save anything, but it makes everything serializable and deserializable with the correct ID. The refactor consists mostly of removing dyn Trait so that we can actually serialize things. The dynamic trait is replaced with an enum, which makes sense in this context.

Also found a bug with burn-fusion when changing the device, so corrected that as well.

Copy link
Member

@syl20bnr syl20bnr left a comment

Choose a reason for hiding this comment

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

LGTM, great work !
I suppose we will add tests when saving and loading are implemented ?

spin = { workspace = true }
log = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
serde_json = { workspace = true }
serde = {workspace = true, features = ["std", "derive"]}
serde_json = {workspace = true, features = ["std"]}

Copy link

codecov bot commented Jan 6, 2024

Codecov Report

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

Comparison is base (220ce25) 85.73% compared to head (ee05e0c) 85.59%.

Files Patch % Lines
burn-fusion/src/graph/cache/persistent.rs 0.00% 46 Missing ⚠️
burn-wgpu/src/fusion/elemwise/optimization.rs 37.77% 28 Missing ⚠️
burn-fusion/src/client/mutex.rs 0.00% 18 Missing ⚠️
burn-wgpu/src/fusion/base.rs 45.83% 13 Missing ⚠️
burn-wgpu/src/codegen/shader.rs 16.66% 5 Missing ⚠️
burn-fusion/src/graph/ops.rs 97.43% 3 Missing ⚠️
burn-fusion/src/graph/cache/base.rs 66.66% 1 Missing ⚠️
burn-fusion/src/ops/int.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1104      +/-   ##
==========================================
- Coverage   85.73%   85.59%   -0.14%     
==========================================
  Files         511      512       +1     
  Lines       55825    55968     +143     
==========================================
+ Hits        47860    47908      +48     
- Misses       7965     8060      +95     

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

@nathanielsimard nathanielsimard merged commit f0e10f1 into main Jan 6, 2024
14 of 15 checks passed
@nathanielsimard nathanielsimard deleted the refactor/fusion-optimization branch January 6, 2024 19:22
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.

None yet

2 participants