-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Conservative fix for struct stores in optRemoveRedundantZeroInits #102580
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Diffs a bit conservative with a risk to introduce a gc hole (Thanks @SingleAccretion for spotting this issue!). Technically, in many cases such stores won't be converted to calls but any assumptions we can make here are too fragile. I propose we merge this as is and address dotnet/performance regressions if there will be any. We can consider introducing new flags to guarantee that a store won't be converted into a call etc. cc @SingleAccretion @dotnet/jit-contrib |
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.
A test needs to be added.
…have-gc-safepoints
…have-gc-safepoints
/azp list |
This comment was marked as resolved.
This comment was marked as resolved.
/azp run runtime-coreclr outerloop, runtime-coreclr jitstress, runtime-coreclr gcstress0x3-gcstress0xc, runtime-coreclr gcstress-extra |
Azure Pipelines successfully started running 4 pipeline(s). |
/azp run runtime-coreclr outerloop, runtime-coreclr jitstress, runtime-coreclr gcstress0x3-gcstress0xc, runtime-coreclr gcstress-extra |
Azure Pipelines successfully started running 4 pipeline(s). |
When I added the original not refactored commit to #102415, the GC stress results have improved considerably. There were still a few failures, but a lot less than before. It seems the original issue could be responsible for a noticeable fraction of random failures. |
@VSadov @jakobbotsch can I get a green approval then? I hope it will indeed reduce number of random gc hole asserts |
src/coreclr/jit/compiler.hpp
Outdated
// This is quite a conservative fix as it's hard to prove Lower won't do it at this point. | ||
if (tree->OperIsLocalStore()) | ||
{ | ||
return lvaTable[tree->AsLclVarCommon()->GetLclNum()].TypeGet() == TYP_STRUCT; |
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.
return lvaTable[tree->AsLclVarCommon()->GetLclNum()].TypeGet() == TYP_STRUCT; | |
return lvaGetDesc(tree->AsLclVarCommon())->TypeGet() == TYP_STRUCT; |
Feel free to include it in a future change...
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 think this should check the tree type instead of the local's type, i. e. return tree->TypeIs(TYP_STRUCT)
. One can have struct stores for primitive locals.
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.
Looks simpler so I'm all for it, but it seems unlikely those would end up lowered to calls.
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.
Ok, changed
Fixes #102577