Skip to content

Conversation

@aaupov
Copy link
Contributor

@aaupov aaupov commented Nov 6, 2025

Introduce an optional value compact for profile-write-pseudo-probes flag,
enabling compressed encoding of pseudo probe information in YAML profile:

  • block probes are encoded into space-separated list of probes grouped by
    inline tree nodes in format [probes]_[nodes]:
    • probes and nodes are comma-separated indices,
    • contiguous spans [from,...,to] are coalesced into from^run_length,
    • probes, nodes, and run lengths are base36-encoded,
    • omissions: head probe (index = 1), root node (node = 0).
  • inline tree is encoded into space-separated list of node descriptions
    using base36-encoding.
  • the character set is selected to avoid quoting.

This significantly reduces the size of YAML profile and makes parsing faster
(as it replaces nested FlowVectors with strings).

Test Plan:

TBD: compress pseudo_probe_desc. Use DFS for probes, and BFS for inline tree.
Measure emission time.

Created using spr 1.3.4
@github-actions
Copy link

github-actions bot commented Nov 6, 2025

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff origin/main HEAD --extensions cpp,h -- bolt/include/bolt/Profile/ProfileYAMLMapping.h bolt/include/bolt/Profile/YAMLProfileWriter.h bolt/include/bolt/Utils/CommandLineOpts.h bolt/lib/Profile/DataAggregator.cpp bolt/lib/Profile/YAMLProfileReader.cpp bolt/lib/Profile/YAMLProfileWriter.cpp bolt/lib/Rewrite/PseudoProbeRewriter.cpp --diff_from_common_commit

⚠️
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing origin/main to the base branch/commit you want to compare against.
⚠️

View the diff from clang-format here.
diff --git a/bolt/lib/Profile/YAMLProfileWriter.cpp b/bolt/lib/Profile/YAMLProfileWriter.cpp
index aad433a8b..817590cb9 100644
--- a/bolt/lib/Profile/YAMLProfileWriter.cpp
+++ b/bolt/lib/Profile/YAMLProfileWriter.cpp
@@ -485,7 +485,7 @@ std::error_code YAMLProfileWriter::writeProfile(const RewriteInstance &RI) {
   // Add probe inline tree nodes.
   InlineTreeDesc InlineTree;
   if (const MCPseudoProbeDecoder *Decoder =
-      opts::ProfileWritePseudoProbes ? BC.getPseudoProbeDecoder() : nullptr)
+          opts::ProfileWritePseudoProbes ? BC.getPseudoProbeDecoder() : nullptr)
     std::tie(BP.PseudoProbeDesc, InlineTree) = convertPseudoProbeDesc(*Decoder);
 
   // Add all function objects.

