[PATCH] D157123: [FuncSpec] Rework the discardment logic for unprofitable specializations.
Alexandros Lamprineas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 4 11:37:24 PDT 2023
labrinea created this revision.
labrinea added reviewers: ChuanqiXu, chill.
Herald added subscribers: hoy, ormris, hiraditya.
Herald added a project: All.
labrinea requested review of this revision.
Herald added a project: LLVM.
Currently we make an arbitrary comparison between codesize and latency
in order to decide whether to keep a specialization or not. Sometimes
the latency savings are biased in favor of loops because of imprecise
block frequencies, therefore this metric contains a lot of noise. This
patch tries to address the problem as follows:
- Reject specializations whose codesize savings are less than X% of the original function size.
- Reject specializations whose latency savings are not at least N times greater than the codesize savings.
- Reject specializations whose inlining bonus is not at least N times greater than the original function size.
I am not saying this is super precise, but at least X and N are
configurable, allowing us to tweak the cost model. Moreover, it
lets us prioritize codesize over latency, which is a less noisy
metric.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D157123
Files:
llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
llvm/unittests/Transforms/IPO/FunctionSpecializationTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157123.547289.patch
Type: text/x-patch
Size: 11360 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230804/0ed4c884/attachment.bin>
More information about the llvm-commits
mailing list