Repository navigation
Disable OSR by default - #3201
Conversation
…ds what runtime async costs and why it stays on BenchmarkDotNet 0.16 sets TC_OnStackReplacement=0 and TC_CallCountingDelayMs=0 in every process it starts for a non-ColdStart job (dotnet/BenchmarkDotNet#3201). The comparison jobs set both back to the runtime's defaults, and each process reports them. Putting OSR back took the suspending row's .NET 10 job from 2.5 to 1.8 us a firing; the no-op rows moved by 5 % or less. The benchmark README's "BenchmarkDotNet 0.16, out of process (2026-11-18)" re-measures the 2026-11-17 legs out of process. On the suspending row, Quartz's runtime-async asset allocates about 450 bytes more per firing (+15 %) and takes about 3 % less time. On the no-op rows the bytes are the same. maintainers/architecture.md, "Target frameworks", records the maintainer's decision to keep runtime async on in 4.8, its reasons, and what turning it off takes. Refs #4214 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ds what runtime async costs and why it stays on BenchmarkDotNet 0.16 sets TC_OnStackReplacement=0 and TC_CallCountingDelayMs=0 in every process it starts for a non-ColdStart job (dotnet/BenchmarkDotNet#3201). The comparison jobs set both back to the runtime's defaults, and each process reports them. Putting OSR back took the suspending row's .NET 10 job from 2.5 to 1.8 us a firing; the no-op rows moved by 5 % or less. The benchmark README's "BenchmarkDotNet 0.16, out of process (2026-11-18)" re-measures the 2026-11-17 legs out of process. On the suspending row, Quartz's runtime-async asset allocates about 450 bytes more per firing (+15 %) and takes about 3 % less time. On the no-op rows the bytes are the same. maintainers/architecture.md, "Target frameworks", records the maintainer's decision to keep runtime async on in 4.8, its reasons, and what turning it off takes. Refs #4214 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@timcassell Sorry I didn't see this notification earlier. Disabling OSR is giving misleading results. This is not something most users do when deploying their apps. We have already had one such report. Without OSR methods that have loops essentially bypass tiering, so code quality is also adversely impacted. I think we need to find some other way to solve the problem that disabling OSR is solving. |
|
Thanks @AndyAyersMS. Quick check on the mechanism: as far as I can tell from the source, with
The duplicated tiers will need to be fixed in the JIT. We can revert this, but it will result in the JIT stage taking 50% longer, which I know is significant for dotnet/performance. |
|
They can tier up if called enough and if the app makes it out of "startup mode", but that can take a long time if each call to the benchmark method invokes a long-runing loop. dotnet/runtime#137275 is the example reported to us. We have been living with the duplicate tiers for a while in dotnet/performance. Was that the main motivation for the change...? |
We also disable "startup mode" by default.
I see, it causes a side-effect de-optimization for someone starting an infinite loop worker outside of the benchmark method. That's reason enough to revert this.
Yes. Before the JIT stage was updated to count tiers, dotnet/performance had to make educated guesses for individual benchmarks and force more warmup iterations to get to tier 1. Since it now uses the new JIT stage, all benchmarks are watched and those extra warmups were eliminated. But because of that duplicated tier bug, the JIT stage can't know whether any callees of the watched method are OSR'd, so it conservatively runs extra iterations to nudge that final tier-up. |
Avoids the runtime bug of duplicated instrumented tiers when OSR is enabled to reduce time spent in the JIT stage with out-of-process CoreCLR toolchains with the default run strategy (#3143 (comment)). I think it should not affect the complete tier1 codegen. cc @AndyAyersMS @EgorBo