Skip to content

Tiered jitting and BenchmarkDotNet #13069

@AndreyAkinshin

Description

@AndreyAkinshin

.NET Core 3.0 has tiered jitting enabled by default which is pretty important in the context of benchmarking: it may spoil benchmark results if the number of warmup iterations is not enough. It seems it's not such a big issue since .NET Core 3.0 preview 4 (after dotnet/coreclr#23599 was merged). I didn't observe any noticeable tiered jitting effects with .NET Core 3.0 preview 6: all of my benchmarks produce pretty stable results. However, the internal logic of the tiered jitting can be changed in the future versions of .NET Core, so I would like to discuss how can we prepare for the upcoming changes. Currently, I have the following questions:

  • Is it possible to get the current values of the external configuration knobs like TieredCompilation or TC_QuickJit from the runtime? It will be nice to see if the tiered complication is enabled or disabled in the environment section of the BenchmarkDotNet output. Of course, we can use the knowledge of the current environment variable values and the corresponding defaults for each version of .NET Core, but I'm looking for a more reliable way that will not depend on the specific .NET Core version.
  • Is it possible to get the current values of the internal configuration knobs like TC_CallCountThreshold or TC_CallCountingDelayMs? It will be great to use these values in the internal BenchmarkDotNet heuristics (e.g., we can always try to invoke the benchmarked method at least TC_CallCountThreshold times).
  • Is it a good idea to disable tiered jitting in BenchmarkDotNet by default?
  • Is it possible to switch the tiered jitting behavior in runtime? (Relevant for the InProcess BenchmarkDotNet mode)
  • Is it possible to force the runtime to use a specific jit tier for a specific method? (Can be useful for performance comparison of different tiers).
  • Does it make sense to make any other adjustments for the tiered jitting on the BenchmarkDotNet side?

/cc @kouvel @noahfalk @adamsitnik

Some relevant discussions: dotnet/coreclr#23599 https://github.com/dotnet/coreclr/issues/19751 https://github.com/dotnet/coreclr/issues/22998 dotnet/core#2257 dotnet/BenchmarkDotNet#1125 dotnet/coreclr#24576

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions