[llvm-branch-commits] [llvm] [BOLT] Default heatmap block sizes to cache line, pages and hugepage (PR #215427)

Amir Ayupov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 10 22:15:46 PDT 2026


https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/215427

>From f31f281fcc151f064bf82ab4a43cc9715577626e Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Sun, 9 Aug 2026 04:19:34 -0700
Subject: [PATCH] [BOLT] Default heatmap block sizes to cache line, pages and
 hugepage

The defaults were 64, 4K, 256K. 4K is the page size only on x86-64 and on
AArch64 kernels built that way; AArch64 also runs 16K and 64K base pages, and
256K corresponds to nothing in particular on either.

Use 64, 4K, 16K, 64K, 2M: the cache line, the three base page sizes in use, and
the PMD hugepage above a 4K base page. Each granularity then maps onto a real
capacity, which is what makes the working set numbers comparable to one -- L1i
lines, iTLB and L2 TLB entries, frontend region-table entries.

Two more granularities cost two more passes over an already-built map, no extra
decoding.
---
 bolt/lib/Utils/CommandLineOpts.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/bolt/lib/Utils/CommandLineOpts.cpp b/bolt/lib/Utils/CommandLineOpts.cpp
index ddc5af47228ff..25b0710f3efda 100644
--- a/bolt/lib/Utils/CommandLineOpts.cpp
+++ b/bolt/lib/Utils/CommandLineOpts.cpp
@@ -218,10 +218,15 @@ cl::opt<opts::HeatmapBlockSizes, false, opts::HeatmapBlockSpecParser>
     HeatmapBlock(
         "block-size", cl::value_desc("initial_size{,zoom-out_size,...}"),
         cl::desc("heatmap bucket size, optionally followed by zoom-out sizes "
-                 "for coarse-grained heatmaps (default 64B, 4K, 256K)."),
+                 "for coarse-grained heatmaps (default 64, 4K, 16K, 64K, 2M)."),
+        // Cache line, then the page sizes x86-64 and AArch64 actually use
+        // (4K, and 16K/64K on AArch64), then the PMD hugepage above a 4K base
+        // page.
         cl::init(HeatmapBlockSizes{/*Initial*/ {64, "64"},
                                    /*Zoom-out*/ {4096, "4K"},
-                                   {262144, "256K"}}),
+                                   {16384, "16K"},
+                                   {65536, "64K"},
+                                   {2097152, "2M"}}),
         cl::cat(HeatmapCategory));
 
 cl::opt<int> HeatmapCdfPct(



More information about the llvm-branch-commits mailing list