-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[bazel] Build libpfm as a dependency to allow collection of perf counters #1408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ffa1741
to
38b9661
Compare
it'll need to be added to cmake too. and do we actually want to push the cost of the extra library on to all end users, even if they don't care about perf counters? |
Now that bazelisk builds it on behalf of users, it should be a self-contained target with no meaningful impact for those who do not care about the feature... unless you think there's a runtime cost associated with this path? As an alternative, I can add a separate target with libpfm support, giving folks an option to use either one. Thoughts? |
Fixed build failures. |
bazel failures look reasonably like this PR caused them. |
|
yes, it's possible. but it suggests that the bazel config is not quite the same as the cmake one. |
Perhaps I am not following your ask. CMake uses
|
yes, there are perf counter tests that use cmake (build-and-test-perfcounters). with your change, we are now also running these same tests on the bazel build for the first time, but they're failing. which suggests something about how the bazel build is configured is different from the cmake build-and-test-perfcounters build. my initial guess would be: the cmake version doesn't run the tests as they fail due to permissions issues. so to be equivalent, you may need to just filter out the pfm tests from the bazel workflow on the CI bots.
|
Apologies for letting this sit, I've been taking some time off. I hope to get back to this next week. |
If this is bazel-specific, it should not touch non-bazel stuff. |
Addressed the CMake situation, removed the explicit CMakeLists.txt change to always turn on PFM... Added a config_setting to make this optional for Bazel builds too. Please take a look @LebedevRI |
This commit builds libpfm using rules_foreign_cc and lets the default build of the benchmark library support perf counter collection without needing additional work from users. Tested with a custom target: ``` bazel run \ --override_repository=com_github_google_benchmark=/home/raghu/benchmark \ -c opt :test-bench -- "--benchmark_perf_counters=INSTRUCTIONS,CYCLES" Using profile: local <snip> ---------------------------------------------------------------------- Benchmark Time CPU Iterations UserCounters... ---------------------------------------------------------------------- BM_Test 0.279 ns 0.279 ns 1000000000 CYCLES=1.00888 INSTRUCTIONS=2 ``` Signed-off-by: Raghu Raja <[email protected]>
Enfabrica has already signed a corporate CLA. Signed-off-by: Raghu Raja <[email protected]>
As long as it's bazel-only i have no comments :) |
thanks for coming back to it. i just had one comment :) |
This commit builds libpfm using rules_foreign_cc and lets the default
build of the benchmark library support perf counter collection without
needing additional work from users.
Tested with a custom target: