-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix the heuristics for L3 cache size for Arm64 #71029
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f6310e4
Get cacheLevel for unix
kunalspathak 45c4138
Get cacheLevel for windows
kunalspathak 8b6862c
Get cacheLevel for os
kunalspathak 363490c
add the macro CHECK_CACHE_SIZE
kunalspathak 29ed6db
fix multiplier
kunalspathak 468dc4a
Review comments
kunalspathak b09e495
Fix linux arm64 build
kunalspathak c7c905a
Change from std:string to char[]
kunalspathak 0bf5ec1
minor nit
kunalspathak 1f7ce1c
opps should be outside the loop
kunalspathak cc72139
Replace assert with _ASSERTE
kunalspathak 5671866
CHECK_CACHE_SIZE -> UPDATE_CACHE_SIZE_AND_LEVEL
kunalspathak aaab0bf
Use GetTotalProcessorCount for windows
kunalspathak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
CHECK_CACHE_SIZE -> UPDATE_CACHE_SIZE_AND_LEVEL
- Loading branch information
commit 5671866ea2e8253cb6ce63c5d6717b4049f426c0
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -876,7 +876,7 @@ bool ReadMemoryValueFromFile(const char* filename, uint64_t* val) | |
| return result; | ||
| } | ||
|
|
||
| #define CHECK_CACHE_SIZE(CACHE_LEVEL) if (size > cacheSize) { cacheSize = size; cacheLevel = CACHE_LEVEL; } | ||
| #define UPDATE_CACHE_SIZE_AND_LEVEL(CACHE_LEVEL) if (size > cacheSize) { cacheSize = size; cacheLevel = CACHE_LEVEL; } | ||
|
|
||
| static size_t GetLogicalProcessorCacheSizeFromOS() | ||
| { | ||
|
|
@@ -886,19 +886,19 @@ static size_t GetLogicalProcessorCacheSizeFromOS() | |
|
|
||
| #ifdef _SC_LEVEL1_DCACHE_SIZE | ||
| size = ( size_t) sysconf(_SC_LEVEL1_DCACHE_SIZE); | ||
|
||
| CHECK_CACHE_SIZE(1) | ||
| UPDATE_CACHE_SIZE_AND_LEVEL(1) | ||
| #endif | ||
| #ifdef _SC_LEVEL2_CACHE_SIZE | ||
| size = ( size_t) sysconf(_SC_LEVEL2_CACHE_SIZE); | ||
| CHECK_CACHE_SIZE(2) | ||
| UPDATE_CACHE_SIZE_AND_LEVEL(2) | ||
| #endif | ||
| #ifdef _SC_LEVEL3_CACHE_SIZE | ||
| size = ( size_t) sysconf(_SC_LEVEL3_CACHE_SIZE); | ||
| CHECK_CACHE_SIZE(3) | ||
| UPDATE_CACHE_SIZE_AND_LEVEL(3) | ||
| #endif | ||
| #ifdef _SC_LEVEL4_CACHE_SIZE | ||
| size = ( size_t) sysconf(_SC_LEVEL4_CACHE_SIZE); | ||
| CHECK_CACHE_SIZE(4) | ||
| UPDATE_CACHE_SIZE_AND_LEVEL(4) | ||
| #endif | ||
|
|
||
| #if defined(TARGET_LINUX) && !defined(HOST_ARM) && !defined(HOST_X86) | ||
|
|
@@ -926,7 +926,7 @@ static size_t GetLogicalProcessorCacheSizeFromOS() | |
|
|
||
| if (ReadMemoryValueFromFile(path_to_level_file, &level)) | ||
| { | ||
| CHECK_CACHE_SIZE(level) | ||
| UPDATE_CACHE_SIZE_AND_LEVEL(level) | ||
| } | ||
| else | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
sizea 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.
#71209