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

Fix/inplace generation. #45

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions crates/cubecl-macros/src/codegen_function/launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,18 +299,6 @@ impl Codegen {
let mut inputs: std::collections::BTreeMap<usize, std::sync::Arc<dyn core::any::Any>> = std::collections::BTreeMap::new();
let mut outputs: std::collections::BTreeMap<usize, std::sync::Arc<dyn core::any::Any>> = std::collections::BTreeMap::new();

for mapping in self.settings.mappings.iter() {
if !inputs.contains_key(&mapping.pos_input) {
inputs.insert(
mapping.pos_input,
#register_input_call(&mut builder, &self.settings, mapping.pos_input),
);
}

let input = inputs.get(&mapping.pos_input).unwrap();
outputs.insert(mapping.pos_output, input.clone());
}

#register_input
#register_output
};
Expand All @@ -325,6 +313,13 @@ impl Codegen {
});
}

tokens.extend(quote::quote! {
for mapping in self.settings.mappings.iter() {
let input = inputs.get(&mapping.pos_input).unwrap();
outputs.insert(mapping.pos_output, input.clone());
}
});

if num_outputs > 0 {
tokens.extend(quote::quote! {
for i in 0..#num_outputs {
Expand Down
Loading