I'm trying to measure the branch mispredict rate in Vtune for performance comparisons across different products.
I noticed that there's a branch mispredict tile on the Microarchitecture Exploration page, but it seems to be the cost of mispredictions in term of pipelines, not the mispredict rate. I also noticed there are "BR_MISP_RETIRED.ALL_BRANCHES" and "BR_INST_RETIRED.ALL_BRANCHES", their quotient may be an approximation(which I assume is bigger than the actual number), but is there an accurate way to measure branch mispredict rate?
Just create custom VTune analysis with 2 events:
You'll need to manually divide one by another to get the ration though.
In case you don't know - custom analysis in VTune can be created by selecting any pre-defined analysis and pressing 'Customize...' button in the top-right corner. E.g. you can select Microarchitecture Exploration, uncheck all check-boxes there, press 'Customize...', scroll down to the table with CPU events and uncheck all not needed/add needed events.
Thanks for the reply, I am using this method for now, but there are two quesitions:
1. Using BR_INST_RETIRED.ALL_BRANCHES as denominator means that Intel processor will try to predict every single branch instruction. Is this the actual case? If not, the end result might be smaller than the actual one.
2. I heard that intel processors will try to terminate mispredicted instructions mid-execution. I don't know whether these cases will be counted as BR_MISP_RETIRED.ALL_BRANCHES events.
Sorry for late reply. We looked into your case. If you want the branch prediction and the branch misprediction rate then you only need to focus on the conditional jumps. You can use BR_MISP_RETIRED.CONDITIONAL which are for conditional branch instructions. You can also explore the events we have in BR_INST_RETIRED.* and BR_MISP_RETIRED.* and select what is interesting.
Hope this helps.
Thanks and Regards
Thanks, sorry for my forgetting to check on this thread. Currently I'm settling on "BR_MISP_RETIRED.ALL_BRANCHES" and "BR_INST_RETIRED.ALL_BRANCHES" because all other softwares use the same type of events for this purpose, thus the results are comparable. I'm still checking on conditional branch events to see what I can find, and how I can replicate this on other softwares. The results seems to be similiar in most cases though.
Thank you for your patience.