-
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
Tolerate pathological growth of optCSEHash #40056
Conversation
@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.
Looks Good,
Thanks
@@ -6364,6 +6364,11 @@ class Compiler | |||
}; | |||
|
|||
static const size_t s_optCSEhashSize; | |||
static const size_t s_optCSEhashGrowthFactor; |
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.
This could be renamed to indicate that it is the initial hash table size
s_optCSEhashSize => s_optCSEhashSizeInitial
src/coreclr/src/jit/compiler.h
Outdated
@@ -6364,6 +6364,11 @@ class Compiler | |||
}; | |||
|
|||
static const size_t s_optCSEhashSize; | |||
static const size_t s_optCSEhashGrowthFactor; | |||
static const size_t s_optCSEhashBucketSize; | |||
size_t optCSEhashSize; // Size of hashtable |
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.
// The current size of the hashtable
The optCSEhash can grow an unbounded amount if the function has numerous trees which are put into the optCSEhash as possible CSE candidates, but fewer than MAX_CSE_CNT are found, then the compiler will spend excessive amounts of time looking up entries in the optCSEhash. This fix addresses the issue by making the optCSEhash able to grow its count of buckets.
The
optCSEhash
can grow an unbounded amount if the function has numerous trees which are put into theoptCSEhash
as possible CSE candidates, but fewer thanMAX_CSE_CNT
are found, then the compiler will spend excessive amounts of time looking up entries in theoptCSEhash
.This fix addresses the issue by making the
optCSEhash
able to grow its count of buckets.This fixes #32733, but I'm not certain its the right approach. Potentially avoiding the pathological growth of the hash table would be a better approach.