This is an archive of the discontinued LLVM Phabricator instance.

[llvm-exegesis] Make possible to execute snippets without perf counters

Authored by kpdev42 on Mar 17 2023, 8:12 AM.



Performance counters may be unavailable due to various reasons (such as
access restriction via sysctl properties or the CPU model being unknown
to libpfm). On the other hand, for debugging llvm-exegesis itself it is
still useful to be able to run generated code snippets to ensure that
the snippet does not crash at run time.

The --use-dummy-perf-counters command line option makes llvm-exegesis
behave just as usual except for using fake event counts instead of asking
the kernel for actual values.


Huawei RRI, OS Lab

Diff Detail

Event Timeline

kpdev42 created this revision.Mar 17 2023, 8:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2023, 8:12 AM
kpdev42 requested review of this revision.Mar 17 2023, 8:12 AM

Thanks. In principle that sounds goods, my only real remark is about what flags we use to communicate that intent to the tool.


I think you can add something about not using actual perf counters if that's waht the user wants:

"If you are debugging and you don't want to actually read performance counters, use --use-dummy-perf-events


I think this should be its own separate flag. This is only really used in main to parameterize how to measure, but we're still "measuring" stuff.

kpdev42 updated this revision to Diff 506620.Mar 20 2023, 9:39 AM
kpdev42 edited the summary of this revision. (Show Details)

Address review notes. Change patch's description accordingly

kpdev42 marked 2 inline comments as done.Mar 20 2023, 9:39 AM
courbet accepted this revision.Mar 20 2023, 10:07 AM
This revision is now accepted and ready to land.Mar 20 2023, 10:07 AM
kpdev42 updated this revision to Diff 507348.Mar 22 2023, 7:04 AM

Fixed running with LLVM_ENABLE_LIBPFM=OFF and updated the text of one more error message

kpdev42 updated this revision to Diff 509346.Mar 29 2023, 6:47 AM

Updated after D146302 and rebased

kpdev42 updated this revision to Diff 511041.Apr 5 2023, 4:12 AM

Fix test