[PATCH] D12199: Add framework for iterative compilation to llvm
Zoran Jovanovic via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 25 08:39:47 PDT 2015
zoran.jovanovic updated this revision to Diff 35726.
zoran.jovanovic added a comment.
*Places for improvement*
Our research identified couple of places where improvements can be made:
- DecisionTreeNodes priorities can be tuned better
- Tree exploration can be made faster
*Implemented solutions*
This patch addresses the first issue.
Original idea is to find spots where heuristic result isn't
confident. Those values should be inspected carefully and normalized
which we can improve. Because of this, our implementation was biased
to explore alternative decisions of only one (RegAllocGreedy)
optimization point.
This problem is for now solved with introducing "round robin" tree
exploration which tries to mask out nodes of already used optimization
until all optimizations are exhausted or there are no available nodes
of unused optimizations. When all optimizations are used / there are
no available nodes to choose, we restart masking process. (An
optimization, or optimization point is considered as used if node of
that optimization was chosen for making alternative decision and
producing an alternative path.)
This solution enabled as to vary position in decision tree where we
make alternative decision which led to significant improvements.
Another improvement in this patch is randomization of node choice. Let
us define best node as a node with lowest function fitness (node is on
path which leads to smallest code size) and with highest priority. The
issue is that there are usually more than one such node in the
decision tree, for every optimization. In previous revisions, only
first best node was considered for making alternative decision. In
this revision, we collect all equivalent best nodes and randomly
choose one of them.
This randomization led to even faster tree exploration and greater
improvements.
*Current results*
We continued with benchmarking LLVM IC framework using CSiBE test. Our
results show that this patch can give results for 10 iterations as
good as old version for 100 iterations! As expected, this version
outperformed old version on 100 iterations.
*Further work*
To make improvements mentioned in the beginning, we will try to split
decision tree in such way that every function has it's own decision
tree. That way, every function would have smaller tree, and separate
functions could be optimized in parallel. With this implemented, we
expect to get even smaller code size but keeping number of iterations
reasonable small.
Priority tuning still stays open for suggestions and further work.
http://reviews.llvm.org/D12199
Files:
include/llvm/Analysis/ICDecisionTree.h
include/llvm/Analysis/ICFileUtils.h
include/llvm/Analysis/ICPass.h
include/llvm/Analysis/ICProxies.h
include/llvm/Analysis/ICSetCurrentFunc.h
include/llvm/Analysis/ICUtils.h
include/llvm/Analysis/IterativeCompilation.h
include/llvm/Analysis/Passes.h
include/llvm/InitializePasses.h
include/llvm/Transforms/IPO/InlinerPass.h
include/llvm/Transforms/Utils/LoopUtils.h
lib/Analysis/Analysis.cpp
lib/Analysis/CMakeLists.txt
lib/Analysis/ICDecisionTree.cpp
lib/Analysis/ICFileUtils.cpp
lib/Analysis/ICPass.cpp
lib/Analysis/ICProxies.cpp
lib/Analysis/ICSetCurrentFunc.cpp
lib/Analysis/ICUtils.cpp
lib/CodeGen/RegAllocGreedy.cpp
lib/Target/Mips/CMakeLists.txt
lib/Target/Mips/Mips.h
lib/Target/Mips/MipsFunctionFitness.cpp
lib/Target/Mips/MipsTargetMachine.cpp
lib/Transforms/IPO/InlineAlways.cpp
lib/Transforms/IPO/InlineSimple.cpp
lib/Transforms/IPO/Inliner.cpp
lib/Transforms/IPO/PassManagerBuilder.cpp
lib/Transforms/Scalar/LICM.cpp
unittests/Analysis/CMakeLists.txt
unittests/Analysis/ICDecisionTree.cpp
unittests/Analysis/ICProxies.cpp
unittests/Analysis/ICUtils.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12199.35726.patch
Type: text/x-patch
Size: 114479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150925/a1f5666f/attachment-0001.bin>
More information about the llvm-commits
mailing list