[llvm] [memprof] Add Version2 of the indexed MemProf format (PR #89100)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 17 15:14:39 PDT 2024
================
@@ -1296,20 +1308,30 @@ Error IndexedInstrProfReader::readHeader() {
MemProfRecordTable.reset(MemProfRecordHashTable::Create(
/*Buckets=*/Start + RecordTableOffset,
/*Payload=*/Ptr,
- /*Base=*/Start, memprof::RecordLookupTrait(memprof::Version1, Schema)));
+ /*Base=*/Start, memprof::RecordLookupTrait(Version, Schema)));
// Initialize the frame table reader with the payload and bucket offsets.
MemProfFrameTable.reset(MemProfFrameHashTable::Create(
/*Buckets=*/Start + FrameTableOffset,
/*Payload=*/Start + FramePayloadOffset,
/*Base=*/Start, memprof::FrameLookupTrait()));
+ if (Version >= memprof::Version2)
+ MemProfCallStackTable.reset(MemProfCallStackHashTable::Create(
+ /*Buckets=*/Start + CallStackTableOffset,
+ /*Payload=*/Start + CallStackPayloadOffset,
+ /*Base=*/Start, memprof::CallStackLookupTrait()));
+
#ifdef EXPENSIVE_CHECKS
// Go through all the records and verify that CSId has been correctly
// populated. Do this only under EXPENSIVE_CHECKS. Otherwise, we
// would defeat the purpose of OnDiskIterableChainedHashTable.
- for (const auto &Record : MemProfRecordTable->data())
- verifyIndexedMemProfRecord(Record);
+ // Note that we can compare CSId against actual call stacks only for
----------------
kazutakahirata wrote:
No. We cannot populate `IndexedAllocationInfo::CallStack` or `IndexedMemProfRecord::CallSites` because they live in the on-disk hash table.
https://github.com/llvm/llvm-project/pull/89100
More information about the llvm-commits
mailing list