-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stabilize x86/x86_64 intrinsics #414
Conversation
coresimd/x86/cpuid.rs
Outdated
@@ -44,8 +49,11 @@ pub struct CpuidResult { | |||
/// [wiki_cpuid]: https://en.wikipedia.org/wiki/CPUID | |||
/// [intel64_ref]: http://www.intel.de/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf | |||
/// [amd64_ref]: http://support.amd.com/TechDocs/24594.pdf | |||
/// | |||
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=__cpuid_count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not an "official" Intel intrinsic, so this link returns empty. IIRC at least the cpuid intrinsics and the read/writeeflags intrinsics will suffer from this. There should be a list of these or their modules in the stdsimd-verify
module.
@@ -334,6 +340,7 @@ pub use self::test::*; | |||
|
|||
#[doc(hidden)] | |||
#[allow(non_camel_case_types)] | |||
#[stable(feature = "simd_x86", since = "1.27.0")] | |||
pub(crate) trait m128iExt: Sized { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't recall exactly what pub(crate)
does so am just tripple checking this: these traits should not be exported by core
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct!
coresimd/x86/mod.rs
Outdated
@@ -598,5 +606,3 @@ pub use self::aes::*; | |||
mod rdrand; | |||
pub use self::rdrand::*; | |||
|
|||
mod sha; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened here?
@@ -26,29 +26,38 @@ use stdsimd_test::assert_instr; | |||
/// Perform an intermediate calculation for the next four SHA1 message values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this module was removed from x86/mod.rs
:/
coresimd/x86/sse4a.rs
Outdated
@@ -33,9 +33,12 @@ extern "C" { | |||
/// | |||
/// If `length == 0 && index > 0` or `lenght + index > 64` the result is | |||
/// undefined. | |||
/// | |||
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_extract_si64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So these intrinsics are part of the AMD intrinsics, and are not in the intel IntrinsicsGuide. AMD only provides a pdf with the spec AFAICT so the correct place to point them at would be:
/// [AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions](http://support.amd.com/TechDocs/24594.pdf)
coresimd/x86/tbm.rs
Outdated
@@ -67,62 +71,80 @@ pub fn _bextr2_u64(a: u64, control: u64) -> u64 { | |||
/// Clears all bits below the least significant zero bit of `x`. | |||
/// | |||
/// If there is no zero bit in `x`, it returns zero. | |||
/// | |||
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_blcfill_u32) | |||
#[inline] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here the same as for sse4a applies, these are AMD only.
coresimd/x86/tbm.rs
Outdated
@@ -37,6 +38,7 @@ pub fn _bextr_u32(a: u32, start: u32, len: u32) -> u32 { | |||
/// the least significant bits of the result. | |||
#[inline] | |||
#[target_feature(enable = "tbm")] | |||
#[stable(feature = "simd_x86", since = "1.27.0")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to remove this in this comment. Not that we fix it some day and it suddenly becomes stable.
coresimd/x86/test.rs
Outdated
@@ -12,6 +12,7 @@ pub unsafe fn assert_eq_m64(a: __m64, b: __m64) { | |||
} | |||
|
|||
#[target_feature(enable = "sse2")] | |||
#[stable(feature = "simd_x86", since = "1.27.0")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think anything in this file should have this attribute.
@@ -14,10 +14,13 @@ use stdsimd_test::assert_instr; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OCD: I just realized that this file is still called bmi.rs, but this and the one in x86 should be renamed to bmi1.rs to match the target feature name.
coresimd/x86_64/mod.rs
Outdated
@@ -38,5 +38,3 @@ pub use self::avx2::*; | |||
mod bswap; | |||
pub use self::bswap::*; | |||
|
|||
mod rdrand; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here again, was this intended?
/// This macro only takes one argument which is a string literal of the feature | ||
/// being tested for. The feature names supported are the lowercase versions of | ||
/// the ones defined by Intel in [their documentation][docs]. | ||
/// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to list the whitelisted features here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also mentions that these names are the same as those used by #[target_feature]
, and maybe it might be also worth mentioning twice that is_x86_feature_detected("avx,avx2")
is not supported (even though it works for target feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent ideas!
So the first pass looks good! There are a couple of places where the script needs manual intervention, once those are finished and test pass I'll go over this one more time in more detail. |
Thanks for the close eye on review! I think I've addressed everything |
Also FWIW we should hold off on merging this until the FCP has finished |
Looks good! |
This commit stabilizes all intrinsics in the `x86` and `x86_64` modules, namely allowing stabilization of the `arch::x86` and `arch::x86_64` module in libstd. Stabilizations here were applied in an automated fashion using [this script][scr], and notably everything related to `__m64` was omitted from this round of stabilization [scr]: https://gist.github.com/alexcrichton/5b456d495d6fe1df46a158754565c7a5
Ok! I've merged this into a |
Er actually looks like it all pased! (except rustfmt) |
Yay!! Congrats! |
This commit stabilizes the SIMD in Rust for the x86/x86_64 platforms. Notably this commit is stabilizing: * The `std::arch::{x86, x86_64}` modules and the intrinsics contained inside. * The `is_x86_feature_detected!` macro in the standard library * The `#[target_feature(enable = "...")]` attribute * The `#[cfg(target_feature = "...")]` matcher Stabilization of the module and intrinsics were primarily done in rust-lang/stdarch#414 and the two attribute stabilizations are done in this commit. The standard library is also tweaked a bit with the new way that stdsimd is integrated. Note that other architectures like `std::arch::arm` are not stabilized as part of this commit, they will likely stabilize in the future after they've been implemented and fleshed out. Similarly the `std::simd` module is also not being stabilized in this commit, only `std::arch`. Finally, nothing related to `__m64` is stabilized in this commit either (MMX), only SSE and up types and intrinsics are stabilized. Closes rust-lang#29717 Closes rust-lang#44839 Closes rust-lang#48556
Stabilize x86/x86_64 SIMD This commit stabilizes the SIMD in Rust for the x86/x86_64 platforms. Notably this commit is stabilizing: * The `std::arch::{x86, x86_64}` modules and the intrinsics contained inside. * The `is_x86_feature_detected!` macro in the standard library * The `#[target_feature(enable = "...")]` attribute * The `#[cfg(target_feature = "...")]` matcher Stabilization of the module and intrinsics were primarily done in rust-lang/stdarch#414 and the two attribute stabilizations are done in this commit. The standard library is also tweaked a bit with the new way that stdsimd is integrated. Note that other architectures like `std::arch::arm` are not stabilized as part of this commit, they will likely stabilize in the future after they've been implemented and fleshed out. Similarly the `std::simd` module is also not being stabilized in this commit, only `std::arch`. Finally, nothing related to `__m64` is stabilized in this commit either (MMX), only SSE and up types and intrinsics are stabilized. Closes #29717 Closes #44839 Closes #48556
This commit stabilizes all intrinsics in the
x86
andx86_64
modules, namelyallowing stabilization of the
arch::x86
andarch::x86_64
module in libstd.Stabilizations here were applied in an automated fashion using this
script, and notably everything related to
__m64
was omitted from thisround of stabilization