Skip to content

Introduce DOTNET_JitReportMetrics#124975

Merged
EgorBo merged 8 commits intomainfrom
copilot/extract-jit-changes-for-pr
Feb 28, 2026
Merged

Introduce DOTNET_JitReportMetrics#124975
EgorBo merged 8 commits intomainfrom
copilot/extract-jit-changes-for-pr

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

Extracts JIT changes from #124943 into a standalone PR (per reviewer request) to prepare jitrollingbuilds with the new functionality first.

Description

JIT: DOTNET_JitReportMetrics config

Metrics.report(this) was called unconditionally in every DEBUG compilation, making O(metrics) JIT-EE calls per method even when no consumer needed them. Adds DOTNET_JitReportMetrics (default 0) to gate reporting uniformly across all build configurations; SuperPMI special-cases this config to always return 1.

  • jitconfigvalues.h — adds RELEASE_CONFIG_INTEGER(JitReportMetrics, "JitReportMetrics", 0)
  • jitmetadata.cpp — moves JitMetadata::report, reportValue, and JitMetrics::report out of #ifdef DEBUG so they compile in release builds (required since SuperPMI memorydiff uses release JIT binaries); dump/mergeToRoot remain debug-only
  • compiler.cpp
    • Gates Metrics.BytesAllocated computation behind JitReportMetrics check (avoids arena page-walk overhead when metrics aren't consumed)
    • Gates Metrics.report(this) behind JitConfig.JitReportMetrics() — unified across DEBUG and release builds (no longer unconditional in DEBUG):
      if (JitConfig.JitReportMetrics())
      {
          Metrics.report(this);
      }
  • superpmi/jithost.cpp — special-cases JitReportMetrics in JitHost::getIntConfigValue to always return 1, next to the existing SuperPMIMethodContextNumber special case
  • superpmi-shim-collector/jithost.cpp — excludes JitReportMetrics from collection (same pattern as SuperPMIMethodContextNumber) so it is not recorded into method contexts

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 27, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
@EgorBo EgorBo marked this pull request as ready for review February 27, 2026 15:30
Copilot AI review requested due to automatic review settings February 27, 2026 15:30
@EgorBo
Copy link
Member

EgorBo commented Feb 27, 2026

Extracted from #124943 to prepare jitrollingbuilds with the new functionality first

PTAL @jakobbotsch @dotnet/jit-contrib

@EgorBo EgorBo requested a review from jakobbotsch February 27, 2026 15:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new JIT configuration switch (DOTNET_JitReportMetrics / JitReportMetrics) to optionally report per-method JIT metrics back to the EE, and refactors metrics reporting so it can be enabled outside of DEBUG builds.

Changes:

  • Added RELEASE_CONFIG_INTEGER(JitReportMetrics, "JitReportMetrics", 0) to enable config-controlled metrics reporting.
  • Made JitMetadata::report, reportValue, and JitMetrics::report available outside #ifdef DEBUG so they can be used in retail builds.
  • Updated Compiler::compCompileFinish() to call Metrics.report(this) only when JitReportMetrics is enabled, and moved Metrics.BytesAllocated computation out of #if MEASURE_MEM_ALLOC.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/coreclr/jit/jitmetadata.cpp Moves core metric-reporting helpers out of #ifdef DEBUG while keeping debug-only helpers guarded.
src/coreclr/jit/jitconfigvalues.h Adds the new JitReportMetrics release config flag.
src/coreclr/jit/compiler.cpp Gates Metrics.report(this) behind JitReportMetrics and adjusts where BytesAllocated is computed.

Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
Copilot AI changed the title [WIP] Extract JIT changes and introduce DOTNET_JitReportMetrics Introduce DOTNET_JitReportMetrics; bump rollup to 4.59.0 Feb 27, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@EgorBo
Copy link
Member

EgorBo commented Feb 27, 2026

{22A6E4DB-F054-4F40-ABAF-5D25DBA82C46}

I have no idea how/why this happened

@EgorBo
Copy link
Member

EgorBo commented Feb 27, 2026

@copilot please revert changes in ec15521 they're not related to this PR

Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 27, 2026

@copilot please revert changes in ec15521 they're not related to this PR

Reverted all 5 rollup-related files from ec15521 in commit 70de763. The PR now only contains the JIT changes.

Copilot AI changed the title Introduce DOTNET_JitReportMetrics; bump rollup to 4.59.0 Introduce DOTNET_JitReportMetrics Feb 27, 2026
@EgorBo
Copy link
Member

EgorBo commented Feb 27, 2026

No diffs

@jakobbotsch
Copy link
Member

@copilot Can you please special case JitReportMetrics in JitHost::getIntConfigValue to always return 1 for SuperPMI, next to the special case for SuperPMIMethodContextNumber? Then unify the JIT side to always base the reporting of metrics on this config value, instead of making it dependent on DEBUG.

Co-authored-by: jakobbotsch <7887810+jakobbotsch@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 27, 2026

@copilot Can you please special case JitReportMetrics in JitHost::getIntConfigValue to always return 1 for SuperPMI, next to the special case for SuperPMIMethodContextNumber? The...

Done in 5e64188. Added JitReportMetrics special case in SuperPMI's getIntConfigValue (returns 1, next to SuperPMIMethodContextNumber), added it to the shim-collector skip list, and unified the JIT side to always gate on JitConfig.JitReportMetrics() — no more DEBUG-specific unconditional path. Builds succeed in Debug, Checked, and Release.

@EgorBo EgorBo merged commit b41bbea into main Feb 28, 2026
130 checks passed
@EgorBo EgorBo deleted the copilot/extract-jit-changes-for-pr branch February 28, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants