6 Commits

Author SHA1 Message Date
Mingming Liu
d0acddbdd6
Revert "[StaticDataLayout][PGO]Implement reader and writer change for data access profiles" (#141157)
Reverts llvm/llvm-project#139997

Sanitizer failures
(https://lab.llvm.org/buildbot/#/builders/94/builds/7373)

Will fix forward later.
2025-05-22 16:14:36 -07:00
Mingming Liu
45f6036533
[StaticDataLayout][PGO]Implement reader and writer change for data access profiles (#139997)
https://github.com/llvm/llvm-project/pull/138170 introduces classes to
operate on data access profiles. This change supports the read and write
of `DataAccessProfData` in indexed format of MemProf (v4) as well as its
the text (yaml) format.

For indexed format:
* InstrProfWriter owns (by `std::unique_ptr<DataAccessProfData>`) the
data access profiles, and gives a non-owned copy when it calls
`writeMemProf`.
* MemProf v4 header has a new `uint64_t` to record the byte offset of
data access profiles. This `uint64_t` field is zero if data access
profile is not set (nullptr).
* MemProfReader reads the offset from v4 header and de-serializes
in-memory bytes into class `DataAccessProfData`.

For textual format:
* MemProfYAML.h adds the mapping for DAP class, and make DAP optional
for both read and write.

099a0fa (by @snehasish) introduces v4 which contains CalleeGuids in
CallSiteInfo, and this change changes the v4 format in place with data
access profiles. The current plan is to bump the version and enable v4
profiles with both features, assuming waiting for this change won't
delay the callsite change too long.

---------

Co-authored-by: Kazu Hirata <kazu@google.com>
2025-05-22 12:51:04 -07:00
Snehasish Kumar
a53b306c47
[NFC][MemProf] Move Radix tree methods to their own header and cpp. (#140501)
Part of a larger refactoring with the following goals
1. Reduce the size of MemProf.h 
2. Avoid including ModuleSummaryIndex just for a couple of types
2025-05-19 16:16:09 -07:00
Snehasish Kumar
099a0fa3f2
[MemProf] Add v4 which contains CalleeGuids to CallSiteInfo. (#137394)
This patch adds CalleeGuids to the serialized format and increments the version number to 4. The unit tests are updated to include a new test for v4 and the YAML format is also updated to be able to roundtrip the v4 format.
2025-05-01 20:17:21 -07:00
Kazu Hirata
ea0dbee808
[memprof] Move IndexedMemProfReader::deserialize to IndexedemProfData.cpp (NFC) (#137089)
This patch moves IndexedMemProfReader::deserialize and its subroutines
to IndexedMemProfData.cpp, building on:

  commit 9a8f90dba3f8c25cbb3525a482053d3abcd3fddc
  Author: Kazu Hirata <kazu@google.com>
  Date:   Wed Apr 23 15:39:45 2025 -0700

The intent is as follows:

- Reduce the size of InstrProfReader.cpp.
- Move the subroutines to a separate file because they don't interact
  with anything else in InstrProfReader.cpp.
2025-04-23 19:24:17 -07:00
Kazu Hirata
9a8f90dba3
[memprof] Move writeMemProf to a separate file (#137051)
This patch moves writeMemProf and its subroutines to a separate file.

The intent is as follows:

- Reduce the size of InstrProfWriter.cpp.
- Move the subroutines to a separate file because they don't interact
  with anything else in InstrProfWriter.cpp.

Remarks:

- The new file is named IndexedMemProfData.cpp without "Writer" in the
  name so that we can move the reader code to this file in the future.
- This patch just moves code without changing the function signatures
  for now.  It might make sense to implement a class encompassing
  "serialize" and "deserialize" methods for IndexedMemProfData, but
  that's left to subsequent patches.
2025-04-23 15:39:45 -07:00