validator: add avx2 runtime check
This commit is contained in:
		
				
					committed by
					
						![mergify[bot]](/avatar/e3df20cd7a67969c41a65f03bea54961?size=40) mergify[bot]
						mergify[bot]
					
				
			
			
				
	
			
			
			
						parent
						
							e641f257ef
						
					
				
				
					commit
					c435f7b3e3
				
			| @@ -1469,6 +1469,7 @@ pub fn report_target_features() { | |||||||
|  |  | ||||||
|     if !is_rosetta_emulated() { |     if !is_rosetta_emulated() { | ||||||
|         unsafe { check_avx() }; |         unsafe { check_avx() }; | ||||||
|  |         unsafe { check_avx2() }; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1482,7 +1483,7 @@ unsafe fn check_avx() { | |||||||
|         info!("AVX detected"); |         info!("AVX detected"); | ||||||
|     } else { |     } else { | ||||||
|         error!( |         error!( | ||||||
|             "Your machine does not have AVX support, please rebuild from source on your machine" |             "Incompatible CPU detected: missing AVX support. Please build from source on the target" | ||||||
|         ); |         ); | ||||||
|         abort(); |         abort(); | ||||||
|     } |     } | ||||||
| @@ -1491,6 +1492,22 @@ unsafe fn check_avx() { | |||||||
| #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] | #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] | ||||||
| unsafe fn check_avx() {} | unsafe fn check_avx() {} | ||||||
|  |  | ||||||
|  | #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] | ||||||
|  | #[target_feature(enable = "avx2")] | ||||||
|  | unsafe fn check_avx2() { | ||||||
|  |     if is_x86_feature_detected!("avx2") { | ||||||
|  |         info!("AVX2 detected"); | ||||||
|  |     } else { | ||||||
|  |         error!( | ||||||
|  |             "Incompatible CPU detected: missing AVX2 support. Please build from source on the target" | ||||||
|  |         ); | ||||||
|  |         abort(); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] | ||||||
|  | unsafe fn check_avx2() {} | ||||||
|  |  | ||||||
| // Get the activated stake percentage (based on the provided bank) that is visible in gossip | // Get the activated stake percentage (based on the provided bank) that is visible in gossip | ||||||
| fn get_stake_percent_in_gossip(bank: &Bank, cluster_info: &ClusterInfo, log: bool) -> u64 { | fn get_stake_percent_in_gossip(bank: &Bank, cluster_info: &ClusterInfo, log: bool) -> u64 { | ||||||
|     let mut online_stake = 0; |     let mut online_stake = 0; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user