-
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
JIT: one-sided inference from unrelated predicates #72979
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsSimplistic version where we just look for identical operands.
|
/azp run fuzzlyn |
Azure Pipelines successfully started running 1 pipeline(s). |
Simplistic version where we just look for identical operands.
Looking at regressions I realized that we sometimes stop looking too early. In earlier versions of |
Also, a fair number of the larger improvements are from removing what appear to be cloned loops. |
9c702bf
to
9e5e422
Compare
@@ -178,15 +178,123 @@ void Compiler::optRelopImpliesRelop(RelopImplicationInfo* rii) | |||
|
|||
genTreeOps const oper = genTreeOps(funcApp.m_func); | |||
|
|||
// Exclude floating point relops. |
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 we could also infer the tree relop's value from other
// dominating relops, for example, (x >= 0) dominating (x > 0).
// That is left as a future enhancement.
This comment at the top of function can be deleted now?
rii->reverseSense = ((treeOper == GT_GT) || (treeOper == GT_LT)); | ||
rii->canInferFromTrue = true; | ||
rii->canInferFromFalse = false; | ||
rii->vnRelation = ValueNumStore::VN_RELATION_KIND::VRK_Unrelated; |
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 am trying to understand the meaning of VRK_Unrelated
here. What we are saying is although we can infer R* from R, they are not related meaning they cannot be simply swapped or reversed, but they have slightly different operators. Can we have something meaningful enum value for such cases like VRK_DomInferred
or similar?
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.
Happy to rename it if you think it makes things clearer.
@dotnet/jit-contrib PTAL |
@@ -370,11 +481,26 @@ bool Compiler::optRedundantBranch(BasicBlock* const block) | |||
return false; | |||
} | |||
|
|||
// Was this an inference from an unrelated relop (GE => GT, say)? | |||
// | |||
const bool domIsUnrelatedRelop = (rii.vnRelation == ValueNumStore::VN_RELATION_KIND::VRK_Unrelated); |
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.
likewise here...if you can rename from domIsUnrelatedRelop
to domIsInferredRelop
, that would be great.
LGTM with few suggestions. |
rii->canInferFromFalse = false; | ||
rii->canInferFromTrue = true; | ||
rii->vnRelation = ValueNumStore::VN_RELATION_KIND::VRK_Unrelated; | ||
break; |
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.
@AndyAyersMS nit: in my attempt to do something very similar I ended up with a sort of a table, like this:
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.
Yeah, there's probably some refactoring like this that makes sense.
@@ -178,15 +178,123 @@ void Compiler::optRelopImpliesRelop(RelopImplicationInfo* rii) | |||
|
|||
genTreeOps const oper = genTreeOps(funcApp.m_func); |
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 assume it doesn't currently handle unsigned comparisons? (e.g. VNF_GT_UN)
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.
Correct, it does not handle them.
Ok, revised per feedback. Same diffs as before (locally). |
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.
Refactoring looks much better now. Thanks!
Superpmi failure is a timeout. |
Simplistic version where we just look for identical operands.