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: for Clang, the profile size is reduced from 241M to 140MB.

TBD: compress pseudo_probe_desc. Use DFS for probes, and BFS for inline tree.
Measure emission and parsing 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 h,cpp -- 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 1667026a8..99d42c4c9 100644
--- a/bolt/lib/Profile/YAMLProfileWriter.cpp
+++ b/bolt/lib/Profile/YAMLProfileWriter.cpp
@@ -486,7 +486,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
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