This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] Replace PTX's ManagedStringPool with StringSaver
ClosedPublic

Authored by ldrumm on Dec 27 2022, 10:58 AM.

Details

Summary

In use ManagedStringPool caused a lot of heap allocations. At least one
for every register name lookup in NVPTXTargetRegisterInfo and one for
every symbol lookup in the target machine and isel lowering. There
already exists an llvm/Support string interning-class that has better
memory performance. Use LLVM's and delete ManagedStringPool which was
unique to PTX

llc Binary Size (.text only; bss and data were unchanged):

MinsizeRel:
  Before: 31219796
  After: 31219884
Release:
  Before: 42961872
  After: 42960656

Total heap allocations by the NVPTX string saving code running
check-llvm-codegen-nvptx

Total bytes allocated:

Before: 2431825
After: 2288151

(All numbers on x86-64-linux-gnu / gcc-12 / lld14)

I didn't see obvious time differences when running the tests.

Diff Detail

Event Timeline

ldrumm created this revision.Dec 27 2022, 10:58 AM
ldrumm requested review of this revision.Dec 27 2022, 10:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 27 2022, 10:58 AM
This revision is now accepted and ready to land.Dec 28 2022, 11:04 AM
tra accepted this revision.Jan 3 2023, 4:03 PM
This revision was landed with ongoing or failed builds.Jan 4 2023, 3:28 AM
This revision was automatically updated to reflect the committed changes.