Conversation
lbr/lbr.py
Outdated
| if entry_pt == 0: | ||
| candidate_regs=x86.get("srcs",lines[x]) + [x86.get("dst",lines[x])] | ||
| for i in candidate_regs: | ||
| if '0x' in i: |
There was a problem hiding this comment.
what is the purpose of this '0x' check?
if the goal to avoid memory access, then I believe there is a suitable method to leverage from x86.py
There was a problem hiding this comment.
So its filtering out random immediate values as possible candidate registers. For example it will consume "cmp rax,0x1000" and will have [rax,0x1000] in the list, so that removes the 0x1000
There was a problem hiding this comment.
Oh.. then this is not generic enough; e.g. what if the assembler did not put the immediate value in hexa?
lbr/lbr.py
Outdated
| elif v2ii2v_dst: inc_stat('V2I transition-Penalty') | ||
| if xinfo.is_cond_br() and xinfo.is_taken(): | ||
| LC.glob['cond_%sward-taken' % ('for' if ip > xip else 'back')] += 1 | ||
| #Shortcircuit detection |
There was a problem hiding this comment.
Please document in simple language the pattern the heuristic of shortcircuit looks for
|
I've added comments to the shortcircuit branch |
| if C.any_in(vecs, ''.join(v2ii2v_srcs)): inc_stat('V2I transition-Penalty') | ||
| elif C.any_in(vecs, v2ii2v_dst): inc_stat('I2V transition-Penalty') | ||
| elif v2ii2v_dst: inc_stat('V2I transition-Penalty') | ||
| if size > 1: |
There was a problem hiding this comment.
It seems your code needlessly change larger block of code.
For example, this check for size > 1 isn't there after you merge.
Please re-merge your new stats/logic on the latest repo
lbr/lbr.py
Outdated
| if xinfo.is_cond_br() and xinfo.is_taken(): | ||
| LC.glob['cond_%sward-taken' % ('for' if ip > xip else 'back')] += 1 | ||
| #Shortcircuit detection | ||
| #A setcc instructions is found, now walk in reverse and find at least two conditional jumps within a max_inst window. |
There was a problem hiding this comment.
Beyond this 1 lines, Would help the reader to have an example of a sequence of instructions the logic would catch
lbr/lbr.py
Outdated
| if entry_pt == 0: | ||
| candidate_regs=x86.get("srcs",lines[x]) + [x86.get("dst",lines[x])] | ||
| for i in candidate_regs: | ||
| if '0x' in i: |
There was a problem hiding this comment.
Oh.. then this is not generic enough; e.g. what if the assembler did not put the immediate value in hexa?
aayasin
left a comment
There was a problem hiding this comment.
Thanks for documenting the code, Jon.
I had to return it this time since many files under pmu-tools/ change.
Please re-pull changes in a fresh clone area (I merged your other pipeline view).
Use this opportunity to place shortcircuit code in a new function and invoke it from edge_stats(); similar to code in edge_leaf_func_stats(). Breakout long comment line for readability
|
Will do, I'll put it into a new function. |
Adding shortcircuit Detection into sampling-LBR.