You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After running benchmarks for 3.1 vs 5.0 using "Ubuntu arm64 Qualcomm Machines" owned by the JIT Team, I've found out that PerfLabTests.CastingPerf2.CastingPerf.IntObj has regressed x2.
It looks like these are ARM64 specific regressions, I was not able to reproduce it for ARM (the 32-bit variant).
@adamsitnik - could you clarify how to run these on one of the Ubuntu arm64 systems? The command you give above appears to be using windows pathnames, and if I try this:
Assuming you have the right builds of 3.1 and 5.0 installed and dotnet is on your path, and you have cloned the perf repo (to say ~/repos/performance, then
cd ~/repos/performance/src/benchmarks/micro
dotnet run -c Release -f net5.0 -- -f netcoreapp3.1 netcoreapp5.0 --architecture arm64 --filter 'PerfLabTests.CastingPerf2.CastingPerf.IntObj'
should work. Add -d to get the BDN produced disassembly.
If this is a simple unbox, it should be jit-inlined.
Even if not inlined it should not hit cast cache, since unbox requires exact type match*, but it could be calling a managed helper now and there is a small penalty due to tiering/R2R indirection. It is not a lot, but may be noticeable on super fast casts.
I will take a look.
*enums match with underlying types as well and thus have some special handling, but that still does not need to use cache.
Looking at the code generation, the only difference is that in 5.0 several address constants have been CSE'd. The loop goes from 108 bytes down to 64 bytes, but in both cases is small enough that alignment could make a big difference. Unless there's objection I would suggest we close this, and reference #8108 once again. (Perhaps we should add support for a specified loop alignment, even if only for use in benchmarking to validate or invalidate hypotheses such as this.)
@AndyAyersMS - it would be interesting to try implementing #2249 for arm64.
We've marked this 6.0.0, though, as it seems that modifying alignment would require significant perf analysis to ensure that we understand the impact.
Here's the output from perf stat -e "branch-misses,cache-misses,cpu-cycles,instructions,stalled-cycles-frontend,stalled-cycles-backend" (the first one is 5.0 and the second is 3.1):
@TamarChristinaArm is there a recommended set of NOP sequences of varying length, or is there some other practice to ensure alignment?
No, we just emit multiple NOPs. For the larger alignment constraints like 32 we only align it if it means adding less than 16 bytes of padding. For the smaller ones we generally always align it.
It appears the consensus here is the issue is loop alignment, for which we already have linked issues tracking the work, so I'm going to close this. If that's incorrect, then feel free to re-open with a clear note about what unique work/issue this will address.
Activity
JulieLeeMSFT commentedon Sep 1, 2020
@CarolEidt please help look into this.
CC @dotnet/jit-contrib
CarolEidt commentedon Sep 2, 2020
@adamsitnik - could you clarify how to run these on one of the Ubuntu arm64 systems? The command you give above appears to be using windows pathnames, and if I try this:
I get a syntax error on line 39
AndyAyersMS commentedon Sep 2, 2020
Assuming you have the right builds of 3.1 and 5.0 installed and
dotnetis on your path, and you have cloned the perf repo (to say ~/repos/performance, thenshould work. Add
-dto get the BDN produced disassembly.CarolEidt commentedon Sep 2, 2020
Thanks @AndyAyersMS !
AndyAyersMS commentedon Sep 2, 2020
Also this may be touching on the relatively new cast caching, so cc @VSadov.
VSadov commentedon Sep 2, 2020
If this is a simple unbox, it should be jit-inlined.
Even if not inlined it should not hit cast cache, since unbox requires exact type match*, but it could be calling a managed helper now and there is a small penalty due to tiering/R2R indirection. It is not a lot, but may be noticeable on super fast casts.
I will take a look.
*enums match with underlying types as well and thus have some special handling, but that still does not need to use cache.
adamsitnik commentedon Sep 2, 2020
please excuse me for that, I must have copy-pasted it from previous Windows specifc issue. I've fixed the description
If you append 3 to
pythonit should use python 3.x and work:Unfortunately, the BDN disassembler does not support ARM. Some time ago we have switched to use
Icedlibrary and it does not support ARM yet (https://github.com/0xd4d/iced/issues/79, https://github.com/0xd4d/iced/issues/80)CarolEidt commentedon Sep 2, 2020
Looking at the code generation, the only difference is that in 5.0 several address constants have been CSE'd. The loop goes from 108 bytes down to 64 bytes, but in both cases is small enough that alignment could make a big difference. Unless there's objection I would suggest we close this, and reference #8108 once again. (Perhaps we should add support for a specified loop alignment, even if only for use in benchmarking to validate or invalidate hypotheses such as this.)
15 remaining items
CarolEidt commentedon Sep 4, 2020
@AndyAyersMS - it would be interesting to try implementing #2249 for arm64.
We've marked this 6.0.0, though, as it seems that modifying alignment would require significant perf analysis to ensure that we understand the impact.
CarolEidt commentedon Sep 4, 2020
Here's the output from
perf stat -e "branch-misses,cache-misses,cpu-cycles,instructions,stalled-cycles-frontend,stalled-cycles-backend"(the first one is 5.0 and the second is 3.1):TamarChristinaArm commentedon Sep 7, 2020
No, we just emit multiple
NOPs. For the larger alignment constraints like32we only align it if it means adding less than 16 bytes of padding. For the smaller ones we generally always align it.BruceForstall commentedon Nov 10, 2020
It appears the consensus here is the issue is loop alignment, for which we already have linked issues tracking the work, so I'm going to close this. If that's incorrect, then feel free to re-open with a clear note about what unique work/issue this will address.
kunalspathak commentedon Nov 10, 2020
On my Windows x64, when I tested this benchmark with my changes in #44370, I did see this benchmark improved.
adamsitnik commentedon Nov 12, 2020
@kunalspathak This particular regression was specific to ARM64 (not x64). Is there any chance you could check the ARM results?
kunalspathak commentedon Nov 12, 2020
Ah, that's true. Currently my loop alignment is for xarch, but once I get it for arm, I will verify this.