Commit graph

147 commits

Author SHA1 Message Date
Amir Ayupov
61480755ee
[BOLT] Support multiple perf data inputs
Allow multiple -p/-perfdata args (comma-separated and repeated).
Process them in parallel with `--perfdata-jobs/-pj` (default 4,
0 for all available hardware threads). Keep YAML/DataReader
inputs single-profile only.

This also enables density computation with multiple perf files.
Prior to that, it was impossible to compute total density as
it wasn't computed from symbolized profiles.

Depends on
#199323
#199322
#199321
#199320

Test Plan:
Updated pre-aggregated-perf.test and perf_test

For a large binary (300MB text) and 7 ETM perf data files
(6GB each), compared to parallel perf2bolt + merge-fdata:
* processing time is equal: 670+3s -> 669s (within noise),
* output is equivalent: sorted fdata is equal.

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

Reviewed By: paschalis-mpeis, rafaelauler

Pull Request: https://github.com/llvm/llvm-project/pull/199324
2026-06-01 08:24:08 -07:00
Amir Ayupov
9923871474
[BOLT][NFC] Split out DataAggregator::parseInput
Test Plan: NFC

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

Reviewed By: yozhu, rafaelauler

Pull Request: https://github.com/llvm/llvm-project/pull/199321
2026-05-27 00:09:19 -07:00
Amir Ayupov
1b19eccf17
[BOLT][NFC] Split out function marking from profile parsing
Move out `setHasProfileAvailable` into `markFunctionsWithProfile`.
This also allows extracting per-pre-aggregated type handling in
`parseAggregatedLBREntry` into a switch statement.

Test Plan:
NFC

Processing time change (wall time):
* 10MB pre-aggregated profile:
  - Parsing aggregated branch events: 0.16s -> 0.05s
  - Pre-process profile data (parsing+marking): 0.18s -> 0.16s

* 6GB perf.data file:
  - Parsing branch events: 29.06s -> 28.55s
  - Pre-process profile data (excluding perf script): 29.47s -> 29.13s

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

