Skip to content

Commit 2a124b6

Browse files
committed
Update const-type-layout to v0.3.2
1 parent 57a16a9 commit 2a124b6

File tree

4 files changed

+151
-62
lines changed

4 files changed

+151
-62
lines changed

.github/workflows/rustdoc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
run: |
3636
RUSTDOCFLAGS="\
3737
--enable-index-page \
38-
--extern-html-root-url const_type_layout=https://docs.rs/const-type-layout/0.3.1/ \
38+
--extern-html-root-url const_type_layout=https://docs.rs/const-type-layout/0.3.2/ \
3939
--extern-html-root-url final=https://docs.rs/final/0.1.1/ \
4040
--extern-html-root-url rustacuda=https://docs.rs/rustacuda/0.1.3/ \
4141
--extern-html-root-url rustacuda_core=https://docs.rs/rustacuda_core/0.1.2/ \

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ rustacuda_derive = { git = "https://github.com/juntyr/RustaCUDA", rev = "c6ea7cc
3333

3434
regex = { version = "1.10", optional = true }
3535

36-
const-type-layout = { version = "0.3.1", features = ["derive"] }
36+
const-type-layout = { version = "0.3.2", features = ["derive"] }
3737

3838
safer_owning_ref = { version = "0.5", optional = true }
3939
oneshot = { version = "0.1", optional = true, features = ["std", "async"] }

rust-cuda-derive/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ mod rust_to_cuda;
109109
/// [`rust_cuda::lend::LendToCuda`]: https://juntyr.github.io/rust-cuda/rust_cuda/lend/trait.LendToCuda.html
110110
/// [`rust-cuda`]: https://juntyr.github.io/rust-cuda/rust_cuda
111111
/// [`rust_cuda::lend::RustToCudaAsync`]: https://juntyr.github.io/rust-cuda/rust_cuda/lend/trait.RustToCudaAsync.html
112-
/// [`#derive(const_type_layout::TypeLayout)`]: https://docs.rs/const-type-layout/0.3.1/const_type_layout/derive.TypeLayout.html
112+
/// [`#derive(const_type_layout::TypeLayout)`]: https://docs.rs/const-type-layout/0.3.2/const_type_layout/derive.TypeLayout.html
113113
/// [`rust_cuda::lend::RustToCuda::CudaRepresentation`]: https://juntyr.github.io/rust-cuda/rust_cuda/lend/trait.RustToCuda.html#associatedtype.CudaRepresentation
114114
/// [`rust_cuda::safety::PortableBitSemantics`]: https://juntyr.github.io/rust-cuda/rust_cuda/safety/trait.PortableBitSemantics.html
115-
/// [`const_type_layout::TypeGraphLayout`]: https://docs.rs/const-type-layout/0.3.1/const_type_layout/trait.TypeGraphLayout.html
115+
/// [`const_type_layout::TypeGraphLayout`]: https://docs.rs/const-type-layout/0.3.2/const_type_layout/trait.TypeGraphLayout.html
116116
/// [`rust_cuda::lend::RustToCudaProxy`]: https://juntyr.github.io/rust-cuda/rust_cuda/lend/trait.RustToCudaProxy.html
117117
pub fn rust_to_cuda_derive(input: TokenStream) -> TokenStream {
118118
// Note: We cannot report a more precise span yet

src/kernel/param.rs

Lines changed: 147 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,19 @@ impl<
7171
> CudaKernelParameter for PerThreadShallowCopy<T>
7272
{
7373
#[cfg(feature = "host")]
74-
type AsyncHostType<'stream, 'b> = T where Self: 'b;
74+
type AsyncHostType<'stream, 'b>
75+
= T
76+
where
77+
Self: 'b;
7578
#[cfg(any(feature = "device", doc))]
76-
type DeviceType<'b> = T where Self: 'b;
77-
type FfiType<'stream, 'b> = crate::utils::adapter::RustToCudaWithPortableBitCopySemantics<T> where Self: 'b;
79+
type DeviceType<'b>
80+
= T
81+
where
82+
Self: 'b;
83+
type FfiType<'stream, 'b>
84+
= crate::utils::adapter::RustToCudaWithPortableBitCopySemantics<T>
85+
where
86+
Self: 'b;
7887
#[cfg(feature = "host")]
7988
type SyncHostType = T;
8089

@@ -154,14 +163,19 @@ impl<
154163
> CudaKernelParameter for &'a PerThreadShallowCopy<T>
155164
{
156165
#[cfg(feature = "host")]
157-
type AsyncHostType<'stream, 'b> = crate::utils::r#async::AsyncProj<
158-
'b,
159-
'stream,
160-
crate::host::HostAndDeviceConstRef<'b, T>,
161-
> where Self: 'b;
166+
type AsyncHostType<'stream, 'b>
167+
= crate::utils::r#async::AsyncProj<'b, 'stream, crate::host::HostAndDeviceConstRef<'b, T>>
168+
where
169+
Self: 'b;
162170
#[cfg(any(feature = "device", doc))]
163-
type DeviceType<'b> = &'b T where Self: 'b;
164-
type FfiType<'stream, 'b> = DeviceConstRef<'b, T> where Self: 'b;
171+
type DeviceType<'b>
172+
= &'b T
173+
where
174+
Self: 'b;
175+
type FfiType<'stream, 'b>
176+
= DeviceConstRef<'b, T>
177+
where
178+
Self: 'b;
165179
#[cfg(feature = "host")]
166180
type SyncHostType = &'a T;
167181

@@ -242,12 +256,19 @@ impl<
242256
> CudaKernelParameter for &'a PtxJit<PerThreadShallowCopy<T>>
243257
{
244258
#[cfg(feature = "host")]
245-
type AsyncHostType<'stream, 'b> =
246-
<&'a PerThreadShallowCopy<T> as CudaKernelParameter>::AsyncHostType<'stream, 'b> where Self: 'b;
259+
type AsyncHostType<'stream, 'b>
260+
= <&'a PerThreadShallowCopy<T> as CudaKernelParameter>::AsyncHostType<'stream, 'b>
261+
where
262+
Self: 'b;
247263
#[cfg(any(feature = "device", doc))]
248-
type DeviceType<'b> = <&'a PerThreadShallowCopy<T> as CudaKernelParameter>::DeviceType<'b> where Self: 'b;
249-
type FfiType<'stream, 'b> =
250-
<&'a PerThreadShallowCopy<T> as CudaKernelParameter>::FfiType<'stream, 'b> where Self: 'b;
264+
type DeviceType<'b>
265+
= <&'a PerThreadShallowCopy<T> as CudaKernelParameter>::DeviceType<'b>
266+
where
267+
Self: 'b;
268+
type FfiType<'stream, 'b>
269+
= <&'a PerThreadShallowCopy<T> as CudaKernelParameter>::FfiType<'stream, 'b>
270+
where
271+
Self: 'b;
251272
#[cfg(feature = "host")]
252273
type SyncHostType = <&'a PerThreadShallowCopy<T> as CudaKernelParameter>::SyncHostType;
253274

@@ -363,14 +384,19 @@ impl<
363384
> CudaKernelParameter for &'a ShallowInteriorMutable<T>
364385
{
365386
#[cfg(feature = "host")]
366-
type AsyncHostType<'stream, 'b> = crate::utils::r#async::AsyncProj<
367-
'b,
368-
'stream,
369-
crate::host::HostAndDeviceConstRef<'b, T>
370-
> where Self: 'b;
387+
type AsyncHostType<'stream, 'b>
388+
= crate::utils::r#async::AsyncProj<'b, 'stream, crate::host::HostAndDeviceConstRef<'b, T>>
389+
where
390+
Self: 'b;
371391
#[cfg(any(feature = "device", doc))]
372-
type DeviceType<'b> = &'b T where Self: 'b;
373-
type FfiType<'stream, 'b> = DeviceConstRef<'b, T> where Self: 'b;
392+
type DeviceType<'b>
393+
= &'b T
394+
where
395+
Self: 'b;
396+
type FfiType<'stream, 'b>
397+
= DeviceConstRef<'b, T>
398+
where
399+
Self: 'b;
374400
#[cfg(feature = "host")]
375401
/// The kernel takes a mutable borrow of the interior mutable data to ensure
376402
/// the interior mutability is limited to just this kernel invocation.
@@ -498,19 +524,27 @@ impl<
498524
> CudaKernelParameter for DeepPerThreadBorrow<T>
499525
{
500526
#[cfg(feature = "host")]
501-
type AsyncHostType<'stream, 'b> = crate::utils::r#async::Async<
527+
type AsyncHostType<'stream, 'b>
528+
= crate::utils::r#async::Async<
502529
'b,
503530
'stream,
504531
crate::host::HostAndDeviceOwned<
505532
'b,
506533
DeviceAccessible<<T as RustToCuda>::CudaRepresentation>,
507534
>,
508535
crate::utils::r#async::NoCompletion,
509-
> where Self: 'b;
536+
>
537+
where
538+
Self: 'b;
510539
#[cfg(any(feature = "device", doc))]
511-
type DeviceType<'b> = T where Self: 'b;
512-
type FfiType<'stream, 'b> =
513-
DeviceOwnedRef<'b, DeviceAccessible<<T as RustToCuda>::CudaRepresentation>> where Self: 'b;
540+
type DeviceType<'b>
541+
= T
542+
where
543+
Self: 'b;
544+
type FfiType<'stream, 'b>
545+
= DeviceOwnedRef<'b, DeviceAccessible<<T as RustToCuda>::CudaRepresentation>>
546+
where
547+
Self: 'b;
514548
#[cfg(feature = "host")]
515549
type SyncHostType = T;
516550

@@ -586,18 +620,26 @@ impl<
586620

587621
impl<'a, T: Sync + RustToCuda> CudaKernelParameter for &'a DeepPerThreadBorrow<T> {
588622
#[cfg(feature = "host")]
589-
type AsyncHostType<'stream, 'b> = crate::utils::r#async::AsyncProj<
623+
type AsyncHostType<'stream, 'b>
624+
= crate::utils::r#async::AsyncProj<
590625
'b,
591626
'stream,
592627
crate::host::HostAndDeviceConstRef<
593628
'b,
594629
DeviceAccessible<<T as RustToCuda>::CudaRepresentation>,
595630
>,
596-
> where Self: 'b;
631+
>
632+
where
633+
Self: 'b;
597634
#[cfg(any(feature = "device", doc))]
598-
type DeviceType<'b> = &'b T where Self: 'b;
599-
type FfiType<'stream, 'b> =
600-
DeviceConstRef<'b, DeviceAccessible<<T as RustToCuda>::CudaRepresentation>> where Self: 'b;
635+
type DeviceType<'b>
636+
= &'b T
637+
where
638+
Self: 'b;
639+
type FfiType<'stream, 'b>
640+
= DeviceConstRef<'b, DeviceAccessible<<T as RustToCuda>::CudaRepresentation>>
641+
where
642+
Self: 'b;
601643
#[cfg(feature = "host")]
602644
type SyncHostType = &'a T;
603645

@@ -671,18 +713,26 @@ impl<'a, T: Sync + RustToCuda + SafeMutableAliasing> CudaKernelParameter
671713
for &'a mut DeepPerThreadBorrow<T>
672714
{
673715
#[cfg(feature = "host")]
674-
type AsyncHostType<'stream, 'b> = crate::utils::r#async::AsyncProj<
716+
type AsyncHostType<'stream, 'b>
717+
= crate::utils::r#async::AsyncProj<
675718
'b,
676719
'stream,
677720
crate::host::HostAndDeviceMutRef<
678721
'b,
679722
DeviceAccessible<<T as RustToCuda>::CudaRepresentation>,
680723
>,
681-
> where Self: 'b;
724+
>
725+
where
726+
Self: 'b;
682727
#[cfg(any(feature = "device", doc))]
683-
type DeviceType<'b> = &'b mut T where Self: 'b;
684-
type FfiType<'stream, 'b> =
685-
DeviceMutRef<'b, DeviceAccessible<<T as RustToCuda>::CudaRepresentation>> where Self: 'b;
728+
type DeviceType<'b>
729+
= &'b mut T
730+
where
731+
Self: 'b;
732+
type FfiType<'stream, 'b>
733+
= DeviceMutRef<'b, DeviceAccessible<<T as RustToCuda>::CudaRepresentation>>
734+
where
735+
Self: 'b;
686736
#[cfg(feature = "host")]
687737
type SyncHostType = &'a mut T;
688738

@@ -768,12 +818,19 @@ impl<
768818
> CudaKernelParameter for PtxJit<DeepPerThreadBorrow<T>>
769819
{
770820
#[cfg(feature = "host")]
771-
type AsyncHostType<'stream, 'b> =
772-
<DeepPerThreadBorrow<T> as CudaKernelParameter>::AsyncHostType<'stream, 'b> where Self: 'b;
821+
type AsyncHostType<'stream, 'b>
822+
= <DeepPerThreadBorrow<T> as CudaKernelParameter>::AsyncHostType<'stream, 'b>
823+
where
824+
Self: 'b;
773825
#[cfg(any(feature = "device", doc))]
774-
type DeviceType<'b> = <DeepPerThreadBorrow<T> as CudaKernelParameter>::DeviceType<'b> where Self: 'b;
775-
type FfiType<'stream, 'b> =
776-
<DeepPerThreadBorrow<T> as CudaKernelParameter>::FfiType<'stream, 'b> where Self: 'b;
826+
type DeviceType<'b>
827+
= <DeepPerThreadBorrow<T> as CudaKernelParameter>::DeviceType<'b>
828+
where
829+
Self: 'b;
830+
type FfiType<'stream, 'b>
831+
= <DeepPerThreadBorrow<T> as CudaKernelParameter>::FfiType<'stream, 'b>
832+
where
833+
Self: 'b;
777834
#[cfg(feature = "host")]
778835
type SyncHostType = <DeepPerThreadBorrow<T> as CudaKernelParameter>::SyncHostType;
779836

@@ -852,12 +909,19 @@ impl<
852909

853910
impl<'a, T: Sync + RustToCuda> CudaKernelParameter for &'a PtxJit<DeepPerThreadBorrow<T>> {
854911
#[cfg(feature = "host")]
855-
type AsyncHostType<'stream, 'b> =
856-
<&'a DeepPerThreadBorrow<T> as CudaKernelParameter>::AsyncHostType<'stream, 'b> where Self: 'b;
912+
type AsyncHostType<'stream, 'b>
913+
= <&'a DeepPerThreadBorrow<T> as CudaKernelParameter>::AsyncHostType<'stream, 'b>
914+
where
915+
Self: 'b;
857916
#[cfg(any(feature = "device", doc))]
858-
type DeviceType<'b> = <&'a DeepPerThreadBorrow<T> as CudaKernelParameter>::DeviceType<'b> where Self: 'b;
859-
type FfiType<'stream, 'b> =
860-
<&'a DeepPerThreadBorrow<T> as CudaKernelParameter>::FfiType<'stream, 'b> where Self: 'b;
917+
type DeviceType<'b>
918+
= <&'a DeepPerThreadBorrow<T> as CudaKernelParameter>::DeviceType<'b>
919+
where
920+
Self: 'b;
921+
type FfiType<'stream, 'b>
922+
= <&'a DeepPerThreadBorrow<T> as CudaKernelParameter>::FfiType<'stream, 'b>
923+
where
924+
Self: 'b;
861925
#[cfg(feature = "host")]
862926
type SyncHostType = <&'a DeepPerThreadBorrow<T> as CudaKernelParameter>::SyncHostType;
863927

@@ -936,12 +1000,19 @@ impl<'a, T: Sync + RustToCuda + SafeMutableAliasing> CudaKernelParameter
9361000
for &'a mut PtxJit<DeepPerThreadBorrow<T>>
9371001
{
9381002
#[cfg(feature = "host")]
939-
type AsyncHostType<'stream, 'b> =
940-
<&'a mut DeepPerThreadBorrow<T> as CudaKernelParameter>::AsyncHostType<'stream, 'b> where Self: 'b;
1003+
type AsyncHostType<'stream, 'b>
1004+
= <&'a mut DeepPerThreadBorrow<T> as CudaKernelParameter>::AsyncHostType<'stream, 'b>
1005+
where
1006+
Self: 'b;
9411007
#[cfg(any(feature = "device", doc))]
942-
type DeviceType<'b> = <&'a mut DeepPerThreadBorrow<T> as CudaKernelParameter>::DeviceType<'b> where Self: 'b;
943-
type FfiType<'stream, 'b> =
944-
<&'a mut DeepPerThreadBorrow<T> as CudaKernelParameter>::FfiType<'stream, 'b> where Self: 'b;
1008+
type DeviceType<'b>
1009+
= <&'a mut DeepPerThreadBorrow<T> as CudaKernelParameter>::DeviceType<'b>
1010+
where
1011+
Self: 'b;
1012+
type FfiType<'stream, 'b>
1013+
= <&'a mut DeepPerThreadBorrow<T> as CudaKernelParameter>::FfiType<'stream, 'b>
1014+
where
1015+
Self: 'b;
9451016
#[cfg(feature = "host")]
9461017
type SyncHostType = <&'a mut DeepPerThreadBorrow<T> as CudaKernelParameter>::SyncHostType;
9471018

@@ -1066,10 +1137,19 @@ mod private_shared {
10661137

10671138
impl<'a, T: 'static> CudaKernelParameter for &'a mut crate::utils::shared::ThreadBlockShared<T> {
10681139
#[cfg(feature = "host")]
1069-
type AsyncHostType<'stream, 'b> = &'b mut crate::utils::shared::ThreadBlockShared<T> where Self: 'b;
1140+
type AsyncHostType<'stream, 'b>
1141+
= &'b mut crate::utils::shared::ThreadBlockShared<T>
1142+
where
1143+
Self: 'b;
10701144
#[cfg(any(feature = "device", doc))]
1071-
type DeviceType<'b> = &'b mut crate::utils::shared::ThreadBlockShared<T> where Self: 'b;
1072-
type FfiType<'stream, 'b> = private_shared::ThreadBlockSharedFfi<T> where Self: 'b;
1145+
type DeviceType<'b>
1146+
= &'b mut crate::utils::shared::ThreadBlockShared<T>
1147+
where
1148+
Self: 'b;
1149+
type FfiType<'stream, 'b>
1150+
= private_shared::ThreadBlockSharedFfi<T>
1151+
where
1152+
Self: 'b;
10731153
#[cfg(feature = "host")]
10741154
type SyncHostType = Self;
10751155

@@ -1144,10 +1224,19 @@ impl<'a, T: 'static + PortableBitSemantics + TypeGraphLayout> CudaKernelParamete
11441224
for &'a mut crate::utils::shared::ThreadBlockSharedSlice<T>
11451225
{
11461226
#[cfg(feature = "host")]
1147-
type AsyncHostType<'stream, 'b> = &'b mut crate::utils::shared::ThreadBlockSharedSlice<T> where Self: 'b;
1227+
type AsyncHostType<'stream, 'b>
1228+
= &'b mut crate::utils::shared::ThreadBlockSharedSlice<T>
1229+
where
1230+
Self: 'b;
11481231
#[cfg(any(feature = "device", doc))]
1149-
type DeviceType<'b> = &'b mut crate::utils::shared::ThreadBlockSharedSlice<T> where Self: 'b;
1150-
type FfiType<'stream, 'b> = private_shared::ThreadBlockSharedSliceFfi<T> where Self: 'b;
1232+
type DeviceType<'b>
1233+
= &'b mut crate::utils::shared::ThreadBlockSharedSlice<T>
1234+
where
1235+
Self: 'b;
1236+
type FfiType<'stream, 'b>
1237+
= private_shared::ThreadBlockSharedSliceFfi<T>
1238+
where
1239+
Self: 'b;
11511240
#[cfg(feature = "host")]
11521241
type SyncHostType = Self;
11531242

0 commit comments

Comments
 (0)