Skip to content

Bolt: BAT is forward-incompatible between bolt-18 and bolt-19 #111920

@itrofimow

Description

@itrofimow

What I did:

  1. Built the binary baseline_emit_relocs with -Wl,--emit-relocs
  2. Gathered the profile: perf record -e cycles:u -j any,u -o perfdata/baseline_emit_relocs.perf.data -p $(pidof baseline_emit_relocs) sleep 20
  3. Converted the profile into yaml-format with bolt-19 (to which perf2bolt resolves): perf2bolt baseline_emit_relocs --perfdata=perfdata/baseline_emit_relocs.perf.data --profile-format=yaml -w profiles/baseline_emit_relocs.bolt.yaml -o /dev/null
  4. Bolt-ed the original binary with bolt-18: llvm-bolt-18 baseline_emit_relocs -o bolted_bat --data=profiles/baseline_emit_relocs.bolt.yaml --reorder-blocks=ext-tsp --reorder-functions=cdsort --split-functions --split-all-cold --split-eh --dyno-stats --update-debug-sections --infer-stale-profile --enable-bat
  5. Gathered the profiled from bolt-ed binary: perf record -e cycles:u -j any,u -o perfdata/bolted_bat.perf.data -p $(pidof bolted_bat) sleep 20
  6. Tried to convert the profile into yaml-format with bolt-19 (to which perf2bolt resolves): perf2bolt bolted_bat --perfdata=perfdata/bolted_bat.perf.data --profile-format=yaml -w profiles/bolted_bat.bolt.yaml -o /dev/null

which resulted in error BOLT-ERROR: failed to parse BOLT address translation table.


So I need

  • yaml-format when converting the profile for --infer-stale-profile to work when bolting the binary later
  • --enable-bat when bolting the binary for profile collection to work on bolt-ed binary
  • bolt-19 for converting profiles of bolt-ed binaries into yaml-format (bolt-18 fails with BOLT-ERROR: unable to save profile in YAML format for input file processed by BOLT. Please remove -w option and use branch profile.)

to enable continuous-bolting in production, but forward-incompatibility of BAT gets in the way.


  1. Is BAT intended to be compatible between bolt versions?
  2. If not, are there any ways to convert perf.data of bolt-ed binary into .yaml profile somehow (maybe with additional hops through fdata?) with bolt-18?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions