-
Notifications
You must be signed in to change notification settings - Fork 5k
JIT produces different asm from IL emit than from source #89685
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
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsWhile refactoring BenchmarkDotNet to call benchmark methods directly instead of through a delegate (dotnet/BenchmarkDotNet#2334), I ran into an issue where the Default toolchain call qword ptr [BenchmarkDotNet.Autogenerated.Runnable_0.__Overhead()] InProcessEmit call BenchmarkDotNet.Autogenerated.Runnable_0.__Overhead() It wouldn't really be an issue if the workload call also used the same call instruction, but it doesn't, so the overhead measurement is off. call qword ptr [ActualWork.IncrementField()] Is there any way I can make the asm match so we can get correct measurements? call-direct-default-asm.md
|
Managed calls are always expected to be indirect (square brackets) so it's not clear to me what produced the direct calls, perhaps, those are direct calls to jump-stubs? |
Maybe it's related to the fact that ILEmit is not tiered? |
Would that matter here, though? The |
They're indirect not because of tiereing, but because of stubs and potential rejit profiler sessions |
I tried making the wrapper method static and passing in the instance for a virtual call. No matter what I tried, I could not get the overhead and workload calls to have the same assembly call. This is only an issue in net7.0+, net6.0 has matching assembly for both methods (it uses the direct calls without |
Are there any steps on how to reproduce this locally? |
Are you able to pull my fork/branch and check it? If not, I can try to create a simple repro. |
I can clone it but it'd be nice to have exact steps on how to build it and reproduce 🙂 |
While refactoring BenchmarkDotNet to call benchmark methods directly instead of through a delegate (dotnet/BenchmarkDotNet#2334), I ran into an issue where the
InProcessEmitToolchain
is producing different results than the default toolchain. I disassembled it to try to figure out why it was different, and found the only difference is the call instruction.Default toolchain
InProcessEmit
It wouldn't really be an issue if the workload call also used the same call instruction, but it doesn't, so the overhead measurement is off.
Is there any way I can make the asm match so we can get correct measurements?
call-direct-default-asm.md
call-direct-inprocess-asm.md
The text was updated successfully, but these errors were encountered: