Skip to content
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

[compiler-rt][ctx_instr] Add ctx_profile component #89304

Merged
merged 4 commits into from
Apr 22, 2024
Merged

Conversation

mtrofin
Copy link
Member

@mtrofin mtrofin commented Apr 18, 2024

Add the component structure for contextual instrumented PGO and the bump allocator + test.

(Tracking Issue: #89287, RFC referenced there)

Add the component structure for contextual instrumented PGO and the bump allocator + test.

(Tracking Issue: llvm#89287)
Copy link

github-actions bot commented Apr 18, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@vitalybuka
Copy link
Collaborator

-  static void freeArenaList(Arena*& A);
+  static void freeArenaList(Arena *&A);
 
   uint64_t size() const { return Size; }
 
@@ -51,5 +51,5 @@ private:
   const uint64_t Size;
 };
 
-}
+} // namespace __ctx_profile
 #endif // CTX_PROFILE_CTXINSTRPROFILING_H_
diff --git a/compiler-rt/lib/ctx_profile/tests/CtxInstrProfilingTest.cpp b/compiler-rt/lib/ctx_profile/tests/CtxInstrProfilingTest.cpp
index 1e7ddfadd8..44f[37](https://github.com/llvm/llvm-project/actions/runs/8744371029/job/23997070812?pr=89304#step:10:38)d2576 100644
--- a/compiler-rt/lib/ctx_profile/tests/CtxInstrProfilingTest.cpp
+++ b/compiler-rt/lib/ctx_profile/tests/CtxInstrProfilingTest.cpp
@@ -4,11 +4,11 @@
 using namespace __ctx_profile;
 
 TEST(ArenaTest, Basic) {
-  Arena * A = Arena::allocateNewArena(1024);
+  Arena *A = Arena::allocateNewArena(1024);
   EXPECT_EQ(A->size(), 1024U);
   EXPECT_EQ(A->next(), nullptr);
 
-  auto *M1 = A->tryBumpAllocate(1020); 
+  auto *M1 = A->tryBumpAllocate(1020);
   EXPECT_NE(M1, nullptr);
   auto *M2 = A->tryBumpAllocate(4);
   EXPECT_NE(M2, nullptr);

error: some formatters failed: clang-format

@mtrofin
Copy link
Member Author

mtrofin commented Apr 19, 2024

-  static void freeArenaList(Arena*& A);
+  static void freeArenaList(Arena *&A);
 
   uint64_t size() const { return Size; }
 
@@ -51,5 +51,5 @@ private:
   const uint64_t Size;
 };
 
-}
+} // namespace __ctx_profile
 #endif // CTX_PROFILE_CTXINSTRPROFILING_H_
diff --git a/compiler-rt/lib/ctx_profile/tests/CtxInstrProfilingTest.cpp b/compiler-rt/lib/ctx_profile/tests/CtxInstrProfilingTest.cpp
index 1e7ddfadd8..44f[37](https://github.com/llvm/llvm-project/actions/runs/8744371029/job/23997070812?pr=89304#step:10:38)d2576 100644
--- a/compiler-rt/lib/ctx_profile/tests/CtxInstrProfilingTest.cpp
+++ b/compiler-rt/lib/ctx_profile/tests/CtxInstrProfilingTest.cpp
@@ -4,11 +4,11 @@
 using namespace __ctx_profile;
 
 TEST(ArenaTest, Basic) {
-  Arena * A = Arena::allocateNewArena(1024);
+  Arena *A = Arena::allocateNewArena(1024);
   EXPECT_EQ(A->size(), 1024U);
   EXPECT_EQ(A->next(), nullptr);
 
-  auto *M1 = A->tryBumpAllocate(1020); 
+  auto *M1 = A->tryBumpAllocate(1020);
   EXPECT_NE(M1, nullptr);
   auto *M2 = A->tryBumpAllocate(4);
   EXPECT_NE(M2, nullptr);

error: some formatters failed: clang-format

Ugh, forgot that - fixed. Thanks!

@@ -0,0 +1,38 @@
//===- CtxInstrProfiling.cpp - contextual instrumented PGO000000 ----------===//
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PGO000000?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 and - are so close together :) thanks for noticing.

@mtrofin mtrofin merged commit 6ad22c8 into llvm:main Apr 22, 2024
4 checks passed
@mtrofin mtrofin deleted the arena branch April 22, 2024 16:24
mtrofin added a commit that referenced this pull request Apr 22, 2024
mtrofin added a commit that referenced this pull request Apr 22, 2024
@arichardson
Copy link
Member

It looks like the tests are using the wrong compiler, probably needs something similar to #88074

@mtrofin
Copy link
Member Author

mtrofin commented Apr 23, 2024

It looks like the tests are using the wrong compiler, probably needs something similar to #88074

Yup, fixed that in a3e7a12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants