Skip to content

Commit fbe0c26

Browse files
committed
Remove register-sized CUDA kernel args check, unnecessary since rust-lang/rust#94703
1 parent a95da20 commit fbe0c26

File tree

5 files changed

+7
-59
lines changed

5 files changed

+7
-59
lines changed

examples/single-source/src/main.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ pub struct Empty([u8; 0]);
4343
#[layout(crate = "rc::const_type_layout")]
4444
pub struct Tuple(u32, i32);
4545

46+
#[repr(C)]
47+
#[derive(rc::const_type_layout::TypeLayout)]
48+
#[layout(crate = "rc::const_type_layout")]
49+
pub struct Triple(i32, i32, i32);
50+
4651
#[rc::common::kernel(use link_kernel! as impl Kernel<KernelArgs, KernelPtx> for Launcher)]
4752
#[kernel(crate = "rc")]
4853
#[kernel(
@@ -56,6 +61,7 @@ pub fn kernel<'a, T: rc::common::RustToCuda>(
5661
#[kernel(pass = SafeDeviceCopy, jit)] _v @ _w: &'a core::sync::atomic::AtomicU64,
5762
#[kernel(pass = LendRustToCuda)] _: Wrapper<T>,
5863
#[kernel(pass = SafeDeviceCopy)] Tuple(s, mut __t): Tuple,
64+
#[kernel(pass = SafeDeviceCopy)] q: Triple,
5965
// #[kernel(pass = SafeDeviceCopy)] shared3: ThreadBlockShared<u32>,
6066
) where
6167
T: rc::safety::StackOnly + rc::safety::NoAliasing,
@@ -70,7 +76,7 @@ pub fn kernel<'a, T: rc::common::RustToCuda>(
7076
(*shared.index_mut_unchecked(1)).0 = (f64::from(s) * 2.0) as u32;
7177
}
7278
unsafe {
73-
(*shared2.index_mut_unchecked(2)).1 = 24;
79+
(*shared2.index_mut_unchecked(2)).1 = q.0 + q.1 + q.2;
7480
}
7581
// unsafe { core::arch::asm!("hi") }
7682
// unsafe {

rust-cuda-derive/src/kernel/wrapper/generate/cpu_wrapper/kernel_func_async/mod.rs

-6
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,8 @@ pub(super) fn quote_kernel_func_async(
102102
#[allow(dead_code)]
103103
fn assert_impl_no_aliasing<T: #crate_path::safety::NoAliasing>() {}
104104

105-
#[allow(dead_code)]
106-
fn assert_impl_fits_into_device_register<
107-
T: #crate_path::safety::FitsIntoDeviceRegister,
108-
>(_val: &T) {}
109-
110105
#(assert_impl_devicecopy(&#func_params);)*
111106
#(assert_impl_no_aliasing::<#cpu_func_unboxed_types>();)*
112-
#(assert_impl_fits_into_device_register(&#func_params);)*
113107
}
114108

115109
let #crate_path::host::LaunchConfig {

rust-cuda-derive/src/kernel/wrapper/generate/cuda_wrapper.rs

-6
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,8 @@ pub(in super::super) fn quote_cuda_wrapper(
136136
#[allow(dead_code)]
137137
fn assert_impl_no_aliasing<T: #crate_path::safety::NoAliasing>() {}
138138

139-
#[allow(dead_code)]
140-
fn assert_impl_fits_into_device_register<
141-
T: #crate_path::safety::FitsIntoDeviceRegister,
142-
>(_val: &T) {}
143-
144139
#(assert_impl_devicecopy(&#func_params);)*
145140
#(assert_impl_no_aliasing::<#ptx_func_unboxed_types>();)*
146-
#(assert_impl_fits_into_device_register(&#func_params);)*
147141
}
148142

149143
#ptx_func_input_unwrap

src/safety/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mod arch;
22
mod device_copy;
33
mod no_aliasing;
4-
mod register_fit;
54
mod stack_only;
65
#[cfg(any(feature = "alloc", doc))]
76
mod unified_heap;
@@ -13,7 +12,6 @@ pub mod type_layout;
1312

1413
pub use device_copy::SafeDeviceCopy;
1514
pub use no_aliasing::NoAliasing;
16-
pub use register_fit::FitsIntoDeviceRegister;
1715
pub use stack_only::StackOnly;
1816
#[cfg(any(feature = "alloc", doc))]
1917
pub use unified_heap::UnifiedHeapOnly;

src/safety/register_fit.rs

-44
This file was deleted.

0 commit comments

Comments
 (0)