andikleen / pmu-tools

Intel PMU profiling tools
GNU General Public License v2.0
2.04k stars 341 forks source link

No precise event (ppu) usage with perf-tools auto-drilldown #510

Closed jestrang closed 5 months ago

jestrang commented 6 months ago

The issue is when perf-tools auto-drilldown feature finds the key event to monitor and provide detailed instruction level bottlenecks, it is not automatically providing the "ppu" suffix at the end of the "-e" event string. This doesn't provide the enhanced precision of event sampling that is resident in SNC/GLC+ cores.

For example, the perf-tools command

./do.py profile  --tune :sample:4 :forgive:2 -a "./workloads/BC.sh 5"  -pm 40

Should provide a single event that is key in mapping instructions to the uarch bottleneck. However, the following commands generated from perf-tools show that the ppu is absent from the perf commands

/usr/bin/python /root/jestrang/perf-tools.pebs/pmu-tools/toplev.py --no-desc --drilldown --show-sample -l1 --nodes '+IPC,+Heavy_Operations,+Time' -V BC-5.toplev--drilldown-perf.csv -- /root/jestrang/perf-tools.pebs/workloads/BC.sh 5 | tee BC-5.toplev--drilldown.log | grep -E -v "^(Run toplev|Add|Using|Sampling)|perf.* record"
/usr/bin/python /root/jestrang/perf-tools.pebs/pmu-tools/toplev.py --describe Bad_Speculation^
/usr/bin/python /root/jestrang/perf-tools.pebs/pmu-tools/toplev.py --describe Branch_Mispredicts^
perf record -g -e cpu/event=0xc5,umask=0x0,name=Branch_Mispredicts_BR_MISP_RETIRED_ALL_BRANCHES,period=50021/,cycles:pp -o perf.data.2 /root/jestrang/perf-tools.pebs/workloads/BC.sh 5
perf report --stdio -i perf.data.2 > BC-5.locate-report.log
perf annotate --stdio -i perf.data.2 > BC-5.locate-annotate.log

The request is to have this by default, and if the event isn't able to have a "ppu" suffix, then notify the user if possible.

Thank you, Jon

aayasin commented 6 months ago

The request is to add precise modifier for the primary event, if it is precise. In this example it should be cpu/event=0xc5,umask=0x0,name=Branch_Mispredicts_BR_MISP_RETIRED_ALL_BRANCHES,period=50021/pp

andikleen commented 5 months ago

The problem is that the event files have PEBS: "0" everywhere. This used to be 1 for PEBS events, and it worked.

Perhaps I should switch to CollectPEBSRecord, but that field seems to be always 2, not 1 vs 2 for events that actually require PEBS which is needed to know to filter out for virtualization. I think the event files need to be fixed.