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

Add more type support for burn-jit #2454

Merged
merged 30 commits into from
Nov 4, 2024

Conversation

wingertge
Copy link
Contributor

@wingertge wingertge commented Nov 2, 2024

Pull Request Template

Checklist

  • Confirmed that run-checks all script has been executed.
  • Made sure the book is up to date with changes in this PR.

Related Issues/PRs

Implements the new types and parameterized testing from tracel-ai/cubecl#207

Changes

Adds support for flex32, i8, i16, i64, u8, u16, u64 support to burn, parameterize tests to ensure all types work correctly

Testing

New parameterized tests

@wingertge wingertge marked this pull request as ready for review November 2, 2024 18:27
Copy link

codecov bot commented Nov 2, 2024

Codecov Report

Attention: Patch coverage is 66.40212% with 508 lines in your changes missing coverage. Please review.

Project coverage is 84.83%. Comparing base (5597657) to head (336265e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/burn-jit/src/fusion/on_write/io.rs 0.00% 182 Missing ⚠️
crates/burn-jit/src/fusion/on_write/kernel.rs 0.00% 138 Missing ⚠️
crates/burn-tensor/src/tensor/element/cast.rs 0.00% 30 Missing ⚠️
crates/burn-jit/src/fusion/on_write/trace.rs 46.29% 29 Missing ⚠️
...rates/burn-jit/src/fusion/elemwise/optimization.rs 6.66% 28 Missing ⚠️
crates/burn-tensor/src/tensor/data.rs 57.89% 24 Missing ⚠️
...s/burn-jit/src/kernel/conv/conv2d/implicit_gemm.rs 0.00% 16 Missing ⚠️
crates/burn-jit/src/fusion/on_write/ir.rs 14.28% 12 Missing ⚠️
crates/burn-tensor/src/tensor/element/base.rs 0.00% 10 Missing ⚠️
crates/burn-fusion/src/stream/context.rs 71.42% 8 Missing ⚠️
... and 12 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2454      +/-   ##
==========================================
- Coverage   85.29%   84.83%   -0.47%     
==========================================
  Files         793      793              
  Lines      104645   105193     +548     
==========================================
- Hits        89260    89243      -17     
- Misses      15385    15950     +565     

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

@wingertge wingertge mentioned this pull request Nov 3, 2024
2 tasks
crates/burn-core/src/optim/adam.rs Outdated Show resolved Hide resolved
crates/burn-cuda/src/lib.rs Outdated Show resolved Hide resolved
Comment on lines +424 to +435
SequenceArg::new(),
SequenceArg::new(),
SequenceArg::new(),
SequenceArg::new(),
SequenceArg::new(),
SequenceArg::new(),
SequenceArg::new(),
SequenceArg::new(),
SequenceArg::new(),
SequenceArg::new(),
SequenceArg::new(),
SequenceArg::new(),
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if there is a better way to do this 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tbh I don't understand fusion at all, so I just copied what was there for all the new types 😅

Copy link
Member

Choose a reason for hiding this comment

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

It's simply that each precision has its state. It would be cleaner to have a map Map<ElemenType, State>, instead of listing all posibilities. I'll think how I can refactor it, but not in this PR.

use super::*;
use burn_jit::tests::{burn_autodiff, burn_fusion, burn_ndarray, burn_tensor};

pub type TestBackend = burn_fusion::Fusion<JitBackend<TestRuntime, f32, i32>>;
pub type TestBackend2<F, I> = burn_fusion::Fusion<JitBackend<TestRuntime, F, I>>;
Copy link
Member

Choose a reason for hiding this comment

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

TestBackend2 is the one that can be injected with the precision right? Not sure if we could come up with a better name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't come up with a better name and it's only used in the macro to instantiate and override TestBackend with the correct types, so I left it for now. It's not used in the actual tests, just the macro.

@nathanielsimard nathanielsimard merged commit 42f39f1 into tracel-ai:main Nov 4, 2024
11 checks passed
@wingertge wingertge deleted the feat/new-types branch November 5, 2024 11:29
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