15#define MIBEntryDef(NameTag, Name, Type) List.push_back(Meta::Name);
22 return {Meta::AllocCount, Meta::TotalSize, Meta::TotalLifetime,
23 Meta::TotalLifetimeAccessDensity};
65 Result +=
N.serializedSize(Schema,
Version0);
69 for (
const auto &Frames :
Record.CallSites) {
72 Result += Frames.size() *
sizeof(
FrameId);
82 Result +=
N.serializedSize(Schema,
Version2);
105 using namespace support;
112 for (
const FrameId &Id :
N.CallStack)
114 N.Info.serialize(Schema,
OS);
119 for (
const auto &Frames :
Record.CallSites) {
121 for (
const FrameId &Id : Frames)
128 using namespace support;
135 N.Info.serialize(Schema,
OS);
140 for (
const auto &CSId :
Record.CallSiteIds)
159 const unsigned char *
Ptr) {
160 using namespace support;
166 endian::readNext<uint64_t, llvm::endianness::little>(
Ptr);
170 endian::readNext<uint64_t, llvm::endianness::little>(
Ptr);
171 for (
uint64_t J = 0; J < NumFrames; J++) {
173 endian::readNext<FrameId, llvm::endianness::little>(
Ptr);
174 Node.CallStack.push_back(Id);
177 Node.Info.deserialize(Schema,
Ptr);
184 endian::readNext<uint64_t, llvm::endianness::little>(
Ptr);
185 for (
uint64_t J = 0; J < NumCtxs; J++) {
187 endian::readNext<uint64_t, llvm::endianness::little>(
Ptr);
190 for (
uint64_t K = 0; K < NumFrames; K++) {
192 endian::readNext<FrameId, llvm::endianness::little>(
Ptr);
195 Record.CallSites.push_back(Frames);
203 const unsigned char *
Ptr) {
204 using namespace support;
210 endian::readNext<uint64_t, llvm::endianness::little>(
Ptr);
213 Node.CSId = endian::readNext<CallStackId, llvm::endianness::little>(
Ptr);
214 Node.Info.deserialize(Schema,
Ptr);
221 endian::readNext<uint64_t, llvm::endianness::little>(
Ptr);
222 for (
uint64_t J = 0; J < NumCtxs; J++) {
224 endian::readNext<CallStackId, llvm::endianness::little>(
Ptr);
225 Record.CallSiteIds.push_back(CSId);
233 const unsigned char *
Ptr,
252 AI.
Info = IndexedAI.Info;
254 Record.AllocSites.push_back(AI);
258 Record.CallSites.push_back(Callback(CSId));
280 using namespace support;
282 const unsigned char *
Ptr = Buffer;
284 endian::readNext<uint64_t, llvm::endianness::little>(
Ptr);
287 "memprof schema invalid");
291 for (
size_t I = 0;
I < NumSchemaIds;
I++) {
293 endian::readNext<uint64_t, llvm::endianness::little>(
Ptr);
296 "memprof schema invalid");
298 Result.push_back(
static_cast<Meta>(
Tag));
312 std::memcpy(&CSId, Hash.data(),
sizeof(Hash));
317 for (
const auto &AS :
Record.AllocSites) {
325 &FunctionProfileData) {
326 for (
const auto &[GUID,
Record] : FunctionProfileData) {
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Tagged union holding either a T or a Error.
GUID getGUID() const
Return a 64-bit global unique ID constructed from global value name (i.e.
HashResultTy< HasherT_ > final()
Forward to HasherT::final() if available.
Interface to help hash various types through a hasher type.
std::enable_if_t< hashbuilder_detail::IsHashableData< T >::value, HashBuilder & > add(T Value)
Implement hashing for hashable data types, e.g. integral or enum values.
This class implements a map that also provides access to all stored values in a deterministic order.
void reserve(size_type N)
void push_back(const T &Elt)
StringRef - Represent a constant reference to a string, i.e.
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
static StringRef getCanonicalFnName(const Function &F)
Return the canonical name for a function, taking into account suffix elision policy attributes.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void verifyIndexedMemProfRecord(const IndexedMemProfRecord &Record)
MemProfSchema getHotColdSchema()
CallStackId hashCallStack(ArrayRef< FrameId > CS)
static size_t serializedSizeV2(const IndexedAllocationInfo &IAI, const MemProfSchema &Schema)
static size_t serializedSizeV0(const IndexedAllocationInfo &IAI, const MemProfSchema &Schema)
static void serializeV0(const IndexedMemProfRecord &Record, const MemProfSchema &Schema, raw_ostream &OS)
static IndexedMemProfRecord deserializeV0(const MemProfSchema &Schema, const unsigned char *Ptr)
MemProfSchema getFullSchema()
Expected< MemProfSchema > readMemProfSchema(const unsigned char *&Buffer)
void verifyFunctionProfileData(const llvm::MapVector< GlobalValue::GUID, IndexedMemProfRecord > &FunctionProfileData)
static void serializeV2(const IndexedMemProfRecord &Record, const MemProfSchema &Schema, raw_ostream &OS)
static IndexedMemProfRecord deserializeV2(const MemProfSchema &Schema, const unsigned char *Ptr)
This is an optimization pass for GlobalISel generic memory operations.
std::array< uint8_t, NumBytes > BLAKE3Result
The constant LLVM_BLAKE3_OUT_LEN provides the default output length, 32 bytes, which is recommended f...
PortableMemInfoBlock Info
llvm::SmallVector< Frame > CallStack
size_t serializedSize(const MemProfSchema &Schema, IndexedVersion Version) const
llvm::SmallVector< FrameId > CallStack
llvm::SmallVector< CallStackId > CallSiteIds
llvm::SmallVector< IndexedAllocationInfo > AllocSites
size_t serializedSize(const MemProfSchema &Schema, IndexedVersion Version) const
static IndexedMemProfRecord deserialize(const MemProfSchema &Schema, const unsigned char *Buffer, IndexedVersion Version)
void serialize(const MemProfSchema &Schema, raw_ostream &OS, IndexedVersion Version)
static GlobalValue::GUID getGUID(const StringRef FunctionName)
MemProfRecord toMemProfRecord(llvm::function_ref< const llvm::SmallVector< Frame >(const CallStackId)> Callback) const
static size_t serializedSize(const MemProfSchema &Schema)
Adapter to write values to a stream in a particular byte order.