@@ -156,14 +156,13 @@ impl BitwiseArrayBackend for GpuFheBoolArrayBackend {
156
156
rhs : TensorSlice < ' _ , Self :: Slice < ' a > > ,
157
157
) -> Self :: Owned {
158
158
GpuBooleanOwned ( global_state:: with_cuda_internal_keys ( |cuda_key| {
159
- with_thread_local_cuda_streams ( |streams| {
160
- lhs. par_iter ( )
161
- . zip ( rhs. par_iter ( ) )
162
- . map ( |( lhs, rhs) | {
163
- CudaBooleanBlock ( cuda_key. pbs_key ( ) . bitand ( & lhs. 0 , & rhs. 0 , streams) )
164
- } )
165
- . collect :: < Vec < _ > > ( )
166
- } )
159
+ let streams = & cuda_key. streams ;
160
+ lhs. par_iter ( )
161
+ . zip ( rhs. par_iter ( ) )
162
+ . map ( |( lhs, rhs) | {
163
+ CudaBooleanBlock ( cuda_key. pbs_key ( ) . bitand ( & lhs. 0 , & rhs. 0 , streams) )
164
+ } )
165
+ . collect :: < Vec < _ > > ( )
167
166
} ) )
168
167
}
169
168
@@ -172,14 +171,13 @@ impl BitwiseArrayBackend for GpuFheBoolArrayBackend {
172
171
rhs : TensorSlice < ' _ , Self :: Slice < ' a > > ,
173
172
) -> Self :: Owned {
174
173
GpuBooleanOwned ( global_state:: with_cuda_internal_keys ( |cuda_key| {
175
- with_thread_local_cuda_streams ( |streams| {
176
- lhs. par_iter ( )
177
- . zip ( rhs. par_iter ( ) )
178
- . map ( |( lhs, rhs) | {
179
- CudaBooleanBlock ( cuda_key. pbs_key ( ) . bitor ( & lhs. 0 , & rhs. 0 , streams) )
180
- } )
181
- . collect :: < Vec < _ > > ( )
182
- } )
174
+ let streams = & cuda_key. streams ;
175
+ lhs. par_iter ( )
176
+ . zip ( rhs. par_iter ( ) )
177
+ . map ( |( lhs, rhs) | {
178
+ CudaBooleanBlock ( cuda_key. pbs_key ( ) . bitor ( & lhs. 0 , & rhs. 0 , streams) )
179
+ } )
180
+ . collect :: < Vec < _ > > ( )
183
181
} ) )
184
182
}
185
183
@@ -188,24 +186,22 @@ impl BitwiseArrayBackend for GpuFheBoolArrayBackend {
188
186
rhs : TensorSlice < ' _ , Self :: Slice < ' a > > ,
189
187
) -> Self :: Owned {
190
188
GpuBooleanOwned ( global_state:: with_cuda_internal_keys ( |cuda_key| {
191
- with_thread_local_cuda_streams ( |streams| {
192
- lhs. par_iter ( )
193
- . zip ( rhs. par_iter ( ) )
194
- . map ( |( lhs, rhs) | {
195
- CudaBooleanBlock ( cuda_key. pbs_key ( ) . bitxor ( & lhs. 0 , & rhs. 0 , streams) )
196
- } )
197
- . collect :: < Vec < _ > > ( )
198
- } )
189
+ let streams = & cuda_key. streams ;
190
+ lhs. par_iter ( )
191
+ . zip ( rhs. par_iter ( ) )
192
+ . map ( |( lhs, rhs) | {
193
+ CudaBooleanBlock ( cuda_key. pbs_key ( ) . bitxor ( & lhs. 0 , & rhs. 0 , streams) )
194
+ } )
195
+ . collect :: < Vec < _ > > ( )
199
196
} ) )
200
197
}
201
198
202
199
fn bitnot ( lhs : TensorSlice < ' _ , Self :: Slice < ' _ > > ) -> Self :: Owned {
203
200
GpuBooleanOwned ( global_state:: with_cuda_internal_keys ( |cuda_key| {
204
- with_thread_local_cuda_streams ( |streams| {
205
- lhs. par_iter ( )
206
- . map ( |lhs| CudaBooleanBlock ( cuda_key. pbs_key ( ) . bitnot ( & lhs. 0 , streams) ) )
207
- . collect :: < Vec < _ > > ( )
208
- } )
201
+ let streams = & cuda_key. streams ;
202
+ lhs. par_iter ( )
203
+ . map ( |lhs| CudaBooleanBlock ( cuda_key. pbs_key ( ) . bitnot ( & lhs. 0 , streams) ) )
204
+ . collect :: < Vec < _ > > ( )
209
205
} ) )
210
206
}
211
207
}
@@ -216,16 +212,13 @@ impl ClearBitwiseArrayBackend<bool> for GpuFheBoolArrayBackend {
216
212
rhs : TensorSlice < ' _ , & ' _ [ bool ] > ,
217
213
) -> Self :: Owned {
218
214
GpuBooleanOwned ( global_state:: with_cuda_internal_keys ( |cuda_key| {
219
- with_thread_local_cuda_streams ( |streams| {
220
- lhs. par_iter ( )
221
- . zip ( rhs. par_iter ( ) . copied ( ) )
222
- . map ( |( lhs, rhs) | {
223
- CudaBooleanBlock (
224
- cuda_key. pbs_key ( ) . scalar_bitand ( & lhs. 0 , rhs as u8 , streams) ,
225
- )
226
- } )
227
- . collect :: < Vec < _ > > ( )
228
- } )
215
+ let streams = & cuda_key. streams ;
216
+ lhs. par_iter ( )
217
+ . zip ( rhs. par_iter ( ) . copied ( ) )
218
+ . map ( |( lhs, rhs) | {
219
+ CudaBooleanBlock ( cuda_key. pbs_key ( ) . scalar_bitand ( & lhs. 0 , rhs as u8 , streams) )
220
+ } )
221
+ . collect :: < Vec < _ > > ( )
229
222
} ) )
230
223
}
231
224
@@ -234,16 +227,13 @@ impl ClearBitwiseArrayBackend<bool> for GpuFheBoolArrayBackend {
234
227
rhs : TensorSlice < ' _ , & ' _ [ bool ] > ,
235
228
) -> Self :: Owned {
236
229
GpuBooleanOwned ( global_state:: with_cuda_internal_keys ( |cuda_key| {
237
- with_thread_local_cuda_streams ( |streams| {
238
- lhs. par_iter ( )
239
- . zip ( rhs. par_iter ( ) . copied ( ) )
240
- . map ( |( lhs, rhs) | {
241
- CudaBooleanBlock (
242
- cuda_key. pbs_key ( ) . scalar_bitor ( & lhs. 0 , rhs as u8 , streams) ,
243
- )
244
- } )
245
- . collect :: < Vec < _ > > ( )
246
- } )
230
+ let streams = & cuda_key. streams ;
231
+ lhs. par_iter ( )
232
+ . zip ( rhs. par_iter ( ) . copied ( ) )
233
+ . map ( |( lhs, rhs) | {
234
+ CudaBooleanBlock ( cuda_key. pbs_key ( ) . scalar_bitor ( & lhs. 0 , rhs as u8 , streams) )
235
+ } )
236
+ . collect :: < Vec < _ > > ( )
247
237
} ) )
248
238
}
249
239
@@ -252,16 +242,13 @@ impl ClearBitwiseArrayBackend<bool> for GpuFheBoolArrayBackend {
252
242
rhs : TensorSlice < ' _ , & ' _ [ bool ] > ,
253
243
) -> Self :: Owned {
254
244
GpuBooleanOwned ( global_state:: with_cuda_internal_keys ( |cuda_key| {
255
- with_thread_local_cuda_streams ( |streams| {
256
- lhs. par_iter ( )
257
- . zip ( rhs. par_iter ( ) . copied ( ) )
258
- . map ( |( lhs, rhs) | {
259
- CudaBooleanBlock (
260
- cuda_key. pbs_key ( ) . scalar_bitxor ( & lhs. 0 , rhs as u8 , streams) ,
261
- )
262
- } )
263
- . collect :: < Vec < _ > > ( )
264
- } )
245
+ let streams = & cuda_key. streams ;
246
+ lhs. par_iter ( )
247
+ . zip ( rhs. par_iter ( ) . copied ( ) )
248
+ . map ( |( lhs, rhs) | {
249
+ CudaBooleanBlock ( cuda_key. pbs_key ( ) . scalar_bitxor ( & lhs. 0 , rhs as u8 , streams) )
250
+ } )
251
+ . collect :: < Vec < _ > > ( )
265
252
} ) )
266
253
}
267
254
}
0 commit comments