This is an archive of the discontinued LLVM Phabricator instance.

[CSSPGO] Adjust SampleContextFrameVector to be a shorter SmallVector
ClosedPublic

Authored by hoy on Jan 25 2022, 4:13 PM.

Details

Summary

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
  1. 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

Diff Detail

Event Timeline

hoy created this revision.Jan 25 2022, 4:13 PM
hoy requested review of this revision.Jan 25 2022, 4:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 25 2022, 4:13 PM
hoy edited the summary of this revision. (Show Details)Jan 25 2022, 4:37 PM
hoy added reviewers: wenlei, wlei.
hoy edited the summary of this revision. (Show Details)Jan 25 2022, 4:39 PM

Does this lengthen process time?

hoy added a comment.Jan 25 2022, 5:06 PM

Does this lengthen process time?

Not necessarily if reallocaton happens frequently.

Before:

note: After computeSizeForProfiledFunctions
note: Tue Jan 25 10:38:10 2022
note: VM: 106.28 GB   RSS: 91.25 GB
note: After generateProbeBasedProfile
note: Tue Jan 25 11:06:02 2022
note: VM: 245.19 GB   RSS: 224.30 GB

After:

note: After computeSizeForProfiledFunctions
note: Tue Jan 25 15:31:13 2022
note: VM: 105.95 GB   RSS: 91.04 GB
note: After generateProbeBasedProfile
note: Tue Jan 25 15:58:03 2022
note: VM: 234.29 GB   RSS: 215.39 GB
wenlei accepted this revision.Jan 25 2022, 5:09 PM

Does this lengthen process time?

Not necessarily if reallocaton happens frequently.

Before:

note: After computeSizeForProfiledFunctions
note: Tue Jan 25 10:38:10 2022
note: VM: 106.28 GB   RSS: 91.25 GB
note: After generateProbeBasedProfile
note: Tue Jan 25 11:06:02 2022
note: VM: 245.19 GB   RSS: 224.30 GB

After:

note: After computeSizeForProfiledFunctions
note: Tue Jan 25 15:31:13 2022
note: VM: 105.95 GB   RSS: 91.04 GB
note: After generateProbeBasedProfile
note: Tue Jan 25 15:58:03 2022
note: VM: 234.29 GB   RSS: 215.39 GB

Thanks for checking. Nice improvements!

This revision is now accepted and ready to land.Jan 25 2022, 5:09 PM
This revision was landed with ongoing or failed builds.Jan 25 2022, 9:37 PM
This revision was automatically updated to reflect the committed changes.