[PATCH] D66399: [ORCv2] - New Speculate Query Implementation

Praveen velliengiri via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 15:57:02 PDT 2019


pree-jackie marked 2 inline comments as done.
pree-jackie added inline comments.


================
Comment at: llvm/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp:248-249
+// with call.
+SequenceBBQuery::BlockListTy
+SequenceBBQuery::queryCFG(Function &F, const BlockListTy &CallerBlocks) {
+
----------------
pree-jackie wrote:
> lhames wrote:
> > Can you describe more about how SequencedBBQuery differs from BlockFreqQuery?
> > 
> > In particular: (1) What is the output of this algorithm, queryCFG, and (2) what benefit do we get from scanning to the exit blocks?
> The blockfreqquery, only selects the blocks with highest execution frequencies. Based on the observation, often the blocks within the loop nests have high frequency. The idea here is to, traverse back towards the entry node and exit node to collect all the predecessor and successor blocks with call instructions respectively. 
> Here the standard hot branch probability (4/5) is used to guide traversal to entry and exit nodes but we 
> can customize the branch probability to define own hotness instead of 80%, to have better coverage. 
> 
> Algorithm produces a set of basic blocks N, where N >= NHotBlocks, 
> 
> that is when N = NHotBlocks, there are no predecessor & successor blocks with call inst. 
> 
> when N > NHotBlocks,  x = (N - NHotBlocks)
> there are x number of predecessor & successor blocks with call inst which we miss in block freq query. 
> 
> 
This heuristic outputs a sequence of basic blocks, 
for example : entry -> bb1.call -> bb2.call. 
The last operation of the heuristic, rearranges the collected set of basic blocks by taking the distance from the entry node into account. In the above example, bb2.call may have high frequency than bb1.call, but based on distance from entry node they are swapped.


================
Comment at: llvm/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp:248-249
+// with call.
+SequenceBBQuery::BlockListTy
+SequenceBBQuery::queryCFG(Function &F, const BlockListTy &CallerBlocks) {
+
----------------
pree-jackie wrote:
> pree-jackie wrote:
> > lhames wrote:
> > > Can you describe more about how SequencedBBQuery differs from BlockFreqQuery?
> > > 
> > > In particular: (1) What is the output of this algorithm, queryCFG, and (2) what benefit do we get from scanning to the exit blocks?
> > The blockfreqquery, only selects the blocks with highest execution frequencies. Based on the observation, often the blocks within the loop nests have high frequency. The idea here is to, traverse back towards the entry node and exit node to collect all the predecessor and successor blocks with call instructions respectively. 
> > Here the standard hot branch probability (4/5) is used to guide traversal to entry and exit nodes but we 
> > can customize the branch probability to define own hotness instead of 80%, to have better coverage. 
> > 
> > Algorithm produces a set of basic blocks N, where N >= NHotBlocks, 
> > 
> > that is when N = NHotBlocks, there are no predecessor & successor blocks with call inst. 
> > 
> > when N > NHotBlocks,  x = (N - NHotBlocks)
> > there are x number of predecessor & successor blocks with call inst which we miss in block freq query. 
> > 
> > 
> This heuristic outputs a sequence of basic blocks, 
> for example : entry -> bb1.call -> bb2.call. 
> The last operation of the heuristic, rearranges the collected set of basic blocks by taking the distance from the entry node into account. In the above example, bb2.call may have high frequency than bb1.call, but based on distance from entry node they are swapped.
Plus, this sequence will be very helpful in future that when we are introducing custom speculate.points inside the function instead of just having them in top of CFG.
In essence, we can decide the appropriate position of speculate.points by knowing the sequence of blocks with call, 

Plus, this is experimental try.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66399/new/

https://reviews.llvm.org/D66399





More information about the llvm-commits mailing list