Skip to content
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

JIT: Add a simple Counter dumpable #98350

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

jakobbotsch
Copy link
Member

This allows easily measuring and outputting a single value at the end of all JIT compilations.

Example use:

@@ -1137,6 +1137,9 @@ void Compiler::optReplaceWidenedIV(unsigned lclNum, unsigned newLclNum, Statemen
     }
 }
 
+static Counter s_widened;
+static DumpOnShutdown d("Widened IVs", &s_widened);
+
 //------------------------------------------------------------------------
 // optInductionVariables: Try and optimize induction variables in the method.
 //
@@ -1275,6 +1278,7 @@ PhaseStatus Compiler::optInductionVariables()
             });
 
             changed |= optSinkWidenedIV(lcl->GetLclNum(), newLclNum, loop);
+            s_widened.Value++;
         }
     }

This allows easily measuring and outputting a single value at the end of
all JIT compilations.
@ghost ghost assigned jakobbotsch Feb 13, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 13, 2024
@ghost
Copy link

ghost commented Feb 13, 2024

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

Issue Details

This allows easily measuring and outputting a single value at the end of all JIT compilations.

Example use:

@@ -1137,6 +1137,9 @@ void Compiler::optReplaceWidenedIV(unsigned lclNum, unsigned newLclNum, Statemen
     }
 }
 
+static Counter s_widened;
+static DumpOnShutdown d("Widened IVs", &s_widened);
+
 //------------------------------------------------------------------------
 // optInductionVariables: Try and optimize induction variables in the method.
 //
@@ -1275,6 +1278,7 @@ PhaseStatus Compiler::optInductionVariables()
             });
 
             changed |= optSinkWidenedIV(lcl->GetLclNum(), newLclNum, loop);
+            s_widened.Value++;
         }
     }
Author: jakobbotsch
Assignees: jakobbotsch
Labels:

area-CodeGen-coreclr

Milestone: -

@EgorBo
Copy link
Member

EgorBo commented Feb 13, 2024

oh, didn't know Dumpable existed, I always used just a plain fopen/fprintf 🙂

@ryujit-bot
Copy link

Diff results for #98350

Throughput diffs

Throughput diffs for linux/arm64 ran on windows/x64

MinOpts (-0.01% to +0.00%)
Collection PDIFF
libraries.pmi.linux.arm64.checked.mch -0.01%

Throughput diffs for osx/arm64 ran on windows/x64

MinOpts (-0.00% to +0.01%)
Collection PDIFF
realworld.run.osx.arm64.checked.mch +0.01%

Throughput diffs for windows/arm64 ran on windows/x64

MinOpts (-0.00% to +0.01%)
Collection PDIFF
libraries.pmi.windows.arm64.checked.mch +0.01%

Details here


@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @AndyAyersMS

@jakobbotsch
Copy link
Member Author

oh, didn't know Dumpable existed, I always used just a plain fopen/fprintf 🙂

These convenience types are a bit new, I added them in #92112. I frequently use them to do quick adhoc measurements of stats

@AndyAyersMS
Copy link
Member

At some point we ought to reconsider our approach: in-jit aggregation vs external aggregation. I get the appeal of the former (no extra step required!) but I frequently find I prefer the latter (via say JitMetrics=1.

But that's no reason to hold up this PR...

@jakobbotsch jakobbotsch merged commit 0ce39a1 into dotnet:main Feb 14, 2024
127 of 129 checks passed
@jakobbotsch jakobbotsch deleted the counter-dumpable branch February 14, 2024 08:50
@github-actions github-actions bot locked and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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