-
-
Notifications
You must be signed in to change notification settings - Fork 854
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
Update Adler32 to correctly filter intrinsics. #1229
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1229 +/- ##
=======================================
Coverage 82.54% 82.54%
=======================================
Files 697 697
Lines 30512 30512
Branches 3469 3469
=======================================
Hits 25187 25187
Misses 4605 4605
Partials 720 720
Continue to review full report at Codecov.
|
We can disable runtime features with environment variables , and run some Adler32 tests in external process. ( I would also add @tannergooding if you are around: do you think this is a reliable approach? |
That is a reliable way to test the software fallback path and is what we do in the runtime (it's also why we exposed these knobs). |
@@ -63,7 +63,7 @@ public static uint Calculate(uint adler, ReadOnlySpan<byte> buffer) | |||
} | |||
|
|||
#if SUPPORTS_RUNTIME_INTRINSICS | |||
if (Sse3.IsSupported && buffer.Length >= MinBufferSize) | |||
if (Ssse3.IsSupported && buffer.Length >= MinBufferSize) | |||
{ | |||
return CalculateSse(adler, buffer); |
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.
Should we also rename CalculateSse
to CalculateSsse
?
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 would say no. It’s still an iteration of SSE technology.
@antonfirsov @tannergooding Test added now. Think I've got it 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.
LGTM, good job!
public const string EnableBMI2 = "COMPlus_EnableBMI2"; | ||
public const string EnableFMA = "COMPlus_EnableFMA"; | ||
public const string EnableHWIntrinsic = "COMPlus_EnableHWIntrinsic"; | ||
public const string EnableIncompleteISAClass = "COMPlus_EnableIncompleteISAClass"; |
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 one isn't a production switch.
For the others, there is a rough hierarchy they follow:
- EnableHWIntrinsic
- EnableSSE
- EnableSSE2
- EnableAES
- EnablePCLMULQDQ
- EnableSSE3
- EnableSSSE3
- EnableSSE41
- EnableSSE42
- EnablePOPCNT
- EnableAVX
- EnableFMA
- EnableAVX2
- EnableSSE42
- EnableSSE41
- EnableSSSE3
- EnableSSE2
- EnableBMI1
- EnableBMI2
- EnableLZCNT
- EnableSSE
FeatureSIMD
ends up impacting all SIMD support (including System.Numerics
) but not things like LZCNT
, BMI1
, or BMI2
EnableSSE3_4
is a legacy switch that exists for compat and is basically the same as EnableSSE3
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.
The hierarchy basically means disabling SSE (EnableSSE=0
) will also disable everything below it
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.
Ah lovely. I'll reference that. I intend on doing more intrinsics work in the near future.
Prerequisites
Description
Introduces the correct intrinsics support check in the enhanced Adler32 implementation. Fix #1228
@antonfirsov if you have any idea how to test this please let me know if you have any thoughts.