Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
|
Extracted from #124943 to prepare jitrollingbuilds with the new functionality first PTAL @jakobbotsch @dotnet/jit-contrib |
There was a problem hiding this comment.
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, andJitMetrics::reportavailable outside#ifdef DEBUGso they can be used in retail builds. - Updated
Compiler::compCompileFinish()to callMetrics.report(this)only whenJitReportMetricsis enabled, and movedMetrics.BytesAllocatedcomputation 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>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
|
@copilot Can you please special case |
Co-authored-by: jakobbotsch <7887810+jakobbotsch@users.noreply.github.com>
Done in |

Extracts JIT changes from #124943 into a standalone PR (per reviewer request) to prepare jitrollingbuilds with the new functionality first.
Description
JIT:
DOTNET_JitReportMetricsconfigMetrics.report(this)was called unconditionally in every DEBUG compilation, making O(metrics) JIT-EE calls per method even when no consumer needed them. AddsDOTNET_JitReportMetrics(default0) to gate reporting uniformly across all build configurations; SuperPMI special-cases this config to always return1.jitconfigvalues.h— addsRELEASE_CONFIG_INTEGER(JitReportMetrics, "JitReportMetrics", 0)jitmetadata.cpp— movesJitMetadata::report,reportValue, andJitMetrics::reportout of#ifdef DEBUGso they compile in release builds (required since SuperPMImemorydiffuses release JIT binaries);dump/mergeToRootremain debug-onlycompiler.cppMetrics.BytesAllocatedcomputation behindJitReportMetricscheck (avoids arena page-walk overhead when metrics aren't consumed)Metrics.report(this)behindJitConfig.JitReportMetrics()— unified across DEBUG and release builds (no longer unconditional in DEBUG):superpmi/jithost.cpp— special-casesJitReportMetricsinJitHost::getIntConfigValueto always return1, next to the existingSuperPMIMethodContextNumberspecial casesuperpmi-shim-collector/jithost.cpp— excludesJitReportMetricsfrom collection (same pattern asSuperPMIMethodContextNumber) 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.