@@ -843,70 +843,160 @@ mod tests {
843843 ]
844844 ) ;
845845
846- // Test 'a' variant - includes all available instructions for the architecture
847- // This means: all base variants up to same version, all 'f' variants with same major and <= minor, plus itself
848- let compute90a_features = NvvmArch :: Compute90a . all_target_features ( ) ;
849- // Should include all base up to 90
850- assert ! ( compute90a_features. contains( & "compute_35" . to_string( ) ) ) ;
851- assert ! ( compute90a_features. contains( & "compute_90" . to_string( ) ) ) ;
852- // Should include the 'a' variant itself
853- assert ! ( compute90a_features. contains( & "compute_90a" . to_string( ) ) ) ;
854- // Should NOT include any 'f' variants (90 has no 'f' variants)
855-
856- // Test compute100a - should include base variants, and 100f
857- let compute100a_features = NvvmArch :: Compute100a . all_target_features ( ) ;
858- // Should include all base up to 100
859- assert ! ( compute100a_features. contains( & "compute_90" . to_string( ) ) ) ;
860- assert ! ( compute100a_features. contains( & "compute_100" . to_string( ) ) ) ;
861- // Should include 100f (same major, <= minor)
862- assert ! ( compute100a_features. contains( & "compute_100f" . to_string( ) ) ) ;
863- // Should NOT include 101f or 103f (higher minor)
864- assert ! ( !compute100a_features. contains( & "compute_101f" . to_string( ) ) ) ;
865- assert ! ( !compute100a_features. contains( & "compute_103f" . to_string( ) ) ) ;
866- // Should include itself
867- assert ! ( compute100a_features. contains( & "compute_100a" . to_string( ) ) ) ;
846+ // Test 'a' variant - includes all available instructions for the architecture.
847+ // This means: all base variants up to same version, no 'f' variants (90 has none), and the
848+ // 'a' variant.
849+ assert_eq ! (
850+ NvvmArch :: Compute90a . all_target_features( ) ,
851+ vec![
852+ "compute_35" ,
853+ "compute_37" ,
854+ "compute_50" ,
855+ "compute_52" ,
856+ "compute_53" ,
857+ "compute_60" ,
858+ "compute_61" ,
859+ "compute_62" ,
860+ "compute_70" ,
861+ "compute_72" ,
862+ "compute_75" ,
863+ "compute_80" ,
864+ "compute_86" ,
865+ "compute_87" ,
866+ "compute_89" ,
867+ "compute_90" ,
868+ "compute_90a" ,
869+ ]
870+ ) ;
871+
872+ // Test compute100a - should include base variants up to 100, and 100f, and itself,
873+ // but NOT 101f or 103f (higher minor).
874+ assert_eq ! (
875+ NvvmArch :: Compute100a . all_target_features( ) ,
876+ vec![
877+ "compute_100" ,
878+ "compute_100a" ,
879+ "compute_100f" ,
880+ "compute_35" ,
881+ "compute_37" ,
882+ "compute_50" ,
883+ "compute_52" ,
884+ "compute_53" ,
885+ "compute_60" ,
886+ "compute_61" ,
887+ "compute_62" ,
888+ "compute_70" ,
889+ "compute_72" ,
890+ "compute_75" ,
891+ "compute_80" ,
892+ "compute_86" ,
893+ "compute_87" ,
894+ "compute_89" ,
895+ "compute_90" ,
896+ ]
897+ ) ;
868898
869899 // Test 'f' variant with 100f
870- let compute100f_features = NvvmArch :: Compute100f . all_target_features ( ) ;
871- assert ! ( compute100f_features. contains( & "compute_100" . to_string( ) ) ) ; // Same version base
872- assert ! ( compute100f_features. contains( & "compute_101" . to_string( ) ) ) ; // Higher minor
873- assert ! ( compute100f_features. contains( & "compute_103" . to_string( ) ) ) ; // Higher minor
874- assert ! ( compute100f_features. contains( & "compute_100f" . to_string( ) ) ) ; // Self
875- assert ! ( !compute100f_features. contains( & "compute_101f" . to_string( ) ) ) ; // No other 'f' variants
876- assert ! ( !compute100f_features. contains( & "compute_90" . to_string( ) ) ) ; // Different major
900+ assert_eq ! (
901+ NvvmArch :: Compute100f . all_target_features( ) ,
902+ // FIXME: this is wrong
903+ vec![ "compute_100" , "compute_100f" , "compute_101" , "compute_103" ]
904+ ) ;
905+
906+ // Test compute101a - should include base variants up to 101, and 100f and 101f, and
907+ // itself, but not 103f (higher minor)
908+ assert_eq ! (
909+ NvvmArch :: Compute101a . all_target_features( ) ,
910+ vec![
911+ "compute_100" ,
912+ "compute_100f" ,
913+ "compute_101" ,
914+ "compute_101a" ,
915+ "compute_101f" ,
916+ "compute_35" ,
917+ "compute_37" ,
918+ "compute_50" ,
919+ "compute_52" ,
920+ "compute_53" ,
921+ "compute_60" ,
922+ "compute_61" ,
923+ "compute_62" ,
924+ "compute_70" ,
925+ "compute_72" ,
926+ "compute_75" ,
927+ "compute_80" ,
928+ "compute_86" ,
929+ "compute_87" ,
930+ "compute_89" ,
931+ "compute_90" ,
932+ ]
933+ ) ;
877934
878935 // Test 'f' variant with 101f
879- let compute101f_features = NvvmArch :: Compute101f . all_target_features ( ) ;
880- assert ! ( !compute101f_features. contains( & "compute_100" . to_string( ) ) ) ; // Lower minor NOT included
881- assert ! ( compute101f_features. contains( & "compute_101" . to_string( ) ) ) ; // Same version base
882- assert ! ( compute101f_features. contains( & "compute_103" . to_string( ) ) ) ; // Higher minor included
883- assert ! ( compute101f_features. contains( & "compute_101f" . to_string( ) ) ) ; // Self
884- assert ! ( !compute101f_features. contains( & "compute_101a" . to_string( ) ) ) ; // No 'a' variants
885-
886- // Test compute101a
887- let compute101a_features = NvvmArch :: Compute101a . all_target_features ( ) ;
888- // Should include all base up to 101
889- assert ! ( compute101a_features. contains( & "compute_100" . to_string( ) ) ) ;
890- assert ! ( compute101a_features. contains( & "compute_101" . to_string( ) ) ) ;
891- // Should include 100f and 101f (same major, <= minor)
892- assert ! ( compute101a_features. contains( & "compute_100f" . to_string( ) ) ) ;
893- assert ! ( compute101a_features. contains( & "compute_101f" . to_string( ) ) ) ;
894- // Should NOT include 103f (higher minor)
895- assert ! ( !compute101a_features. contains( & "compute_103f" . to_string( ) ) ) ;
896- // Should include itself
897- assert ! ( compute101a_features. contains( & "compute_101a" . to_string( ) ) ) ;
898-
899- // Test 'f' variant - includes same major version with >= minor
900- let compute120f_features = NvvmArch :: Compute120f . all_target_features ( ) ;
901- assert ! ( compute120f_features. contains( & "compute_120" . to_string( ) ) ) ;
902- assert ! ( compute120f_features. contains( & "compute_121" . to_string( ) ) ) ; // Higher minor included
903- assert ! ( compute120f_features. contains( & "compute_120f" . to_string( ) ) ) ; // Self included
904- assert ! ( !compute120f_features. contains( & "compute_120a" . to_string( ) ) ) ; // No 'a' variants
905- assert ! ( !compute120f_features. contains( & "compute_121f" . to_string( ) ) ) ; // No other 'f' variants
906- assert ! ( !compute120f_features. contains( & "compute_121a" . to_string( ) ) ) ; // No 'a' variants
907- // Should NOT include different major versions
908- assert ! ( !compute120f_features. contains( & "compute_100" . to_string( ) ) ) ;
909- assert ! ( !compute120f_features. contains( & "compute_90" . to_string( ) ) ) ;
936+ assert_eq ! (
937+ NvvmArch :: Compute101f . all_target_features( ) ,
938+ vec![ "compute_101" , "compute_101f" , "compute_103" ] ,
939+ ) ;
940+
941+ assert_eq ! (
942+ NvvmArch :: Compute120 . all_target_features( ) ,
943+ vec![
944+ "compute_100" ,
945+ "compute_101" ,
946+ "compute_103" ,
947+ "compute_120" ,
948+ "compute_35" ,
949+ "compute_37" ,
950+ "compute_50" ,
951+ "compute_52" ,
952+ "compute_53" ,
953+ "compute_60" ,
954+ "compute_61" ,
955+ "compute_62" ,
956+ "compute_70" ,
957+ "compute_72" ,
958+ "compute_75" ,
959+ "compute_80" ,
960+ "compute_86" ,
961+ "compute_87" ,
962+ "compute_89" ,
963+ "compute_90" ,
964+ ]
965+ ) ;
966+
967+ assert_eq ! (
968+ NvvmArch :: Compute120f . all_target_features( ) ,
969+ // FIXME: this is wrong
970+ vec![ "compute_120" , "compute_120f" , "compute_121" ]
971+ ) ;
972+
973+ assert_eq ! (
974+ NvvmArch :: Compute120a . all_target_features( ) ,
975+ vec![
976+ "compute_100" ,
977+ "compute_101" ,
978+ "compute_103" ,
979+ "compute_120" ,
980+ "compute_120a" ,
981+ "compute_120f" ,
982+ "compute_35" ,
983+ "compute_37" ,
984+ "compute_50" ,
985+ "compute_52" ,
986+ "compute_53" ,
987+ "compute_60" ,
988+ "compute_61" ,
989+ "compute_62" ,
990+ "compute_70" ,
991+ "compute_72" ,
992+ "compute_75" ,
993+ "compute_80" ,
994+ "compute_86" ,
995+ "compute_87" ,
996+ "compute_89" ,
997+ "compute_90" ,
998+ ]
999+ ) ;
9101000 }
9111001
9121002 #[ test]
0 commit comments