Pull Request: https://github.com/llvm/llvm-project/pull/199320
2026-05-26 18:49:12 -07:00
Amir Ayupov
37c59162ab
[BOLT][NFCI] Drop CFG profile attachment in DataAggregator (#195986) 2026-05-13 17:01:48 -07:00
Amir Ayupov
46154fef0e
[BOLT] Support negative hex in pre-aggregated profile (#192391)
Handle signed values in parseHexField by falling back to int64_t parsing
when uint64_t fails. This allows pre-aggregated profile tools to use -1
for BR_ONLY, -2 for FT_EXTERNAL_ORIGIN, -3 for FT_EXTERNAL_RETURN.

Guard the external address reset loop in parseAggregatedLBREntry to
preserve sentinel values (offsets >= FT_EXTERNAL_RETURN).

Add tests for -1/-2/-3 in parseHexField and T entries with -1,
ffffffffffffffff, and buildid:-1 as BR_ONLY.
2026-04-25 23:07:07 +00:00
Amir Ayupov
10353899af
[BOLT] Use identify_magic for shared library detection (#190902)
Replace the fragile filename-based check (ends_with(".so")) with
identify_magic()/file_magic::elf_shared_object to reliably detect
shared libraries when filtering pre-aggregated profile data by
build ID.

Test Plan: pre-aggregated-perf-shlib.test
2026-04-09 15:48:37 -07:00
Amir Ayupov
2fafeb0509 [BOLT] Support buildid in pre-aggregated profile (#186931)
Sample addresses belonging to external DSOs (buildid doesn't match the
current file) are treated as external (0).

Buildid for the main binary is expected to be omitted.

Test Plan:
added pre-aggregated-perf-buildid.test
2026-03-24 15:15:08 -07:00
Amir Ayupov
2e247a1d54 Revert "[BOLT] Support buildid in pre-aggregated profile"
Accidentally pushed unreviewed version.

This reverts commit fce6895804.
2026-03-24 15:13:14 -07:00
Amir Ayupov
fce6895804 [BOLT] Support buildid in pre-aggregated profile
Sample addresses belonging to external DSOs (buildid doesn't match the
current file) are treated as external (0).

Buildid for the main binary is expected to be omitted.

Test Plan: added pre-aggregated-perf-buildid.test

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

Reviewed By: paschalis-mpeis

Pull Request: https://github.com/llvm/llvm-project/pull/186931
2026-03-24 15:05:33 -07:00
Ádám Kallai
733bc3409b
[BOLT][Perf2bolt] Add support to generate pre-parsed perf data (#171144)
Adding a generator into Perf2bolt is the initial step to support the
large end-to-end tests for Arm SPE. This functionality proves unified format of
pre-parsed profile that Perf2bolt is able to consume.

Why does the test need to have a textual format SPE profile?

* To collect an Arm SPE profile by Linux Perf, it needs to have
an arm developer device which has SPE support.
* To decode SPE data, it also needs to have the proper version of
Linux Perf.
* The minimum required version of Linux Perf is v6.15.

Bypassing these technical difficulties, that easier to prove
a pre-generated textual profile format.

The generator relies on the aggregator work to spawn the required
perf-script jobs based on the the aggregation type, and merges the
results of the pref-script jobs into a single file.
This hybrid profile will contain all required events such as BuildID,
MMAP, TASK, BRSTACK, or MEM event for the aggregation.

Two examples below how to generate a pre-parsed perf data as
an input for ARM SPE aggregation:

`perf2bolt -p perf.data BINARY -o perf.text --spe
--generate-perf-script`

Or for basic aggregation:

`perf2bolt -p perf.data BINARY -o perf.text --ba --generate-perf-script`
2026-03-23 12:03:52 +01:00
Ádám Kallai
fd225e296f
[BOLT] Spawn buildid-list perf job at perf2bolt start. NFC (#185865)
Launch this perf job with the others at the beginning of the aggregation
process.

Extracting buildid-list from perf data is not a costly process, so it
can be performed by default. This provides a distinct advantage when
this dataset is required in other perf2bolt stages as well.

Please see PR #171144.
2026-03-12 10:24:09 +01:00
Shanzhi Chen
e4674b85e9
[BOLT][NFC] Stop populating unnecessary samples into MemSamples (#179472)
Currently, many unnecessary samples are populated into MemSamples,
including zero-initialized samples and samples in which the PC address
is not contained in any BinaryFunction. But these samples are totally
skipped during processing and the whole MemSamples vector is cleared
immediately after processing. So, we could just stop populating these
samples into MemSamples, which would reduce maximum resident set size
when processing a large perf.data.
2026-02-08 19:27:55 -08:00
Victor Chernyakin
c438773432
[LLVM][ADT] Migrate users of make_scope_exit to CTAD (#174030)
This is a followup to #173131, which introduced the CTAD functionality.
2026-01-02 20:42:56 -08:00
Amir Ayupov
8c010dea55
[BOLT] Lookup top-level inline tree node in YAMLProfileWriter (#165491)
Top-level (binary) functions don't have a unique GUID mapping, with
different
causes namely coroutine fragments sharing the same parent source
function GUID.

Replace the top-level inline tree node GUID lookup with probe lookup
coupled
with walk up the inline tree.

Test Plan: added test-coro-probes.yaml
2025-12-22 14:47:21 -08:00
Amir Ayupov
4c3e0320a1 [BOLT] Move call probe information to CallSiteInfo
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: https://github.com/llvm/llvm-project/pull/165490
2025-11-11 11:55:36 -08:00
Kazu Hirata
bddab8359e
[BOLT] Remove redundant declarations (NFC) (#166893)
In C++17, static constexpr members are implicitly inline, so they no
longer require an out-of-line definition.

Identified with readability-redundant-declaration.
2025-11-07 07:58:24 -08:00
Amir Ayupov
1d0aa6c2ad
[BOLT] Fix impute-fall-throughs (#166305)
BOLT expects pre-aggregated profile entries to be unique, which holds
for externally aggregated traces (or branches+fall-through ranges).
Therefore, BOLT doesn't merge duplicate entries for faster processing.
However, such traces are not expressly prohibited and could come from
concatenated pre-aggregated profiles or otherwise.

Relax the assumption about no duplicate (branch-only) traces in fall-
through imputing.

Test Plan: updated callcont-fallthru.s
2025-11-04 17:01:25 -08:00
Jakub Kuderski
4c21d0cb14
[ADT] Prepare to deprecate variadic StringSwitch::Cases. NFC. (#166020)
Update all uses of variadic `.Cases` to use the initializer list
overload instead. I plan to mark variadic `.Cases` as deprecated in a
followup PR.

For more context, see https://github.com/llvm/llvm-project/pull/163117.
2025-11-02 00:12:33 +00:00
Kazu Hirata
03d044971e
[ADT] Use a dedicated empty type for StringSet (NFC) (#165967)
This patch introduces StringSetTag, a dedicated empty struct to serve
as the "value type" for llvm::StringSet.  This change is part of an
effort to reduce the use of std::nullopt_t outside the context of
std::optional.
2025-11-01 10:41:47 -07:00
Paschalis Mpeis
ae6cb98b29
[BOLT] Add --ba flag to deprecate --nl (#164257)
The `--nl` flag, originally for Non-LBR mode, is deprecated and will be
replaced by `--basic-events` (alias `--ba`).

`--nl` remains as a deprecated alias for backward compatibility.
2025-10-23 10:13:28 +01:00
Paschalis Mpeis
96688d4b3c
[BOLT][NFC] Use brstack in guides and user outputs (#163950)
Update guides to use brstack, with a mention to BRBE for AArch64. Use
brstack in user-facing outputs.

---------

Co-authored-by: Amir Ayupov <aaupov@fb.com>
2025-10-20 09:30:06 +00:00
Rafael Auler
47f54e4992
Revert "[BOLT][NFC] Register profiled functions once (#150622)" (#152597)
In perf2bolt, we are observing sporadic crashes in the recently added
registerProfiledFunctions from #150622. Addresses provided by the
hardware (from LBR) might be -1, which clashes with what LLVM uses in
DenseSet as empty tombstones records. This causes DenseSet to assert
with "can't insert empty tombstone into map" when ingesting this
data. Revert this change for now to unbreak perf2bolt.
2025-08-07 15:28:22 -07:00
Amir Ayupov
1b657c6d6b
[BOLT][NFC] Register profiled functions once (#150622)
While registering profiled functions, only handle each address once.
Speeds up `DataAggregator::preprocessProfile`.

Test Plan:
For intermediate size pre-aggregated profile (10MB), reduces parsing
time from ~0.41s down to ~0.16s.
2025-07-28 13:29:55 +02:00
Amir Ayupov
a850912de1
[BOLT] Require CFG in BAT mode (#150488)
`getFallthroughsInTrace` requires CFG for functions not covered by BAT,
even in BAT/fdata mode. BAT-covered functions go through special
handling in fdata (`BAT->getFallthroughsInTrace`) and YAML
(`DataAggregator::writeBATYAML`) modes.

Since all modes (BAT/no-BAT, YAML/fdata) now need disassembly/CFG
construction:
- drop special BAT/fdata handling that omitted disassembly/CFG in
  `RewriteInstance::run`, enabling *CFG for all non-BAT functions*,
- switch `getFallthroughsInTrace` to check if a function has CFG,
- which *allows emitting profile for non-simple functions* in all modes.

Previously, traces in non-simple functions were reported as invalid/
mismatching disassembled function contents. This change reduces the
number of such invalid traces and increases the number of profiled
functions. These functions may participate in function reordering via
call graph profile.

Test Plan: updated unclaimed-jt-entries.s
2025-07-25 13:54:37 +02:00
Amir Ayupov
00311cf604
[BOLT] Impute missing trace fall-through (#145258) 2025-07-12 12:25:58 -07:00
Amir Ayupov
46e3ec0244
[BOLT][NFCI] Report perf script time (#147232)
Leverage `sys::ProcessStatistics` to report the run time and memory
usage of perf script processes launched when reading perf data.
The reporting is enabled in debug mode with `-debug-only=aggregator`.

Switch buildid-list command to non-waiting `launchPerfProcess` to get
its runtime as well, unifying it with the rest of perf script processes.

Test Plan: NFC
2025-07-07 06:05:48 -07:00
Amir Ayupov
f6973baf28
[BOLT][NFC] Split out parsePerfData (#145248) 2025-06-24 09:39:51 -07:00
Amir Ayupov
6d8c6ef90c
[BOLT][NFC] Simplify doTrace in BAT mode (#143233)
`BoltAddressTranslation::getFallthroughsInTrace` iterates over address
translation map entries and therefore has direct access to both original
and translated offsets. Return the translated offsets in fall-throughs
list to avoid duplicate address translation inside `doTrace`.

Test Plan: NFC
2025-06-20 12:45:21 -07:00
Amir Ayupov
7085065c02
[BOLT] Support pre-aggregated returns (#143296)
Intel's Architectural LBR supports capturing branch type information
as part of LBR stack (SDM Vol 3B, part 2, October 2024):
```
20.1.3.2 Branch Types
The IA32_LBR_x_INFO.BR_TYPE and IA32_LER_INFO.BR_TYPE fields encode
the branch types as shown in Table 20-3.

Table 20-3. IA32_LBR_x_INFO and IA32_LER_INFO Branch Type Encodings

Encoding | Branch Type
  0000B  | COND
  0001B  | NEAR_IND_JMP
  0010B  | NEAR_REL_JMP
  0011B  | NEAR_IND_CALL
  0100B  | NEAR_REL_CALL
  0101B  | NEAR_RET
  011xB  | Reserved
  1xxxB  | OTHER_BRANCH

For a list of branch operations that fall into the categories above,
see Table 20-2. 

Table 20-2. Branch Type Filtering Details
Branch Type   | Operations Recorded
COND          | Jcc, J*CXZ, and LOOP*
NEAR_IND_JMP  | JMP r/m*
NEAR_REL_JMP  | JMP rel*
NEAR_IND_CALL | CALL r/m*
NEAR_REL_CALL | CALL rel* (excluding CALLs to the next sequential IP)
NEAR_RET      | RET (0C3H)
OTHER_BRANCH  | JMP/CALL ptr*, JMP/CALL m*, RET (0C8H), SYS*, 
interrupts, exceptions (other than debug exceptions), IRET, INT3, 
INTn, INTO, TSX Abort, EENTER, ERESUME, EEXIT, AEX, INIT, SIPI, RSM
```

Linux kernel can preserve branch type when `save_type` is enabled,
even if CPU does not support Architectural LBR:

f09079bd04/tools/perf/Documentation/perf-record.txt (L457-L460)

> - save_type: save branch type during sampling in case binary is not
available later.
For the platforms with Intel Arch LBR support (12th-Gen+ client or
4th-Gen Xeon+ server), the save branch type is unconditionally enabled
when the taken branch stack sampling is enabled.

Kernel-reported branch type values:

8c6bc74c7f/include/uapi/linux/perf_event.h (L251-L269)

This information is needed to disambiguate external returns (from
DSO/JIT) to an entry point or a landing pad, when BOLT can't
disassemble the branch source.

This patch adds new pre-aggregated types:
- return trace (R),
- external return fall-through (r).

For such types, the checks for fall-through start (not an entry or
a landing pad) are relaxed.

Depends on #143295.

Test Plan: updated callcont-fallthru.s
2025-06-20 03:17:08 -07:00
Ádám Kallai
f75973949b
[BOLT][AArch64] Add support for SPE brstack format (#129231)
Since Linux 6.14, Perf gained the ability to report SPE branch events
using the `brstack` format, which matches the layout of LBR/BRBE.

This patch reuses the existing LBR parsing logic to support SPE.

Example SPE brstack format:
```bash
perf script -i perf.data -F pid,brstack --itrace=bl
```
```
  PID       FROM / TO / PREDICTED

16984  0x72e342e5f4/0x72e36192d0/M/-/-/11/RET/-
16984  0x72e7b8b3b4/0x72e7b8b3b8/PN/-/-/11/COND/-
16984  0x72e7b92b48/0x72e7b92b4c/PN/-/-/8/COND/-
16984  0x72eacc6b7c/0x760cc94b00/P/-/-/9/RET/-
16984  0x72e3f210fc/0x72e3f21068/P/-/-/4//-
16984  0x72e39b8c5c/0x72e3627b24/P/-/-/4//-
16984  0x72e7b89d20/0x72e7b92bbc/P/-/-/4/RET/-
```

SPE brstack flags can be two characters long: `PN` or `MN`:
- `P` = predicted branch
- `M` = mispredicted branch
- `N` = optionally appears when the branch is NOT-TAKEN
    - flag is relevant only to  conditional branches


Example of usage with BOLT:

1. Capture SPE branch events:
```bash
perf record -e 'arm_spe_0/branch_filter=1/u' -- binary
```

2. Convert profile for BOLT:
```bash
perf2bolt -p perf.data -o perf.fdata --spe binary
```

3. Run BOLT Optimization:
```bash
llvm-bolt binary -o binary.bolted --data   perf.fdata ...
```

A unit test verifies the parsing of the 'SPE brstack format'.

---------

Co-authored-by: Paschalis Mpeis <paschalis.mpeis@arm.com>
2025-06-20 10:40:35 +01:00
Amir Ayupov
9fed480f18
[BOLT] Explicitly check for returns when extending call continuation profile (#143295)
Call continuation logic relies on assumptions about fall-through origin:
- the branch is external to the function,
- fall-through start is at the beginning of the block,
- the block is not an entry point or a landing pad.

Leverage trace information to explicitly check whether the origin is a
return instruction, and defer to checks above only in case of
DSO-external branch source.

This covers both regular and BAT cases, addressing call continuation
fall-through undercounting in the latter mode, which improves BAT
profile quality metrics. For example, for one large binary:
- CFG discontinuity 21.83% -> 0.00%,
- CFG flow imbalance 10.77%/100.00% -> 3.40%/13.82% (weighted/worst)
- CG flow imbalance 8.49% —> 8.49%.

Depends on #143289.

Test Plan: updated callcont-fallthru.s
2025-06-17 06:28:27 -07:00
Amir Ayupov
7e6c1bd3ed
[BOLT][NFCI] Simplify DataAggregator using traces (#143289)
Consistently apply traces as defined in #127125 for branch profile
aggregation. This combines branches and fall-through records into one.

With large input binaries/profiles, the speed up in aggregation time
(`-time-aggr`, wall time):
- perf.data, pre-BOLT input: 154.5528s -> 144.0767s
- pre-aggregated data, pre-BOLT input: 15.1026s -> 9.0711s
- pre-aggregated data, BOLTed input: 15.4871s -> 10.0077s

Test Plan: NFC
2025-06-16 23:54:40 -07:00
Amir Ayupov
902a991e12
[BOLT] Make memory profile parsing optional (#129585)
Introduce `parse-mem-profile` option to limit overheads processing
tracing data (Intel PT or ARM ETM). By default, it's enabled for
perf data (existing behavior), unless `itrace` is passed to parse
tracing data where it's extremely expensive. In this case, the flag
needs to be set explicitly if needed.
2025-06-12 14:46:37 -07:00
Amir Ayupov
0c77468288
[BOLT] Expose external entry count for functions (#141674)
Record the number of function invocations from external code - code
outside the binary, which may include JIT code and DSOs. Accounting
external entry counts improves the fidelity of call graph flow 
conservation analysis.

Test Plan: updated shrinkwrapping.test
2025-06-10 14:31:22 -07:00
Amir Ayupov
03bbd04bb7
[BOLT][NFCI] Skip validation in parseLBRSample (#143288)
Parsed branches and fall-throughs are validated in `doBranch` and
`doTrace` respectively. Simplify parseLBRSample by omitting the
validation. This also speeds up perf data processing as checks are only
done once for aggregated branches/fall-throughs and not individual LBR
entries.

Since invalid/external addresses are no longer sanitized during parsing,
sanitize them in `doBranch`.

Test Plan: updated X86/pre-aggregated-perf.test
2025-06-08 17:50:02 -07:00
Amir Ayupov
dcd2ac7ef2
[BOLT] Sort EntryData (#143308)
Aggregated branch data has two containers: `Data` for local branches,
and `EntryData` for external branches. Fix the omission and sort
`EntryData` to ensure stable output fdata profiles.

Test Plan: updated pre-aggregated-perf.test
2025-06-08 17:43:44 -07:00
Amir Ayupov
c480dcddd9
[BOLT][NFC] Move LBREntry from DataReader to DataAggregator (#143287)
LBREntry is only used in DataAggregator.

Test Plan: NFC
2025-06-08 17:41:46 -07:00
Amir Ayupov
dc513fa8dc
[BOLT] Zero initialize pre-aggregated counters (#142698)
#140196 introduced UB by using uninitialized misprediction count for
pre-aggregated traces. Fix by zero initializing both counters.

Test Plan: updated entry-point-fallthru.s
2025-06-03 20:50:19 -07:00
Amir Ayupov
18e51314c4
[BOLT] Support pre-aggregated basic sample profile (#140196)
Define a pre-aggregated basic sample format:
```
E <event name>
S <location> <count>
```

`-nl` flag is required to use parsed basic samples.

Test Plan: update pre-aggregated-perf.test
2025-06-02 11:43:48 -07:00
Amir Ayupov
5047a33cd8
[BOLT][heatmap] Produce zoomed-out heatmaps (#140153)
Add a capability to produce multiple heatmaps with given bucket sizes.

The default heatmap block size (64B) could be too fine-grained for
large binaries. Extend the option `block-size` to accept a list of
bucket sizes for additional heatmaps with coarser granularity. The
heatmap is simply rescaled so provided sizes should be multiples of
each other. Human-readable suffixes can be used, e.g. 4K, 16kb, 1MiB.

New defaults: 64B (base bucket size), 4KB (default page size),
256KB (for large binaries).

Test Plan: updated heatmap-preagg.test
2025-05-30 16:20:19 -07:00
Amir Ayupov
9d5d715330
[BOLT][heatmap] Add synthetic hot text section (#139824)
In heatmap mode, report samples and utilization of the section(s)
between hot text markers `[__hot_start, __hot_end)`.

The intended use is with multi-way splitting where there are several
sections that contain "hot" code (e.g. `.text.warm` with CDSplit).

Addresses the comment on #139193

https://github.com/llvm/llvm-project/pull/139193#pullrequestreview-2835274682

Test Plan: updated heatmap-preagg.test
2025-05-14 09:47:14 -07:00
Amir Ayupov
616489e2ee
[BOLT] Drop perf2bolt cold samples diagnostic (#139337)
Cold samples diagnostics in perf2bolt are superseded by
`perf2bolt --heatmap` option (#139194). It provides a superset of stats
and works without BAT section which is not emitted by default.

Test Plan: NFC
2025-05-13 13:24:56 -07:00
Amir Ayupov
0289ca09be
[BOLT] Print heatmap from perf2bolt (#139194)
Add perf2bolt `--heatmap` option to produce heatmaps during profile
aggregation.

Distinguish exclusive mode (`llvm-bolt-heatmap`) and optional mode 
(`perf2bolt --heatmap`), which impacts perf.data handling:
exclusive mode covers all addresses, whereas optional mode consumes
attached profile only covering function addresses.

Test Plan: updated per2bolt tests:
- pre-aggregated-perf.test: pre-aggregated data,
- bolt-address-translation-yaml.test: pre-aggregated + BOLTed input,
- perf_test.test: no-LBR perf data.
2025-05-13 13:23:18 -07:00
Amir Ayupov
fbdb5aeff6
[BOLT] Build heatmap with pre-aggregated data (#138798)
Reuse data structures used by perf data reader for pre-aggregated data.
Combined with #136531 this allows using pre-aggregated data for heatmap.

Test Plan: heatmap-preagg.test
2025-05-12 18:04:10 -07:00
Amir Ayupov
f2351d9e7f
[BOLT][heatmap] Use parsed basic/branch events (#136531)
Remove duplicate profile parsing in heatmap construction, switching to
using parsed profile. #138798 adds support for using pre-aggregated
profile for heatmap construction.

Test Plan: added heatmap.test in
0868850a15
2025-05-12 17:33:30 -07:00
Amir Ayupov
e039d16ee5
[BOLT][NFC] Disambiguate sample as basic sample (#139350)
Sample is a general term covering both basic (IP) and branch (LBR)
profiles. Find and replace ambiguous uses of sample in a basic sample
sense.

Rename `RawBranchCount` into `RawSampleCount` reflecting its use for
both kinds of profile.

Rename `PF_LBR` profile type as `PF_BRANCH` reflecting non-LBR based
branch profiles (non-brstack SPE, synthesized brstack ETM/PT).

Follow-up to #137644.

Test Plan: NFC
2025-05-12 17:15:16 -07:00
Amir Ayupov
8f31c6dde7
[BOLT] Support profile density with basic samples (#137644)
For profile with LBR samples, binary function profile density is
computed as a ratio of executed bytes to function size in bytes.

For profile with IP samples, use the size of basic block containing the
sample IP as a numerator.

Test Plan: updated perf_test.test
2025-05-10 21:01:49 -07:00
Kazu Hirata
193135c800
[BOLT] Remove an unused local variable (NFC) (#139392) 2025-05-10 10:21:59 -07:00
Amir Ayupov
54aa16d293
[BOLT] Drop converting return profile to call cont (#129477)
The workaround was not implemented for BAT case, and it is no longer
needed with pre-aggregated traces, alternatively, the effect can be
achieved with `infer-fall-throughs` with old pre-aggregated format
(branches + ranges).

Test Plan: updated callcont-fallthru.s
2025-05-06 22:21:53 -07:00
Amir Ayupov
5d0afacd1b
[BOLT][NFCI] Emit uniform diagnostics in DataAggregator (#136530)
DataAggregator supports reading different kinds of profile data:
- perf data: branch records or IP samples,
- pre-aggregated branch data.

Make profile quality reporting uniform across all kinds of input:
- out-of-range and mismatching samples,
- samples in cold code in BAT mode (profiled BOLTed binary).

Test Plan: NFCI
2025-04-24 13:51:18 -07:00