Skip to content

Commit

Permalink
Remove register-sized CUDA kernel args check, unnecessary since rust-…
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr committed Sep 14, 2023
1 parent d7f1e70 commit 0bf3e0d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 59 deletions.
8 changes: 7 additions & 1 deletion examples/single-source/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ pub struct Empty([u8; 0]);
#[layout(crate = "rc::const_type_layout")]
pub struct Tuple(u32, i32);

#[repr(C)]
#[derive(rc::const_type_layout::TypeLayout)]
#[layout(crate = "rc::const_type_layout")]
pub struct Triple(i32, i32, i32);

#[rc::common::kernel(use link_kernel! as impl Kernel<KernelArgs, KernelPtx> for Launcher)]
#[kernel(crate = "rc")]
#[kernel(
Expand All @@ -56,6 +61,7 @@ pub fn kernel<'a, T: rc::common::RustToCuda>(
#[kernel(pass = SafeDeviceCopy, jit)] _v @ _w: &'a core::sync::atomic::AtomicU64,
#[kernel(pass = LendRustToCuda)] _: Wrapper<T>,
#[kernel(pass = SafeDeviceCopy)] Tuple(s, mut __t): Tuple,
#[kernel(pass = SafeDeviceCopy)] q: Triple,
// #[kernel(pass = SafeDeviceCopy)] shared3: ThreadBlockShared<u32>,
) where
T: rc::safety::StackOnly + rc::safety::NoAliasing,
Expand All @@ -70,7 +76,7 @@ pub fn kernel<'a, T: rc::common::RustToCuda>(
(*shared.index_mut_unchecked(1)).0 = (f64::from(s) * 2.0) as u32;
}
unsafe {
(*shared2.index_mut_unchecked(2)).1 = 24;
(*shared2.index_mut_unchecked(2)).1 = q.0 + q.1 + q.2;
}
// unsafe { core::arch::asm!("hi") }
// unsafe {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,8 @@ pub(super) fn quote_kernel_func_async(
#[allow(dead_code)]
fn assert_impl_no_aliasing<T: #crate_path::safety::NoAliasing>() {}

#[allow(dead_code)]
fn assert_impl_fits_into_device_register<
T: #crate_path::safety::FitsIntoDeviceRegister,
>(_val: &T) {}

#(assert_impl_devicecopy(&#func_params);)*
#(assert_impl_no_aliasing::<#cpu_func_unboxed_types>();)*
#(assert_impl_fits_into_device_register(&#func_params);)*
}

let #crate_path::host::LaunchConfig {
Expand Down
6 changes: 0 additions & 6 deletions rust-cuda-derive/src/kernel/wrapper/generate/cuda_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,8 @@ pub(in super::super) fn quote_cuda_wrapper(
#[allow(dead_code)]
fn assert_impl_no_aliasing<T: #crate_path::safety::NoAliasing>() {}

#[allow(dead_code)]
fn assert_impl_fits_into_device_register<
T: #crate_path::safety::FitsIntoDeviceRegister,
>(_val: &T) {}

#(assert_impl_devicecopy(&#func_params);)*
#(assert_impl_no_aliasing::<#ptx_func_unboxed_types>();)*
#(assert_impl_fits_into_device_register(&#func_params);)*
}

#ptx_func_input_unwrap
Expand Down
2 changes: 0 additions & 2 deletions src/safety/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
mod arch;
mod device_copy;
mod no_aliasing;
mod register_fit;
mod stack_only;
#[cfg(any(feature = "alloc", doc))]
mod unified_heap;
Expand All @@ -13,7 +12,6 @@ pub mod type_layout;

pub use device_copy::SafeDeviceCopy;
pub use no_aliasing::NoAliasing;
pub use register_fit::FitsIntoDeviceRegister;
pub use stack_only::StackOnly;
#[cfg(any(feature = "alloc", doc))]
pub use unified_heap::UnifiedHeapOnly;
44 changes: 0 additions & 44 deletions src/safety/register_fit.rs

This file was deleted.

0 comments on commit 0bf3e0d

Please sign in to comment.