Hi David,
Thanks for your reply. I find that I need to add some new types of profile data that are specific to JIT environment like Function Ordering. Function Ordering is similar to dynamic call graph which records the execution of functions at runtime along with the order in which they are called.
Eg: Suppose they are 5 functions (F1..F5). F1 calls other functions in the order described below, count tells how many times that function is called from F1.
Start[1] --> F1 --> F2 [1]
--> F4 [1]
--> F2 [2]
--> F1 [0] (recursions)
--> F5 [1].
This shows us which function is likely going to execute next. So with the help of multiple JIT background threads, those functions get compiled before they are referenced. This will help in reducing JIT compilation latencies in multi-core machines. This order must be collected during profiling so that we can use in JIT.
With AOT compilation, the function layout is usually done by linker
plugin or LTO. JIT sees whole program and can certainly do function
layout with profile data.
I'm new to PGO, I don't know how the internals details much. As I'm proposing this project for GSoC'19, i would like to learn how PGO is structured, it will help to design similar for JIT & write a proposal. I googled but is less information available about the internals. Is any references to internals/working of PGO are welcome!
PGO includes 'profile driven' optimizations and 'profile aware'
optimizations. Profile aware optimizations spread across many
optimization passes and there is currently no central place for
documentation. Here are a list of optimizations (but not limited to)
that are profile aware: inliner (including thinLTO function importing)
block layout, register allocator, unroller, loop peeling, loop
sinking, vectorization etc. Others such as speculative PRE can also
make use of profile info. Profile driven size optimization is also
under development.
'profile driven' optimizations include value profiling transformations
such as indirect call promotion, memcpy/set specialization, control
height reduction, function layout etc.
Another big chunk of PGO is the PGO infrastructure: including profile
reader/writer, instrumentation, lowering, profile loader/summary
analysis, profiling runtime, profile merging tool etc. PMU based
samplePGO adds another dimension to it.
David