-
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
Consider re-compling CoreCLR's unmanaged code to mitigate JCC erratum (Nov. 2019) #13794
Comments
Thanks for opening the issue on this. We have been looking into this. |
Separately, since you used Array.Sort as an example, it's no longer implemented in C; as of last week the implementation is all C#. I'm curious if that affects your stated impact at all, or if you see a similar affect on Array.Sort with the latest master? |
@stephentoub That's a very good question. My code itself (in this case the
Given that It was pretty much a copy-paste of I assume that the effects are random in nature, depending on code generation/allocation address randomness. My other benchmarks actually end up doing substantially fewer branches (as in orders of |
Just wanted to circle back and to say that I managed to revert the microcode update in a very localized way on clearlinux (or I assume any Linux):
After doing those two steps and (naturally) rebooting, I'm back to older microcode ( $ grep 'stepping\|model\|microcode' /proc/cpuinfo | head -4
model : 158
model name : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
stepping : 9
microcode : 0xb4 Rerunning the same benchmarks now yields the good old results I've been seeing in the past months: BenchmarkDotNet=v0.12.0, OS=clear-linux-os 31620
Intel Core i7-7700HQ CPU 2.80GHz (Kaby Lake), 1 CPU, 4 logical and 4 physical cores
.NET Core SDK=3.0.100
[Host] : .NET Core 3.0.0 (CoreCLR 4.700.19.46205, CoreFX 4.700.19.46214), X64 RyuJIT
Job-BMTZZL : .NET Core 3.0.0 (CoreCLR 4.700.19.46205, CoreFX 4.700.19.46214), X64 RyuJIT
InvocationCount=3 IterationCount=15 LaunchCount=2
UnrollFactor=1 WarmupCount=10
|
I hope to have all of the data in a format for sharing shortly. The short answer is that I don't think there is any immediate work that needs to be done here, but I will provide more context on this once I have all of the data compiled. |
Intel has recently released a microcode update that adversely affects the performance of... all jumps (!):
https://www.intel.com/content/dam/support/us/en/documents/processors/mitigations-jump-conditional-code-erratum.pdf
I've personally had the "pleasure" of encountering this whilst benchmarking CoreCLR 3.0
Array.Sort()
on clearlinux which seems to have pushed this microcode update earlier than others:https://twitter.com/damageboy/status/1194751035136450560?s=20
For context, Here's the before/after perf hit on

Array.Sort()
:Before:
After:

Very specifically, I was hit with a 20% drop in
Array.Sort()
, and a smaller (by sheer luck I presume?) hit with my own code. Intel claims that the average drop in performance should be in the %0-%4 range.The erratum claims that the microcode update adversely effects:
The recommended fix, per the erratum, is to recompile the code with (Section 3.1.1):
-mbranches-within-32B-boundaries
In theory, this could end with a relatively minor(?) CoreCLR runtime release. Or incorporated into the 3.1 release cycle?
In addition, I think we should have a discussion about possibly applying similar (conditional) fixes to the JIT itself w.r.t the generated code on Intel processors, as it doesn't seem this issue is about to simply go away on its own.
I will open a separate issue for the JIT related discussion.
The text was updated successfully, but these errors were encountered: