-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fix the heuristics for L3 cache size for Arm64 #71029
Conversation
Tagging subscribers to this area: @dotnet/gc Issue DetailsWhile L3 cache size is undetermined on Arm64 machines, if we don't get it, use a fixed heuristics based upon the core count.
|
|
||
#ifdef _SC_LEVEL1_DCACHE_SIZE | ||
cacheSize = std::max(cacheSize, ( size_t) sysconf(_SC_LEVEL1_DCACHE_SIZE)); | ||
size = ( size_t) sysconf(_SC_LEVEL1_DCACHE_SIZE); |
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.
Q (also applies to the old src) - what does sysconf return if there's no cache of that level? I presume it returns 0, not -1 (the doc says it returns -1 if there's an error).
@dotnet/jit-contrib , @davidwrighton , @jkotas |
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! thanks @kunalspathak!
@@ -876,21 +876,29 @@ bool ReadMemoryValueFromFile(const char* filename, uint64_t* val) | |||
return result; | |||
} | |||
|
|||
#define UPDATE_CACHE_SIZE_AND_LEVEL(CACHE_LEVEL) if (size > cacheSize) { cacheSize = size; cacheLevel = CACHE_LEVEL; } |
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.
One last nit - please feel free to do that later if you want to get this in before today's snap for preview 6.
Looking at the usages of this macro, I have realized it would be great to make the size
a parameter of the macro too. From the usage sites, it is not obvious where it gets the size from (I have to read the macro definition to figure it out).
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.
Sure, will do it in follow-up PR
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.
Linux/arm64 improvements:
windows/arm64 improvements: |
While L3 cache size is undetermined on Arm64 machines, if we don't get it, use a fixed heuristics based upon the core count.
This led to removing the obscure heuristics we have currently that just multiplies the cache size by 3.