Skip to content

Commit fb9461a

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

File tree

5 files changed

+7
-70
lines changed

5 files changed

+7
-70
lines changed

examples/single-source/src/main.rs

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

41+
#[repr(C)]
42+
#[derive(rc::const_type_layout::TypeLayout)]
43+
#[layout(crate = "rc::const_type_layout")]
44+
pub struct Triple(i32, i32, i32);
45+
4146
#[rc::common::kernel(use link_kernel! as impl Kernel<KernelArgs, KernelPtx> for Launcher)]
4247
#[kernel(crate = "rc")]
4348
#[kernel(
@@ -51,6 +56,7 @@ pub fn kernel<'a, T: rc::common::RustToCuda>(
5156
#[kernel(pass = SafeDeviceCopy, jit)] _v @ _w: &'a core::sync::atomic::AtomicU64,
5257
#[kernel(pass = LendRustToCuda)] _: Wrapper<T>,
5358
#[kernel(pass = SafeDeviceCopy)] Tuple(s, mut __t): Tuple,
59+
#[kernel(pass = SafeDeviceCopy)] q: Triple,
5460
// #[kernel(pass = SafeDeviceCopy)] shared3: ThreadBlockShared<u32>,
5561
) where
5662
T: rc::safety::StackOnly + rc::safety::NoAliasing,
@@ -65,7 +71,7 @@ pub fn kernel<'a, T: rc::common::RustToCuda>(
6571
(*shared.index_mut_unchecked(1)).0 = (f64::from(s) * 2.0) as u32;
6672
}
6773
unsafe {
68-
(*shared2.index_mut_unchecked(2)).1 = 24;
74+
(*shared2.index_mut_unchecked(2)).1 = q.0 + q.1 + q.2;
6975
}
7076
// unsafe { core::arch::asm!("hi") }
7177
// 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

-55
This file was deleted.

0 commit comments

Comments
 (0)