feat: std_detect avx512fp16
Signed-off-by: usamoi <usamoi@outlook.com>
This commit is contained in:
parent
da78357bf7
commit
8531e289b0
4 changed files with 13 additions and 6 deletions
|
|
@ -75,6 +75,7 @@ features! {
|
|||
/// * `"avx512bitalg"`
|
||||
/// * `"avx512bf16"`
|
||||
/// * `"avx512vp2intersect"`
|
||||
/// * `"avx512fp16"`
|
||||
/// * `"f16c"`
|
||||
/// * `"fma"`
|
||||
/// * `"bmi1"`
|
||||
|
|
@ -169,6 +170,8 @@ features! {
|
|||
/// AVX-512 BF16 (BFLOAT16 instructions)
|
||||
@FEATURE: #[stable(feature = "simd_x86", since = "1.27.0")] avx512vp2intersect: "avx512vp2intersect";
|
||||
/// AVX-512 P2INTERSECT
|
||||
@FEATURE: #[stable(feature = "simd_x86", since = "1.27.0")] avx512fp16: "avx512fp16";
|
||||
/// AVX-512 FP16 (FLOAT16 instructions)
|
||||
@FEATURE: #[stable(feature = "simd_x86", since = "1.27.0")] f16c: "f16c";
|
||||
/// F16C (Conversions between IEEE-754 `binary16` and `binary32` formats)
|
||||
@FEATURE: #[stable(feature = "simd_x86", since = "1.27.0")] fma: "fma";
|
||||
|
|
|
|||
|
|
@ -69,12 +69,13 @@ pub(crate) fn detect_features() -> cache::Initializer {
|
|||
|
||||
// EAX = 7, ECX = 0: Queries "Extended Features";
|
||||
// Contains information about bmi,bmi2, and avx2 support.
|
||||
let (extended_features_ebx, extended_features_ecx) = if max_basic_leaf >= 7 {
|
||||
let CpuidResult { ebx, ecx, .. } = unsafe { __cpuid(0x0000_0007_u32) };
|
||||
(ebx, ecx)
|
||||
} else {
|
||||
(0, 0) // CPUID does not support "Extended Features"
|
||||
};
|
||||
let (extended_features_ebx, extended_features_ecx, extended_features_edx) =
|
||||
if max_basic_leaf >= 7 {
|
||||
let CpuidResult { ebx, ecx, edx, .. } = unsafe { __cpuid(0x0000_0007_u32) };
|
||||
(ebx, ecx, edx)
|
||||
} else {
|
||||
(0, 0, 0) // CPUID does not support "Extended Features"
|
||||
};
|
||||
|
||||
// EAX = 0x8000_0000, ECX = 0: Get Highest Extended Function Supported
|
||||
// - EAX returns the max leaf value for extended information, that is,
|
||||
|
|
@ -217,6 +218,7 @@ pub(crate) fn detect_features() -> cache::Initializer {
|
|||
enable(extended_features_ecx, 11, Feature::avx512vnni);
|
||||
enable(extended_features_ecx, 12, Feature::avx512bitalg);
|
||||
enable(extended_features_ecx, 14, Feature::avx512vpopcntdq);
|
||||
enable(extended_features_edx, 23, Feature::avx512fp16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,6 +233,7 @@ fn x86_all() {
|
|||
"avx512vp2intersect {:?}",
|
||||
is_x86_feature_detected!("avx512vp2intersect")
|
||||
);
|
||||
println!("avx512fp16 {:?}", is_x86_feature_detected!("avx512fp16"));
|
||||
println!("f16c: {:?}", is_x86_feature_detected!("f16c"));
|
||||
println!("fma: {:?}", is_x86_feature_detected!("fma"));
|
||||
println!("bmi1: {:?}", is_x86_feature_detected!("bmi1"));
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ fn dump() {
|
|||
"avx512vp2intersect {:?}",
|
||||
is_x86_feature_detected!("avx512vp2intersect")
|
||||
);
|
||||
println!("avx512fp16 {:?}", is_x86_feature_detected!("avx512fp16"));
|
||||
println!("fma: {:?}", is_x86_feature_detected!("fma"));
|
||||
println!("abm: {:?}", is_x86_feature_detected!("abm"));
|
||||
println!("bmi: {:?}", is_x86_feature_detected!("bmi1"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue