-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Remove ALT_JIT define and replace with runtime logic #44565
Conversation
@dotnet/jit-contrib |
@dotnet/jit-contrib Assuming that I understand the main value of altjits - reproducing the assertions on cross platforms (x64 -> arm64, x86 -> arm, win-x64 -> linux-x64) I wonder if it is worth defining the altjit related checks under
We stopped running altjit in the CI a while ago. You can run the tests locally to verify the changes.
|
This should fix #41643 We've used altjits in the past for:
|
My main use of altjits is in running diffs, since it's much easier to use a single platform to get diffs for multiple targets. |
I think my changes address everything but the SPMI scenario. Bruce, could you elaborate on that one and give me some guidance on how one might handle that case? |
For SPMI, we need to introduce the SPMI shim between the JIT and VM. Traditionally, we would simply move the clrjit.dll someplace else, then copy the shim to the VM location as clrjit.dll, setting some variables so the shim can find the original clrjit.dll. It's annoying to move / rename files, so now we set the altjit variables to the SPMI shim, and then the shim loads the clrjit.dll (or potentially some cross-plat compiler) in its usual place. The annoying thing is we capture the COMPlus variables into the replay log, and we need to force them off when doing a SPMI replay. |
|
@AndyAyersMS This change makes all jits capable of acting like an altjit, on a per-method basis. From what you say, this should just work then. @BruceForstall So, for SPMI, the fix would be to ignore the altjit jit flag when it comes from the VM, and add some other sort of config flag for SPMI to identify if it should treat the jit it wraps as being an alt jit? Is that what we would need 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.
Generally looks great. Thanks for doing this!
@@ -74,9 +74,6 @@ public override CompilationBuilder UseBackendOptions(IEnumerable<string> options | |||
builder.Add(new KeyValuePair<string, string>(name, value)); | |||
} | |||
|
|||
// As we always use an AltJit to compile, tell the jit to always generate code | |||
builder.Add(new KeyValuePair<string, string>("AltJitNgen", "*")); |
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.
Yay!
@@ -153,24 +154,17 @@ extern void RecordNowayAssertGlobal(const char* filename, unsigned line, const c | |||
#define unreached() noWayAssertBody() | |||
|
|||
#define NOWAY_MSG(msg) noWayAssertBodyConditional(NOWAY_ASSERT_BODY_ARGUMENTS) | |||
#define NOWAY_MSG_FILE_AND_LINE(msg, file, line) noWayAssertBodyConditional(NOWAY_ASSERT_BODY_ARGUMENTS) |
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 guess file
and line
are ignored here, in favor of __FILE__
, __LINE__
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.
Yes. Well, sortof. This is the release portion of the ifdef, where FILE and LINE aren't used at all. The goal is to match the overall behavior of what existed before.
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.
In particular, non-altjits don't put in file/line number stuff, but chk/dbg will.
That would work. I'm not sure we need to worry about the scenario where SPMI collects using an altjit, but if so, maybe we need SPMI-specific flags to set altjit in that case. I think we need a way to tell the VM to load a different primary JIT -- I don't want the SPMI shim to be loaded as an "altjit". We actually have btw, none of these proposed SPMI changes need to happen in this PR. |
I built and tested basic JIT and NGEN altjit asm dumps (with the flags fix I showed) and it works fine. Can you add the following to
at the end of the Note also that you don't need the |
It looks to me like we need a change to SuperPMI to match this change. Currently, when we do SPMI collection, we do so by setting AltJit to the SPMI shim. This causes the collection to capture the COMPlus_AltJit variables. On replay, we generally pass the (annoying) options This implies something about how this is implemented. Currently, the JIT looks to see if |
@davidwrighton I submitted a PR that fixes the SPMI issue: davidwrighton#1 @sandreenko Take a look; my PR is kind of a hack. I think we need to rethink how SPMI collections get invoked w.r.t. the altjit flags. |
Do we set altjit flag during collection for CoreRun nowadays? For crossgen2 we pass a path to the invoked jit, so there we don't use altjit flags. |
Yes, in both superpmi.py and the src\tests\JIT\superpmi>src\tests\JIT\superpmi\superpmicollect.cs, we set it for collection, and force clear it on replay. |
Fix SuperPMI for new altjit jit flag
@BruceForstall I've merged your change, and responded to feedback. Please re-review. |
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
Don't you need to rebase instead of merge (from master)? |
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.
Nice!
The ALT_JIT define was causing confusion and problems when used in crossgen2
This change replaces all of the existing #ifdef logic with a dynamic check of a jit flag.