Skip to content

Commit

Permalink
Fusion experimental feature flag (#2690)
Browse files Browse the repository at this point in the history
* Fusion experimental feature flag

* Minor change to vec init

---------

Co-authored-by: Guillaume Lagrange <[email protected]>
  • Loading branch information
nathanielsimard and laggui authored Jan 13, 2025
1 parent ad89dcc commit 28f2b67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions crates/burn-jit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export_tests = [
"paste",
]
fusion = ["burn-fusion"]
fusion-experimental = ["fusion"]

std = ["cubecl/std"]
template = []

Expand Down
16 changes: 10 additions & 6 deletions crates/burn-jit/src/fusion/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,20 @@ impl<R: JitRuntime, BT: BoolElement> FusionRuntime for FusionJitRuntime<R, BT> {
fn optimizations(
device: R::Device,
) -> Vec<Box<dyn burn_fusion::OptimizationBuilder<Self::Optimization>>> {
vec![
Box::new(ElementWiseBuilder::<R>::new(
let mut optimizations: Vec<Box<dyn burn_fusion::OptimizationBuilder<Self::Optimization>>> =
vec![Box::new(ElementWiseBuilder::<R>::new(
device.clone(),
BT::as_elem_native_unchecked().into(),
)),
Box::new(MatmulBuilder::<R>::new(
))];

if cfg!(feature = "fusion-experimental") {
optimizations.push(Box::new(MatmulBuilder::<R>::new(
device.clone(),
BT::as_elem_native_unchecked().into(),
)),
]
)));
}

optimizations
}
}

Expand Down

0 comments on commit 28f2b67

Please sign in to comment.