diff --git a/crates/cubecl-core/tests/frontend/kernel.rs b/crates/cubecl-core/tests/frontend/kernel.rs new file mode 100644 index 000000000..f82b2562a --- /dev/null +++ b/crates/cubecl-core/tests/frontend/kernel.rs @@ -0,0 +1,9 @@ +use cubecl::prelude::*; +use cubecl_core as cubecl; + +#[cube(launch)] +pub fn with_kernel(kernel: &mut Array) { + if ABSOLUTE_POS > kernel.len() { + kernel[ABSOLUTE_POS] = F::cast_from(5.0); + } +} diff --git a/crates/cubecl-core/tests/frontend/mod.rs b/crates/cubecl-core/tests/frontend/mod.rs index 90338543b..5da180cd0 100644 --- a/crates/cubecl-core/tests/frontend/mod.rs +++ b/crates/cubecl-core/tests/frontend/mod.rs @@ -12,6 +12,7 @@ mod function_call; mod generic_kernel; mod r#if; mod intrinsics; +mod kernel; mod literal; mod r#loop; mod module_import; diff --git a/crates/cubecl-macros/src/generate/launch.rs b/crates/cubecl-macros/src/generate/launch.rs index 698087431..7032b99bc 100644 --- a/crates/cubecl-macros/src/generate/launch.rs +++ b/crates/cubecl-macros/src/generate/launch.rs @@ -69,7 +69,7 @@ impl Launch { #(#args),* ) -> () { #body - launcher.launch(__cube_count, kernel, __client); + launcher.launch(__cube_count, __kernel, __client); } } } else { @@ -101,7 +101,7 @@ impl Launch { #(#args),* ) -> () { #body - launcher.launch_unchecked(__cube_count, kernel, __client); + launcher.launch_unchecked(__cube_count, __kernel, __client); } } } else { @@ -136,7 +136,7 @@ impl Launch { #settings #compilation_args - let kernel = #kernel_name #kernel_generics::new(__settings, #args #(#comptime_args),*); + let __kernel = #kernel_name #kernel_generics::new(__settings, #args #(#comptime_args),*); let mut launcher = #kernel_launcher::<__R>::default();