-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[interp] Disable tiered compilation if the interpreter is enabled #118911
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
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
I encountered this issue only in the Checked configuration. It occurs when pCallStub is null and the routines offset is 0x10:
|
RE: Comments so far:
It seems like we're somehow getting an InterpMethod without a pCallStub when we need it to have one. And it sounds like it's not okay to generate a callstub in advance for every method (jkotas's reason for this makes sense). I think this means I need to make the InterpreterStub lazily instantiate the pCallStub as needed. Any ideas for other solutions? |
It occurred to me to try setting DOTNET_TieredCompilation=0 and that fixes it. EDIT: Evidence via tracepoints:
|
Does it repro reliably with runtime/src/coreclr/inc/clrconfigvalues.h Lines 486 to 488 in 749340b
I do not think this should be needed. The invariant should be that we go through prestub before we need the pCallStub. It sounds like that background tiered compilation breaks this invariant. I would rather look at fixing the tiered compilation so that it does not break this invariant. |
Further investigation shows that tiered compilation is recompiling the interpreted method, so we're replacing an existing InterpMethod that has a pCallStub with a new one that doesn't have a pCallStub. I don't think tiered compilation should do this, so I'm going to investigate whether I can make it not overwrite an existing interpreted method. EDIT:
Yes |
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.
Pull Request Overview
This PR fixes a crash in the interpreter when tiered compilation overwrites existing interpreter code with new code that lacks a call stub. The fix disables tiered compilation for methods that have interpreter code, preventing the tiered compilation thread from interfering with interpreter execution.
Key changes:
- Disable tiered compilation eligibility for methods with interpreter code
- Disable call counting for methods with interpreter code to prevent tiered compilation triggers
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/coreclr/vm/method.inl | Adds check to exclude methods with interpreter code from tiered compilation eligibility |
src/coreclr/vm/method.hpp | Prevents call counting for methods with interpreter code to avoid tiered compilation triggers |
Open to thoughts on whether the diagnostic message in here is useful or not. I'm leaning towards removing it, it was just added for testing. But maybe it's useful for the user to know when they enable the interpreter that it's turning off tiered compilation? |
I agree. If you set environment variables, you have to know what you are doing. We do not have diagnostic message like this for any other environment variables. |
Co-authored-by: Jan Kotas <[email protected]>
When I run JIT\directed\tailcall\more_tailcalls in the debugger it crashes in this helper because pCallStub is NULL. I'm not sure why it's only broken in the debugger. I think @kotlarmilos has hit this problem before, this is not my first time seeing it. It manifests as an AV reading the address 0x10.
EDIT: This PR disables tiered compilation if DOTNET_Interpreter or DOTNET_InterpMode are in use.