aaupov added a commit that referenced this pull request Nov 6, 2025
Pseudo probe matching (#100446) needs callee information for call
probes.
Embed call probe information (probe id, inline tree node, indirect flag)
into CallSiteInfo. As a consequence:
- Remove call probes from PseudoProbeInfo to avoid duplication, making 
  it only contain block probes.
- Probe grouping across inline tree nodes becomes more potent + allows
  to unambiguously elide block id 1 (common case).

Block mask (blx) encoding becomes a low-ROI optimization and will be
replaced by a more compact encoding leveraging simplified
PseudoProbeInfo in #166680.

The size increase is ~3% for an XL profile (461->475MB). Compact block
probe encoding shrinks it by ~6%.

Test Plan: updated pseudoprobe-decoding-{inline,noinline}.test
aaupov added a commit that referenced this pull request Nov 11, 2025
Pseudo probe matching (#100446) needs callee information for call probes.
Embed call probe information (probe id, inline tree node, indirect flag)
into CallSiteInfo. As a consequence:
- Remove call probes from PseudoProbeInfo to avoid duplication, making
  it only contain block probes.
- Probe grouping across inline tree nodes becomes more potent + allows
  to unambiguously elide block id 1 (common case).

Block mask (blx) encoding becomes a low-ROI optimization and will be
replaced by a more compact encoding leveraging simplified PseudoProbeInfo
in #166680.

The size increase is ~3% for an XL profile (461->475MB). Compact block
probe encoding shrinks it by ~6%.

Test Plan: updated pseudoprobe-decoding-{inline,noinline}.test

Reviewers: paschalis-mpeis, ayermolo, yota9, yozhu, rafaelauler, maksfb

Reviewed By: rafaelauler

Pull Request: #165490
Created using spr 1.3.4
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

🐧 Linux x64 Test Results

The build failed before running any tests. Click on a failure below to see the details.

tools/bolt/lib/Profile/CMakeFiles/LLVMBOLTProfile.dir/YAMLProfileReader.cpp.o
FAILED: tools/bolt/lib/Profile/CMakeFiles/LLVMBOLTProfile.dir/YAMLProfileReader.cpp.o
sccache /opt/llvm/bin/clang++ -DCMAKE_INSTALL_FULL_LIBDIR=\"/home/gha/actions-runner/_work/llvm-project/llvm-project/build/install/lib\" -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/bolt/lib/Profile -I/home/gha/actions-runner/_work/llvm-project/llvm-project/bolt/lib/Profile -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/bolt/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/bolt/include -gmlt -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/bolt/lib/Profile/CMakeFiles/LLVMBOLTProfile.dir/YAMLProfileReader.cpp.o -MF tools/bolt/lib/Profile/CMakeFiles/LLVMBOLTProfile.dir/YAMLProfileReader.cpp.o.d -o tools/bolt/lib/Profile/CMakeFiles/LLVMBOLTProfile.dir/YAMLProfileReader.cpp.o -c /home/gha/actions-runner/_work/llvm-project/llvm-project/bolt/lib/Profile/YAMLProfileReader.cpp
/home/gha/actions-runner/_work/llvm-project/llvm-project/bolt/lib/Profile/YAMLProfileReader.cpp:385:39: error: no member named 'ParentIndex' in 'llvm::yaml::bolt::InlineTreeNode'
385 |       Fields[1].getAsInteger(36, Node.ParentIndex);
|                                  ~~~~ ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/bolt/lib/Profile/YAMLProfileReader.cpp:397:24: error: use of undeclared identifier 'YamlPD'
397 |     uint32_t HashIdx = YamlPD.GUIDHashIdx[GUIDIdx];
|                        ^~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/bolt/lib/Profile/YAMLProfileReader.cpp:399:27: error: use of undeclared identifier 'YamlPD'
399 |     InlineTreeNode.GUID = YamlPD.GUID[GUIDIdx];
|                           ^~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/bolt/lib/Profile/YAMLProfileReader.cpp:400:27: error: use of undeclared identifier 'YamlPD'
400 |     InlineTreeNode.Hash = YamlPD.Hash[HashIdx];
|                           ^~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/bolt/lib/Profile/YAMLProfileReader.cpp:994:18: error: explicit template parameter list for lambdas is a C++20 extension [-Werror,-Wc++20-extensions]
994 |   auto CmpAt = []<auto N>(const auto &LHS, const auto &RHS) {
|                  ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/bolt/lib/Profile/YAMLProfileReader.cpp:1016:14: error: placeholder variables are a C++2c extension [-Werror,-Wc++26-extensions]
1016 |     auto [_, _, _, YamlBF] = *PRange.first;
|              ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/bolt/lib/Profile/YAMLProfileReader.cpp:1016:17: error: placeholder variables are a C++2c extension [-Werror,-Wc++26-extensions]
1016 |     auto [_, _, _, YamlBF] = *PRange.first;
|                 ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/bolt/lib/Profile/YAMLProfileReader.cpp:1016:10: error: unused variable '[_, _, _, YamlBF]' [-Werror,-Wunused-variable]
1016 |     auto [_, _, _, YamlBF] = *PRange.first;
|          ^
8 errors generated.

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants