-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Allow jit to disregard PGO; PGO changes for SPMI and MCS #49551
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
Conversation
* COMPlus_JitDisablePGO will now block the jit from using profile data. Useful for investigations and (someday) bug triage. * `-jitoption` now works for `superpmi.py asmdiffs`. It only applies to the base jit. * Limit SPMI file size path component to 50 chars, so that SPMI can handle being run in directories with long paths we can't control (as happens with tools like `crank`). * Enhance `mcs -jitflags` output to describe how many method contexts have PGO data, and which kinds of data they hold. Useful for validating that an SPMI collection done via dynamic PGO has actually collected an interesting set of jit requests.
cc @dotnet/jit-contrib On the newly-uploaded aspnet SPMI collection:
|
src/coreclr/scripts/superpmi.py
Outdated
@@ -1722,6 +1722,11 @@ def replay_with_asm_diffs(self): | |||
altjit_asm_diffs_flags = target_flags | |||
altjit_replay_flags = target_flags | |||
|
|||
option_flags = [] | |||
if self.coreclr_args.jitoption: | |||
for o in self.coreclr_args.jitoption: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not fond of the user model here, and the asymmetry that you can specify options for the base but not diff.
I would suggest having options -jitoption_base
and -jitoption_diff
, only for the asmdiffs command, so you can support passing these to either base or jit or both. SuperPMI itself only has -jitoption
and -jitoption2
because it doesn't associate any semantics between the JITs, but superpmi.py does have a semantic associated with the order we pass JITs to superpmi.exe.
Comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea; done. Though for some reason I used -base_jit_option
and -diff_jit_option
.
|
||
enum EXTRA_JIT_FLAGS | ||
{ | ||
HAS_PGO = 63, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if you should put a note in corjitflags.h and jitee.h that you're doing this. Or, put a reference here (like a static compile-time assert) using JIT_FLAG_UNUSED34
, JIT_FLAG_UNUSED35
, JIT_FLAG_UNUSED36
, so if anyone changes those, we'll get a build error here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
@@ -294,6 +294,8 @@ | |||
asm_diff_parser.add_argument("--diff_jit_dump", action="store_true", help="Generate JitDump output for diffs. Default: only generate asm, not JitDump.") | |||
asm_diff_parser.add_argument("-temp_dir", help="Specify a temporary directory used for a previous ASM diffs run (for which --skip_cleanup was used) to view the results. The replay command is skipped.") | |||
asm_diff_parser.add_argument("--gcinfo", action="store_true", help="Include GC info in disassembly (sets COMPlus_JitGCDump/COMPlus_NgenGCDump; requires instructions to be prefixed by offsets).") | |||
asm_diff_parser.add_argument("-base_jit_option", action="append", help="Option to pass to the baselne JIT. Format is key=value, where key is the option name without leading COMPlus_...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like these names better than my original suggestion
src/coreclr/scripts/superpmi.py
Outdated
diff_option_flags = [] | ||
if self.coreclr_args.diff_jit_option: | ||
for o in self.coreclr_args.diff_jit_option: | ||
diff_option_flags += "-jitoption2", o |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The superpmi.exe flag is actually -jit2option
src/coreclr/scripts/superpmi.py
Outdated
base_txt = await create_one_artifact(self.base_jit_path, base_location) | ||
diff_txt = await create_one_artifact(self.diff_jit_path, diff_location) | ||
base_txt = await create_one_artifact(self.base_jit_path, base_location, flags + base_option_flags) | ||
diff_txt = await create_one_artifact(self.diff_jit_path, diff_location, flags + diff_option_flags) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't going to work for creating the asm files for diffs, because it will pass -jit2option
(when that is fixed), however, we're only passing a single JIT in the "create dasm file artifacts" case (as opposed to the "do asm diffs by passing two JITs and -a
). So you need (with better names) diff_option_flags_for_asmdiffs
using -jit2option
and diff_option_flags_for_generating_dasm
using -jitoption
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok. I only tried it for the base jit... should have tried it with the diff jit too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
OSX not happy with my file name hackery.
|
Seems like the logic here is wonky, if runtime/src/coreclr/ToolBox/superpmi/superpmi-shared/spmiutil.cpp Lines 156 to 198 in ec5d2ee
|
Probably simplest to resolve relative paths so we don't need to guess how long things are. |
@BruceForstall I redid the file name generation logic, feel free to take another look. |
@@ -1859,7 +1879,7 @@ async def create_replay_artifacts(print_prefix, item, self, mch_file, env_vars, | |||
# as the LoadLibrary path will be relative to the current directory. | |||
with ChangeDir(self.coreclr_args.core_root): | |||
|
|||
async def create_one_artifact(jit_path: str, location: str) -> str: | |||
async def create_one_artifact(jit_path: str, location: str, flags: list[str]) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that flags: list[str]
won't work with Python3.8 or lower, list was changed to be generic in 3.9.
It is probably not a big deal that some narrow parts need a higher python version than the minimal supported for the repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do run collections using this script on Helix machines which have 3.5 (I think), and merge/upload on the "build" machines which have something different (3.6?), so it could be a problem. But this is replay, which is only done on local user machines.
COMPlus_JitDisablePGO will now block the jit from using profile data. Useful
for investigations and (someday) bug triage.
-jitoption
now works forsuperpmi.py asmdiffs
. It only applies tothe base jit.
Limit SPMI file size path component to 50 chars, so that SPMI can handle
being run in directories with long paths we can't control (as happens with
tools like
crank
).Enhance
mcs -jitflags
output to describe how many method contexts havePGO data, and which kinds of data they hold. Useful for validating that an
SPMI collection done via dynamic PGO has actually collected an interesting
set of jit requests.