[llvm] cc4beda - [CSSPGO] Adjust SampleContextFrameVector to be a shorter SmallVector
Hongtao Yu via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 25 21:36:49 PST 2022
Author: Hongtao Yu
Date: 2022-01-25T21:36:38-08:00
New Revision: cc4beda039ba5441b76b5b112dd5f69553965186
URL: https://github.com/llvm/llvm-project/commit/cc4beda039ba5441b76b5b112dd5f69553965186
DIFF: https://github.com/llvm/llvm-project/commit/cc4beda039ba5441b76b5b112dd5f69553965186.diff
LOG: [CSSPGO] Adjust SampleContextFrameVector to be a shorter SmallVector
It appears that some memory saving can be archived by tweaking the existing `SampleContextFrameVector` setup. Below are memory usage for two benchmarks before and after this change.
1. Medium benchmark:
- Before:
```
note: After computeSizeForProfiledFunctions
note: VM: 12.50 GB RSS: 11.02 GB
note: After generateProbeBasedProfile
note: **VM: 30.56 GB RSS: 29.08 GB**
note: After postProcessProfiles
note: VM: 31.91 GB RSS: 30.43 GB
```
- After:
```
note: After computeSizeForProfiledFunctions
note: VM: 12.26 GB RSS: 10.80 GB
note: After generateProbeBasedProfile
note: **VM: 28.76 GB RSS: 27.29 GB**
note: After postProcessProfiles
note: VM: 30.12 GB RSS: 28.66 GB
```
2. Large benchmark:
- Before:
```
note: After computeSizeForProfiledFunctions
note: VM: 106.28 GB RSS: 91.25 GB
note: After generateProbeBasedProfile
note: **VM: 245.19 GB RSS: 224.30 GB**
note: After postProcessProfiles
note: VM: 254.96 GB RSS: 221.58 GB
```
- After:
```
note: After computeSizeForProfiledFunctions
note: VM: 105.95 GB RSS: 91.04 GB
note: After generateProbeBasedProfile
note: VM: **234.29 GB RSS: 215.39 GB**
note: After postProcessProfiles
note: VM: 244.03 GB RSS: 213.45 GB
```
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D118203
Added:
Modified:
llvm/include/llvm/ProfileData/SampleProf.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index 6be54d8d78b2f..bad2139fe8f0e 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -450,7 +450,7 @@ static inline hash_code hash_value(const SampleContextFrame &arg) {
arg.Location.Discriminator);
}
-using SampleContextFrameVector = SmallVector<SampleContextFrame, 10>;
+using SampleContextFrameVector = SmallVector<SampleContextFrame, 1>;
using SampleContextFrames = ArrayRef<SampleContextFrame>;
struct SampleContextFrameHash {
More information about the llvm-commits
mailing list