-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Decouple FEATURE_HW_INTRINSICS
from FEATURE_SIMD
#9473
Comments
FYI. @fiigii |
We are reusing |
All of the
If that is expected to be the case long term, we should likely have some asserts/etc to ensure that FEATURE_SIMD is turned on when FEATURE_HW_INTRINSICS is. Currently, it is possible to turn off FEATURE_SIMD, but not turn off FEATURE_HW_INTRINSICS and the build will break. (However, I am not convinced that coupling them should be the long term case). |
Yes, and I tried. I remember that is not such trivial... |
No.
My proposal is to decouple them completely such that one or the other can be enabled or disabled without impacting the other. Realistically, the hardware intrinsics are providing a way to write type-safe inline psuedo-assembly. In order to support that we are essentially adding specialized codegen and compiler support for multiple hardware instructions. Additionally, each hardware intrinsic generally represents a single underlying hardware instruction, so this provides an easy way to declare chains of instructions that will undergo the various compiler stages (rather than requiring an intermediate node that is processed and finally emitted). Because of this, my opinion is that the hardware intrinsics are a feature that other features or code should be dependent on (and not the other way around). |
|
@CarolEidt any comment? |
My understanding is that the final goal is to implement |
I don't think it is clear that that would be an improvement, and is certainly not a high priority to make that switch. That said, I don't think it's desirable to have
Yes, I think that's the right approach, such that
I don't think this would imply enabling only scalar HW intrinsics. I would think that Another possibility would be to define an addition feature, e.g.
Wow - that's an old comment (also here: https://github.com/dotnet/coreclr/blob/master/src/inc/clrconfigvalues.h#L542) that dates back to my original prototype of the feature! It should be updated to System.Numerics.Vectors.dll. |
Submitted dotnet/coreclr#15699 to fix the description of the feature. |
I agree. I, personally, think that there are some benefits to doing so (at the very least in the maintainability area). However, that requires prototyping (I have this locally, but it requires HWIntrinsics to be more generally implemented first), testing, etc.
I think, long term, it might be beneficial to have them (the core/shared bits, such as TYP_SIMD16 and TYP_SIMD32) behind their own flag (which is set centrally based on other flags being set) or not behind a flag at all. The core/shared bits here are useful in multiple scenarios such as SIMD, HWIntrinsics, AutoVectorization, etc. So decentralizing them from any one feature probably makes sense. |
Moved to the HWIntrinsics project. |
|
I was thinking In either case, its probably worth a more in depth discussion before someone goes and does this work. |
On further consideration, I think it would be best to have:
We could easily have static asserts that we don't have the 2nd or 3rd without the first. |
@CarolEidt, so:
Is that about right? |
@tannergooding - yes, that's what I was thinking. It makes for more |
I think the premise is generally good, but I worry about |
Not clear why.
I think @CarolEidt proposed names are unclear. How about?
|
The only thing (and it probably doesn't matter) is ISA families that have no SIMD (e.g. popcnt and lzcnt). I wouldn't expect |
Sounds fine to me |
At least for x86/x64 (updated comment above to clarify that), we only have a couple of ISAs (such as
Ok, so your suggesting |
Right - though I'm not adamant about the need to separate them, given that it's only those two, and it's unlikely we'd support those and not others. |
I think ARM may be better suited to take advantage of this, given their ISA split/design, if we wanted to do it this way. @sdmaclea, could you confirm? |
I would expect SIMD to be typically in separate classes from scalar operations. Although I do know why extra feature flags would be an advantage. Personally the only reason for the I don't see a reason to split |
After going through the majority of the code a couple times, looking at what is shared between SimdNumerics/HWIntrinsics, and going over the discussions made here; I propose the following changes:
If |
There are a few places in the code-base where
FEATURE_HW_INTRINSICS
functionality is dependent onFEATURE_SIMD
also being defined.The hardware intrinsics feature should (ideally) share code with the SIMD feature, where possible, but should not be dependent on it being defined.
category:implementation
theme:vector-codegen
skill-level:intermediate
cost:small
The text was updated successfully, but these errors were encountered: