-
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
Don't swap under STRESS_REVERSE_FLAG in gtSetEvalOrder. #49074
Conversation
I think the fact that there's no way to cost a tree without potentially reshaping the tree it is quite unfortunate. So I'd like to see us follow a path where the side effects are optional. |
@AndyAyersMS do you mean option 1? I hesitate to do it in this PR, to be honest, because it would be too big or not clearer than what we have now. The problem is that
and if I change it to I can open a new issue to split |
Yes, something like option 1. Generally I don't think we would want to set the costs on the nodes -- just have a method to cost a tree that uses the same /similar costing logic. Getting the right degree of sharing and flexibility might be tricky. It would be useful to be able to cost trees early on, even if the costs are estimates, without altering the trees. For example, for inline direct sub we might consider making copies of cheap trees; for finally cloning we could better assess the cost of the clone, etc. |
PTAL @dotnet/jit-contrib , the failure is unrelated. |
Seems odd to me to suppress the stress case with Do you know why for just those few operators we actually mutate the tree operands instead of setting |
I was investigating this and my understanding is that all other cases where we can swap for profitability (
The main problem is that Another example of such inconsistency: we clear all |
closing for now. |
There could be a situation when
gtSetEvalOrder
was called fromgtPrepareCost
<-fgOptimizeBranch
<-fgReorderBlocks
<-fgInsertGCPolls
, in this case the users were not expecting such swaps and were failing when callingfgDebugCheckStmtsList
.The alternative fixes were:
gtSetEvalOrder
with newbool doChanges = false
fromgtPrepareCost
- quite disruptive, cases asm diffs in default;fgSetBlockOrder
infgOptimizeBranch
orfgReorderBlocks
- makes TP worse in default scenario;fgTreeCostCalculated
and don't callgtPrepareCost
when it is already known - quite disruptive, cases asm diffs in default;so because the issue happened only in JitStress=2 only on arm64 apple in 1 test I decided to go with the simplest fix for now.
Fixes #48786.