Skip to content

[ctxprof][nfc] Drop Section in writeFlatSection #130654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

mtrofin
Copy link
Member

@mtrofin mtrofin commented Mar 10, 2025

It matches writeContextual, and also, it's not the whole section that's being written there, just a profile, piecemeal.

Copy link
Member Author

mtrofin commented Mar 10, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@mtrofin mtrofin marked this pull request as ready for review March 10, 2025 19:03
@llvmbot llvmbot added the PGO Profile Guided Optimizations label Mar 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 10, 2025

@llvm/pr-subscribers-pgo

Author: Mircea Trofin (mtrofin)

Changes

It matches writeContextual, and also, it's not the whole section that's being written there, just a profile, piecemeal.


Full diff: https://github.com/llvm/llvm-project/pull/130654.diff

2 Files Affected:

  • (modified) llvm/include/llvm/ProfileData/PGOCtxProfWriter.h (+2-2)
  • (modified) llvm/lib/ProfileData/PGOCtxProfWriter.cpp (+3-4)
diff --git a/llvm/include/llvm/ProfileData/PGOCtxProfWriter.h b/llvm/include/llvm/ProfileData/PGOCtxProfWriter.h
index 82cf787153cd9..40f355f99eb53 100644
--- a/llvm/include/llvm/ProfileData/PGOCtxProfWriter.h
+++ b/llvm/include/llvm/ProfileData/PGOCtxProfWriter.h
@@ -88,8 +88,8 @@ class PGOCtxProfileWriter final : public ctx_profile::ProfileWriter {
   void endContextSection() override;
 
   void startFlatSection();
-  void writeFlatSection(ctx_profile::GUID Guid, const uint64_t *Buffer,
-                        size_t BufferSize);
+  void writeFlat(ctx_profile::GUID Guid, const uint64_t *Buffer,
+                 size_t BufferSize);
   void endFlatSection();
 
   // constants used in writing which a reader may find useful.
diff --git a/llvm/lib/ProfileData/PGOCtxProfWriter.cpp b/llvm/lib/ProfileData/PGOCtxProfWriter.cpp
index d099572fc152a..e906836b16b2b 100644
--- a/llvm/lib/ProfileData/PGOCtxProfWriter.cpp
+++ b/llvm/lib/ProfileData/PGOCtxProfWriter.cpp
@@ -126,9 +126,8 @@ void PGOCtxProfileWriter::writeContextual(const ContextNode &RootNode) {
   writeImpl(std::nullopt, RootNode);
 }
 
-void PGOCtxProfileWriter::writeFlatSection(ctx_profile::GUID Guid,
-                                           const uint64_t *Buffer,
-                                           size_t Size) {
+void PGOCtxProfileWriter::writeFlat(ctx_profile::GUID Guid,
+                                    const uint64_t *Buffer, size_t Size) {
   Writer.EnterSubblock(PGOCtxProfileBlockIDs::FlatProfileBlockID, CodeLen);
   writeGuid(Guid);
   writeCounters({Buffer, Size});
@@ -240,7 +239,7 @@ Error llvm::createCtxProfFromYAML(StringRef Profile, raw_ostream &Out) {
   if (!SPR.FlatProfiles.empty()) {
     Writer.startFlatSection();
     for (const auto &[Guid, Counters] : SPR.FlatProfiles)
-      Writer.writeFlatSection(Guid, Counters.data(), Counters.size());
+      Writer.writeFlat(Guid, Counters.data(), Counters.size());
     Writer.endFlatSection();
   }
   if (EC)

Copy link
Member Author

mtrofin commented Mar 10, 2025

Merge activity

  • Mar 10, 3:48 PM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Mar 10, 3:50 PM EDT: A user merged this pull request with Graphite.

@mtrofin mtrofin merged commit 0a1f7f0 into main Mar 10, 2025
10 of 14 checks passed
@mtrofin mtrofin deleted the users/mtrofin/03-10-_ctxprof_nfc_drop_section_in_writeflatsection_ branch March 10, 2025 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants