File tree Expand file tree Collapse file tree
tfhe/src/high_level_api/integers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,6 +58,9 @@ pub(super) mod unsigned;
5858pub trait IntegerId : FheId + ' static {
5959 type InnerCpu : crate :: integer:: IntegerRadixCiphertext ;
6060
61+ #[ cfg( feature = "gpu" ) ]
62+ type InnerGpu : crate :: integer:: gpu:: ciphertext:: CudaIntegerRadixCiphertext ;
63+ #[ cfg( not( feature = "gpu" ) ) ]
6164 type InnerGpu ;
6265
6366 type InnerHpu ;
@@ -89,4 +92,23 @@ pub trait FheIntegerType: Tagged + private::Sealed {
8992 tag : Tag ,
9093 re_randomization_metadata : ReRandomizationMetadata ,
9194 ) -> Self ;
95+
96+ #[ cfg( feature = "gpu" ) ]
97+ fn on_gpu (
98+ & self ,
99+ streams : & crate :: core_crypto:: gpu:: CudaStreams ,
100+ ) -> MaybeCloned < ' _ , <Self :: Id as IntegerId >:: InnerGpu > ;
101+
102+ #[ cfg( feature = "gpu" ) ]
103+ fn into_gpu (
104+ self ,
105+ streams : & crate :: core_crypto:: gpu:: CudaStreams ,
106+ ) -> <Self :: Id as IntegerId >:: InnerGpu ;
107+
108+ #[ cfg( feature = "gpu" ) ]
109+ fn from_gpu (
110+ inner : <Self :: Id as IntegerId >:: InnerGpu ,
111+ tag : Tag ,
112+ re_randomization_metadata : ReRandomizationMetadata ,
113+ ) -> Self ;
92114}
Original file line number Diff line number Diff line change @@ -137,6 +137,31 @@ where
137137 ) -> Self {
138138 Self :: new ( inner, tag, re_randomization_metadata)
139139 }
140+
141+ #[ cfg( feature = "gpu" ) ]
142+ fn on_gpu (
143+ & self ,
144+ streams : & crate :: core_crypto:: gpu:: CudaStreams ,
145+ ) -> MaybeCloned < ' _ , <Self :: Id as IntegerId >:: InnerGpu > {
146+ self . ciphertext . on_gpu ( streams)
147+ }
148+
149+ #[ cfg( feature = "gpu" ) ]
150+ fn into_gpu (
151+ self ,
152+ streams : & crate :: core_crypto:: gpu:: CudaStreams ,
153+ ) -> <Self :: Id as IntegerId >:: InnerGpu {
154+ self . ciphertext . into_gpu ( streams)
155+ }
156+
157+ #[ cfg( feature = "gpu" ) ]
158+ fn from_gpu (
159+ inner : <Self :: Id as IntegerId >:: InnerGpu ,
160+ tag : Tag ,
161+ re_randomization_metadata : ReRandomizationMetadata ,
162+ ) -> Self {
163+ Self :: new ( inner, tag, re_randomization_metadata)
164+ }
140165}
141166
142167impl < Id > FheInt < Id >
Original file line number Diff line number Diff line change @@ -174,6 +174,31 @@ where
174174 ) -> Self {
175175 Self :: new ( inner, tag, re_randomization_metadata)
176176 }
177+
178+ #[ cfg( feature = "gpu" ) ]
179+ fn on_gpu (
180+ & self ,
181+ streams : & crate :: core_crypto:: gpu:: CudaStreams ,
182+ ) -> MaybeCloned < ' _ , <Self :: Id as IntegerId >:: InnerGpu > {
183+ self . ciphertext . on_gpu ( streams)
184+ }
185+
186+ #[ cfg( feature = "gpu" ) ]
187+ fn into_gpu (
188+ self ,
189+ streams : & crate :: core_crypto:: gpu:: CudaStreams ,
190+ ) -> <Self :: Id as IntegerId >:: InnerGpu {
191+ self . ciphertext . into_gpu ( streams)
192+ }
193+
194+ #[ cfg( feature = "gpu" ) ]
195+ fn from_gpu (
196+ inner : <Self :: Id as IntegerId >:: InnerGpu ,
197+ tag : Tag ,
198+ re_randomization_metadata : ReRandomizationMetadata ,
199+ ) -> Self {
200+ Self :: new ( inner, tag, re_randomization_metadata)
201+ }
177202}
178203
179204impl < Id > Tagged for FheUint < Id >
You can’t perform that action at this time.
0 commit comments