@@ -747,34 +747,24 @@ mod tests {
747747 }
748748
749749 #[ test]
750- fn nvvm_arch_target_feature_format_base_variants ( ) {
750+ fn nvvm_arch_target_feature ( ) {
751751 use crate :: NvvmArch ;
752752
753- // Test base variants format
753+ // Test baseline features
754754 assert_eq ! ( NvvmArch :: Compute35 . target_feature( ) , "compute_35" ) ;
755755 assert_eq ! ( NvvmArch :: Compute61 . target_feature( ) , "compute_61" ) ;
756756 assert_eq ! ( NvvmArch :: Compute90 . target_feature( ) , "compute_90" ) ;
757757 assert_eq ! ( NvvmArch :: Compute100 . target_feature( ) , "compute_100" ) ;
758758 assert_eq ! ( NvvmArch :: Compute120 . target_feature( ) , "compute_120" ) ;
759- }
760759
761- #[ test]
762- fn nvvm_arch_target_feature_format_family_variants ( ) {
763- use crate :: NvvmArch ;
764-
765- // Test family ('f') variants format
760+ // Test family-specfic ('f') features
766761 assert_eq ! ( NvvmArch :: Compute100f . target_feature( ) , "compute_100f" ) ;
767762 assert_eq ! ( NvvmArch :: Compute101f . target_feature( ) , "compute_101f" ) ;
768763 assert_eq ! ( NvvmArch :: Compute103f . target_feature( ) , "compute_103f" ) ;
769764 assert_eq ! ( NvvmArch :: Compute120f . target_feature( ) , "compute_120f" ) ;
770765 assert_eq ! ( NvvmArch :: Compute121f . target_feature( ) , "compute_121f" ) ;
771- }
772766
773- #[ test]
774- fn nvvm_arch_target_feature_format_architecture_variants ( ) {
775- use crate :: NvvmArch ;
776-
777- // Test architecture ('a') variants format
767+ // Test architecture-specific ('a') features
778768 assert_eq ! ( NvvmArch :: Compute90a . target_feature( ) , "compute_90a" ) ;
779769 assert_eq ! ( NvvmArch :: Compute100a . target_feature( ) , "compute_100a" ) ;
780770 assert_eq ! ( NvvmArch :: Compute101a . target_feature( ) , "compute_101a" ) ;
@@ -784,32 +774,72 @@ mod tests {
784774 }
785775
786776 #[ test]
787- fn nvvm_arch_all_target_features_includes_lower_capabilities ( ) {
777+ fn nvvm_arch_all_target_features ( ) {
788778 use crate :: NvvmArch ;
789779
790780 // Compute35 only includes itself
791- let compute35_features = NvvmArch :: Compute35 . all_target_features ( ) ;
792- assert_eq ! ( compute35_features, vec![ "compute_35" ] ) ;
781+ assert_eq ! (
782+ NvvmArch :: Compute35 . all_target_features( ) ,
783+ vec![ "compute_35" ]
784+ ) ;
793785
794786 // Compute50 includes all lower base capabilities
795- let compute50_features = NvvmArch :: Compute50 . all_target_features ( ) ;
796787 assert_eq ! (
797- compute50_features ,
798- vec![ "compute_35" , "compute_37" , "compute_50" ]
788+ NvvmArch :: Compute50 . all_target_features ( ) ,
789+ vec![ "compute_35" , "compute_37" , "compute_50" ] ,
799790 ) ;
800791
801792 // Compute61 includes all lower base capabilities
802- let compute61_features = NvvmArch :: Compute61 . all_target_features ( ) ;
803793 assert_eq ! (
804- compute61_features,
794+ NvvmArch :: Compute61 . all_target_features( ) ,
795+ vec![
796+ "compute_35" ,
797+ "compute_37" ,
798+ "compute_50" ,
799+ "compute_52" ,
800+ "compute_53" ,
801+ "compute_60" ,
802+ "compute_61" ,
803+ ]
804+ ) ;
805+
806+ // Compute70 includes all lower base capabilities
807+ assert_eq ! (
808+ NvvmArch :: Compute70 . all_target_features( ) ,
809+ vec![
810+ "compute_35" ,
811+ "compute_37" ,
812+ "compute_50" ,
813+ "compute_52" ,
814+ "compute_53" ,
815+ "compute_60" ,
816+ "compute_61" ,
817+ "compute_62" ,
818+ "compute_70" ,
819+ ]
820+ ) ;
821+
822+ // Compute90 includes lower base capabilities
823+ let compute90_features = NvvmArch :: Compute90 . all_target_features ( ) ;
824+ assert_eq ! (
825+ compute90_features,
805826 vec![
806827 "compute_35" ,
807828 "compute_37" ,
808829 "compute_50" ,
809830 "compute_52" ,
810831 "compute_53" ,
811832 "compute_60" ,
812- "compute_61"
833+ "compute_61" ,
834+ "compute_62" ,
835+ "compute_70" ,
836+ "compute_72" ,
837+ "compute_75" ,
838+ "compute_80" ,
839+ "compute_86" ,
840+ "compute_87" ,
841+ "compute_89" ,
842+ "compute_90" ,
813843 ]
814844 ) ;
815845
@@ -836,6 +866,23 @@ mod tests {
836866 // Should include itself
837867 assert ! ( compute100a_features. contains( & "compute_100a" . to_string( ) ) ) ;
838868
869+ // 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
877+
878+ // 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+
839886 // Test compute101a
840887 let compute101a_features = NvvmArch :: Compute101a . all_target_features ( ) ;
841888 // Should include all base up to 101
@@ -860,112 +907,6 @@ mod tests {
860907 // Should NOT include different major versions
861908 assert ! ( !compute120f_features. contains( & "compute_100" . to_string( ) ) ) ;
862909 assert ! ( !compute120f_features. contains( & "compute_90" . to_string( ) ) ) ;
863-
864- // Test 'f' variant with 100f
865- let compute100f_features = NvvmArch :: Compute100f . all_target_features ( ) ;
866- assert ! ( compute100f_features. contains( & "compute_100" . to_string( ) ) ) ; // Same version base
867- assert ! ( compute100f_features. contains( & "compute_101" . to_string( ) ) ) ; // Higher minor
868- assert ! ( compute100f_features. contains( & "compute_103" . to_string( ) ) ) ; // Higher minor
869- assert ! ( compute100f_features. contains( & "compute_100f" . to_string( ) ) ) ; // Self
870- assert ! ( !compute100f_features. contains( & "compute_101f" . to_string( ) ) ) ; // No other 'f' variants
871- assert ! ( !compute100f_features. contains( & "compute_90" . to_string( ) ) ) ; // Different major
872-
873- // Test 'f' variant with 101f
874- let compute101f_features = NvvmArch :: Compute101f . all_target_features ( ) ;
875- assert ! ( !compute101f_features. contains( & "compute_100" . to_string( ) ) ) ; // Lower minor NOT included
876- assert ! ( compute101f_features. contains( & "compute_101" . to_string( ) ) ) ; // Same version base
877- assert ! ( compute101f_features. contains( & "compute_103" . to_string( ) ) ) ; // Higher minor included
878- assert ! ( compute101f_features. contains( & "compute_101f" . to_string( ) ) ) ; // Self
879- assert ! ( !compute101f_features. contains( & "compute_101a" . to_string( ) ) ) ; // No 'a' variants
880-
881- // Compute90 includes lower base capabilities
882- let compute90_features = NvvmArch :: Compute90 . all_target_features ( ) ;
883- assert_eq ! (
884- compute90_features,
885- vec![
886- "compute_35" ,
887- "compute_37" ,
888- "compute_50" ,
889- "compute_52" ,
890- "compute_53" ,
891- "compute_60" ,
892- "compute_61" ,
893- "compute_62" ,
894- "compute_70" ,
895- "compute_72" ,
896- "compute_75" ,
897- "compute_80" ,
898- "compute_86" ,
899- "compute_87" ,
900- "compute_89" ,
901- "compute_90"
902- ]
903- ) ;
904- }
905-
906- #[ test]
907- fn target_feature_synthesis_supports_conditional_compilation_patterns ( ) {
908- use crate :: NvvmArch ;
909-
910- // When targeting Compute61, should enable all lower capabilities
911- let features = NvvmArch :: Compute61 . all_target_features ( ) ;
912-
913- // Should enable compute_60 (for f64 atomics)
914- assert ! ( features. contains( & "compute_60" . to_string( ) ) ) ;
915-
916- // Should enable compute_50 (for 64-bit integer atomics)
917- assert ! ( features. contains( & "compute_50" . to_string( ) ) ) ;
918-
919- // Should enable compute_35 (baseline)
920- assert ! ( features. contains( & "compute_35" . to_string( ) ) ) ;
921-
922- // Should enable the target itself
923- assert ! ( features. contains( & "compute_61" . to_string( ) ) ) ;
924-
925- // Should NOT enable higher capabilities
926- assert ! ( !features. contains( & "compute_62" . to_string( ) ) ) ;
927- assert ! ( !features. contains( & "compute_70" . to_string( ) ) ) ;
928- }
929-
930- #[ test]
931- fn target_feature_synthesis_enables_correct_cfg_patterns ( ) {
932- use crate :: NvvmArch ;
933-
934- // Test that targeting Compute70 enables appropriate cfg patterns
935- let features = NvvmArch :: Compute70 . all_target_features ( ) ;
936-
937- // These should all be true for compute_70 target
938- let expected_enabled = [
939- "compute_35" ,
940- "compute_37" ,
941- "compute_50" ,
942- "compute_52" ,
943- "compute_53" ,
944- "compute_60" ,
945- "compute_61" ,
946- "compute_62" ,
947- "compute_70" ,
948- ] ;
949-
950- for feature in expected_enabled {
951- assert ! (
952- features. contains( & feature. to_string( ) ) ,
953- "Compute70 should enable {} for cfg(target_feature = \" {}\" )" ,
954- feature,
955- feature
956- ) ;
957- }
958-
959- // These should NOT be enabled for compute_70 target
960- let expected_disabled = [ "compute_72" , "compute_75" , "compute_80" , "compute_90" ] ;
961-
962- for feature in expected_disabled {
963- assert ! (
964- !features. contains( & feature. to_string( ) ) ,
965- "Compute70 should NOT enable {}" ,
966- feature
967- ) ;
968- }
969910 }
970911
971912 #[ test]
@@ -1097,7 +1038,7 @@ mod tests {
10971038 NvvmArch :: Compute120
10981039 ) ;
10991040
1100- // Floating-point variants return base
1041+ // Family-specific variants return base
11011042 assert_eq ! (
11021043 NvvmArch :: Compute120f . base_architecture( ) ,
11031044 NvvmArch :: Compute120
@@ -1154,38 +1095,6 @@ mod tests {
11541095 assert ! ( compute120f_variants. contains( & NvvmArch :: Compute120a ) ) ;
11551096 }
11561097
1157- #[ test]
1158- fn nvvm_arch_a_suffix_includes_all_available_instructions ( ) {
1159- use crate :: NvvmArch ;
1160-
1161- // Test that 'a' suffix variants include all available instructions for the architecture
1162- // While they only RUN on exact CC, they enable all base and family features during compilation
1163-
1164- // Test Compute90a
1165- let features = NvvmArch :: Compute90a . all_target_features ( ) ;
1166- assert ! ( features. contains( & "compute_90a" . to_string( ) ) ) ; // Includes itself
1167- assert ! ( features. contains( & "compute_90" . to_string( ) ) ) ; // Includes base
1168- assert ! ( features. contains( & "compute_80" . to_string( ) ) ) ; // Includes lower versions
1169- assert ! ( !features. contains( & "compute_100" . to_string( ) ) ) ; // Does NOT include higher versions
1170-
1171- // Test Compute100a
1172- let features = NvvmArch :: Compute100a . all_target_features ( ) ;
1173- assert ! ( features. contains( & "compute_100a" . to_string( ) ) ) ; // Includes itself
1174- assert ! ( features. contains( & "compute_100" . to_string( ) ) ) ; // Includes base
1175- assert ! ( features. contains( & "compute_100f" . to_string( ) ) ) ; // Includes family variant
1176- assert ! ( features. contains( & "compute_90" . to_string( ) ) ) ; // Includes lower base versions
1177- assert ! ( !features. contains( & "compute_90a" . to_string( ) ) ) ; // Does NOT include other 'a' variants
1178- assert ! ( !features. contains( & "compute_101f" . to_string( ) ) ) ; // Does NOT include higher minor family variants
1179-
1180- // Test Compute120a
1181- let features = NvvmArch :: Compute120a . all_target_features ( ) ;
1182- assert ! ( features. contains( & "compute_120a" . to_string( ) ) ) ; // Includes itself
1183- assert ! ( features. contains( & "compute_120" . to_string( ) ) ) ; // Includes base
1184- assert ! ( features. contains( & "compute_120f" . to_string( ) ) ) ; // Includes family variant (same minor)
1185- assert ! ( features. contains( & "compute_100" . to_string( ) ) ) ; // Includes lower base versions
1186- assert ! ( !features. contains( & "compute_121f" . to_string( ) ) ) ; // Does NOT include higher minor family variants
1187- }
1188-
11891098 #[ test]
11901099 fn nvvm_arch_variants_for_capability ( ) {
11911100 use crate :: NvvmArch ;
0 commit comments