[all-commits] [llvm/llvm-project] 2e6c7b: [OpenMPOpt] Bound indirect-call specialization ins...
Larry Meadows via All-commits
all-commits at lists.llvm.org
Mon Sep 7 16:47:56 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2e6c7bc8513ee405ca2e8a3032c1ab41a19ee90f
https://github.com/llvm/llvm-project/commit/2e6c7bc8513ee405ca2e8a3032c1ab41a19ee90f
Author: Larry Meadows <Lawrence.Meadows at amd.com>
Date: 2026-09-07 (Mon, 07 Sep 2026)
Changed paths:
M llvm/lib/Transforms/IPO/OpenMPOpt.cpp
A llvm/test/Transforms/OpenMP/indirect_call_specialization_cap.ll
Log Message:
-----------
[OpenMPOpt] Bound indirect-call specialization instead of paying for all of it (#219323)
`registerAAsForFunction()` seeds `AAIndirectCallInfo` unconditionally,
so device
code pays for specializing every indirect call site. Device code routes
many
calls through function-pointer tables and virtual dispatch, so a call
site can
see every address-taken candidate in the module, and the if-cascade
`AAIndirectCallInfo` builds over them is quadratic.
Skip specialization at a call site with more than three possible
callees,
overridable with `-openmp-opt-max-callees-for-specialization`. The bound
is a
threshold on the call site rather than a limit on how many callees get
specialized: the Attributor asks about each callee with the same total,
so a
site above the threshold keeps its indirect call instead of getting
three direct
ones plus a fallback.
Measured on a generated module with a 256-entry device function-pointer
table,
2048 dispatch functions and 64 target regions, gfx90a,
`opt -disable-verify -passes='openmp-opt,lto<O3>'`, min of 3 runs:
| | cap 3 | no cap |
|-----------------------------------------|-------|--------|
| LTO pipeline | 13.3s | 34.4s |
| final module, IR lines | 340k | 511k |
| cascade equality tests after openmp-opt | 310 | 499 |
The cost is not in `openmp-opt` itself, which is 1.23s either way; it is
in what
the rest of the pipeline does with the cascades. Sites at or below the
threshold
are still specialized, which `indirect_call_specialization_cap.ll`
covers from
both sides.
This PR previously carried two other changes, now split out as #221449
(loop
runtime callbacks) and #221450 (the worker-count gate), per @abidh's
request.
Tested on gfx90a: `llvm/test/Transforms/{OpenMP,Attributor}` 260 passed,
1
unsupported.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list