-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[memprof] Make HeapProfileRecords optional #155671
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
[memprof] Make HeapProfileRecords optional #155671
Conversation
memprof::AllMemProfData has become home to multiple types of memprof data -- heap profile and static data profile. When we write test cases for static data profile in YAML, we do not want to include empty heap profile. That would just add visual clutter. This patch makes HeapProfileRecords optional.
|
@llvm/pr-subscribers-pgo Author: Kazu Hirata (kazutakahirata) Changesmemprof::AllMemProfData has become home to multiple types of memprof This patch makes HeapProfileRecords optional. Full diff: https://github.com/llvm/llvm-project/pull/155671.diff 1 Files Affected:
diff --git a/llvm/include/llvm/ProfileData/MemProfYAML.h b/llvm/include/llvm/ProfileData/MemProfYAML.h
index ad5d7c0e22751..87e2f0ea14487 100644
--- a/llvm/include/llvm/ProfileData/MemProfYAML.h
+++ b/llvm/include/llvm/ProfileData/MemProfYAML.h
@@ -263,7 +263,8 @@ template <> struct MappingTraits<memprof::YamlDataAccessProfData> {
template <> struct MappingTraits<memprof::AllMemProfData> {
static void mapping(IO &Io, memprof::AllMemProfData &Data) {
- Io.mapRequired("HeapProfileRecords", Data.HeapProfileRecords);
+ if (!Io.outputting() || !Data.HeapProfileRecords.empty())
+ Io.mapOptional("HeapProfileRecords", Data.HeapProfileRecords);
// Map data access profiles if reading input, or if writing output &&
// the struct is populated.
if (!Io.outputting() || !Data.YamlifiedDataAccessProfiles.isEmpty())
|
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.
Right now this section itself requires both AllocSites and CallSites. Does it make sense to change that too? In practice we need not have both in a profile.
Should there be a test for this change to ensure it does something reasonable for an empty memprof yaml?
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.
thanks for making the change!
It occurred to me when I trim down the test case input, fields like AllocSites and CallSites (and their subfields) are currently required. I wonder if a subset of fields are optional based on the semantics.
Let me take that as a follow-up project.
Yes, and that turns out to be important. We need to relax the emptiness check in |
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
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/169/builds/14456 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/143/builds/10359 Here is the relevant piece of the build log for the reference |
memprof::AllMemProfData has become home to multiple types of memprof
data -- heap profile and static data profile. When we write test
cases for static data profile in YAML, we do not want to include empty
heap profile. That would just add visual clutter.
This patch makes HeapProfileRecords optional.