44//! making invalid states unrepresentable and ensuring all validation happens
55//! at compile time.
66
7- use super :: shuffle:: ShuffleValue ;
87use super :: sync:: WarpMask ;
98use crate :: gpu_only;
109#[ cfg( target_os = "cuda" ) ]
@@ -416,6 +415,7 @@ impl BitwiseReduceValue for u32 {
416415impl ReduceValue for i64 {
417416 #[ gpu_only]
418417 unsafe fn reduce_add ( mask : WarpMask , mut value : Self ) -> Self {
418+ use super :: shuffle:: ShuffleValue ;
419419 // Implement using shuffle operations in a tree reduction pattern
420420 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
421421 let shuffled =
@@ -427,6 +427,7 @@ impl ReduceValue for i64 {
427427
428428 #[ gpu_only]
429429 unsafe fn reduce_min ( mask : WarpMask , mut value : Self ) -> Self {
430+ use super :: shuffle:: ShuffleValue ;
430431 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
431432 let shuffled =
432433 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -437,6 +438,7 @@ impl ReduceValue for i64 {
437438
438439 #[ gpu_only]
439440 unsafe fn reduce_max ( mask : WarpMask , mut value : Self ) -> Self {
441+ use super :: shuffle:: ShuffleValue ;
440442 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
441443 let shuffled =
442444 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -449,6 +451,7 @@ impl ReduceValue for i64 {
449451impl BitwiseReduceValue for i64 {
450452 #[ gpu_only]
451453 unsafe fn reduce_and ( mask : WarpMask , mut value : Self ) -> Self {
454+ use super :: shuffle:: ShuffleValue ;
452455 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
453456 let shuffled =
454457 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -459,6 +462,7 @@ impl BitwiseReduceValue for i64 {
459462
460463 #[ gpu_only]
461464 unsafe fn reduce_or ( mask : WarpMask , mut value : Self ) -> Self {
465+ use super :: shuffle:: ShuffleValue ;
462466 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
463467 let shuffled =
464468 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -469,6 +473,7 @@ impl BitwiseReduceValue for i64 {
469473
470474 #[ gpu_only]
471475 unsafe fn reduce_xor ( mask : WarpMask , mut value : Self ) -> Self {
476+ use super :: shuffle:: ShuffleValue ;
472477 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
473478 let shuffled =
474479 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -481,6 +486,7 @@ impl BitwiseReduceValue for i64 {
481486impl ReduceValue for u64 {
482487 #[ gpu_only]
483488 unsafe fn reduce_add ( mask : WarpMask , mut value : Self ) -> Self {
489+ use super :: shuffle:: ShuffleValue ;
484490 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
485491 let shuffled =
486492 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -491,6 +497,7 @@ impl ReduceValue for u64 {
491497
492498 #[ gpu_only]
493499 unsafe fn reduce_min ( mask : WarpMask , mut value : Self ) -> Self {
500+ use super :: shuffle:: ShuffleValue ;
494501 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
495502 let shuffled =
496503 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -501,6 +508,7 @@ impl ReduceValue for u64 {
501508
502509 #[ gpu_only]
503510 unsafe fn reduce_max ( mask : WarpMask , mut value : Self ) -> Self {
511+ use super :: shuffle:: ShuffleValue ;
504512 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
505513 let shuffled =
506514 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -513,6 +521,7 @@ impl ReduceValue for u64 {
513521impl BitwiseReduceValue for u64 {
514522 #[ gpu_only]
515523 unsafe fn reduce_and ( mask : WarpMask , mut value : Self ) -> Self {
524+ use super :: shuffle:: ShuffleValue ;
516525 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
517526 let shuffled =
518527 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -523,6 +532,7 @@ impl BitwiseReduceValue for u64 {
523532
524533 #[ gpu_only]
525534 unsafe fn reduce_or ( mask : WarpMask , mut value : Self ) -> Self {
535+ use super :: shuffle:: ShuffleValue ;
526536 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
527537 let shuffled =
528538 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -533,6 +543,7 @@ impl BitwiseReduceValue for u64 {
533543
534544 #[ gpu_only]
535545 unsafe fn reduce_xor ( mask : WarpMask , mut value : Self ) -> Self {
546+ use super :: shuffle:: ShuffleValue ;
536547 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
537548 let shuffled =
538549 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -549,6 +560,7 @@ impl BitwiseReduceValue for u64 {
549560impl ReduceValue for f32 {
550561 #[ gpu_only]
551562 unsafe fn reduce_add ( mask : WarpMask , mut value : Self ) -> Self {
563+ use super :: shuffle:: ShuffleValue ;
552564 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
553565 let shuffled =
554566 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -559,6 +571,7 @@ impl ReduceValue for f32 {
559571
560572 #[ gpu_only]
561573 unsafe fn reduce_min ( mask : WarpMask , mut value : Self ) -> Self {
574+ use super :: shuffle:: ShuffleValue ;
562575 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
563576 let shuffled =
564577 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -569,6 +582,7 @@ impl ReduceValue for f32 {
569582
570583 #[ gpu_only]
571584 unsafe fn reduce_max ( mask : WarpMask , mut value : Self ) -> Self {
585+ use super :: shuffle:: ShuffleValue ;
572586 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
573587 let shuffled =
574588 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -581,6 +595,7 @@ impl ReduceValue for f32 {
581595impl ReduceValue for f64 {
582596 #[ gpu_only]
583597 unsafe fn reduce_add ( mask : WarpMask , mut value : Self ) -> Self {
598+ use super :: shuffle:: ShuffleValue ;
584599 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
585600 let shuffled =
586601 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -591,6 +606,7 @@ impl ReduceValue for f64 {
591606
592607 #[ gpu_only]
593608 unsafe fn reduce_min ( mask : WarpMask , mut value : Self ) -> Self {
609+ use super :: shuffle:: ShuffleValue ;
594610 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
595611 let shuffled =
596612 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
@@ -601,6 +617,7 @@ impl ReduceValue for f64 {
601617
602618 #[ gpu_only]
603619 unsafe fn reduce_max ( mask : WarpMask , mut value : Self ) -> Self {
620+ use super :: shuffle:: ShuffleValue ;
604621 for offset in [ 16 , 8 , 4 , 2 , 1 ] {
605622 let shuffled =
606623 <Self as ShuffleValue >:: shuffle_down ( mask, value, offset, 32 ) . unwrap_or ( value) ;
0 commit comments