-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[MemProf] Optionally save context size info on largest cold allocations #142507
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
teresajohnson
merged 4 commits into
llvm:main
from
teresajohnson:memprof_max_cold_thresh
Jun 3, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a4d1c12
[MemProf] Optionally save context size info on largest cold allocations
teresajohnson 57f2b5a
Address comments
teresajohnson 326527f
Merge branch 'main' into memprof_max_cold_thresh
teresajohnson 98f4b7e
Update MemoryProfileInfo.cpp
teresajohnson 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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
;; Test that we get hinted size reporting for just the subset of MIBs that | ||
;; contain context size info in the metadata. | ||
|
||
;; Generate the bitcode including ThinLTO summary. Specify | ||
;; -memprof-min-percent-max-cold-size (value doesn't matter) to indicate to | ||
;; the bitcode writer that it should expect and optimize for partial context | ||
;; size info. | ||
; RUN: opt -thinlto-bc -memprof-min-percent-max-cold-size=50 %s >%t.o | ||
|
||
; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \ | ||
; RUN: -supports-hot-cold-new \ | ||
; RUN: -r=%t.o,main,plx \ | ||
; RUN: -r=%t.o,_Znam, \ | ||
; RUN: -memprof-report-hinted-sizes \ | ||
; RUN: -o %t.out 2>&1 | FileCheck %s --check-prefix=SIZES | ||
|
||
;; We should only get these two messages from -memprof-report-hinted-sizes | ||
;; as they are the only MIBs with recorded context size info. | ||
; SIZES-NOT: full allocation context | ||
; SIZES: Cold full allocation context 456 with total size 200 is Cold after cloning (context id 2) | ||
; SIZES: Cold full allocation context 789 with total size 300 is Cold after cloning (context id 2) | ||
; SIZES-NOT: full allocation context | ||
|
||
source_filename = "memprof-report-hinted-partial.ll" | ||
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" | ||
target triple = "x86_64-unknown-linux-gnu" | ||
|
||
define i32 @main() #0 { | ||
entry: | ||
%call = call ptr @_Z3foov(), !callsite !0 | ||
%call1 = call ptr @_Z3foov(), !callsite !1 | ||
ret i32 0 | ||
} | ||
|
||
define internal ptr @_Z3barv() #0 { | ||
entry: | ||
%call = call ptr @_Znam(i64 0), !memprof !2, !callsite !7 | ||
ret ptr null | ||
} | ||
|
||
declare ptr @_Znam(i64) | ||
|
||
define internal ptr @_Z3bazv() #0 { | ||
entry: | ||
%call = call ptr @_Z3barv(), !callsite !8 | ||
ret ptr null | ||
} | ||
|
||
define internal ptr @_Z3foov() #0 { | ||
entry: | ||
%call = call ptr @_Z3bazv(), !callsite !9 | ||
ret ptr null | ||
} | ||
|
||
; uselistorder directives | ||
uselistorder ptr @_Z3foov, { 1, 0 } | ||
|
||
attributes #0 = { noinline optnone } | ||
|
||
!0 = !{i64 8632435727821051414} | ||
!1 = !{i64 -3421689549917153178} | ||
!2 = !{!3, !5, !13} | ||
!3 = !{!4, !"notcold"} | ||
!4 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 8632435727821051414} | ||
!5 = !{!6, !"cold", !11, !12} | ||
!6 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 -3421689549917153178} | ||
!7 = !{i64 9086428284934609951} | ||
!8 = !{i64 -5964873800580613432} | ||
!9 = !{i64 2732490490862098848} | ||
!11 = !{i64 456, i64 200} | ||
!12 = !{i64 789, i64 300} | ||
!13 = !{!14, !"cold"} | ||
!14 = !{i64 9086428284934609951, i64 12345} |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.