-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Rewrite IREquality to use a more compact stack instead of deep recursion #8198
Conversation
Deletes a bunch of code and speeds up lowering time of local laplacian with 20 pyramid levels by ~2.5%
Now more like 4% faster, and fast enough to delete the specialized version of equal in IRMatch.cpp |
return result; | ||
} | ||
size_t hash(const IRNode *a, const IRNode *b) { | ||
uintptr_t pa = (uintptr_t)a; |
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.
Would be nice to comment what hash algo this is for future reference
// structs. We now need to distinguish between different C++ | ||
// pointer types (e.g. char * vs const float *). If would be nice | ||
// if the structs were unique per C++ type. Then comparing the | ||
// pointers above would be sufficient. Unfortunately, different |
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.
Highly useful comment!
void cmp(double a, double b) { | ||
// Floating point scalars need special handling, due to NaNs. | ||
if (std::isnan(a) && std::isnan(b)) { | ||
} else if (std::isnan(a)) { |
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.
Did you mean to leave the both-nan case empty? If so, please add a comment like /*deliberately empty, leave comparison state unchanged */
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 pending comments
Merging. Bots were all green a few commits ago and I've only tweaked comments since then. |
Deletes a bunch of code and speeds up lowering time of local laplacian with 20 pyramid levels by ~2.5%
Also fix some cases where equal wasn't considering recently-added IR node fields like partition_policy (suggestions for some way to guarantee this can't happen would be welcome).
Also changed calls to equal(..., true) to just is_const_one