From 4bf8a9b2598111c81098bc71b01ae7a8514a115a Mon Sep 17 00:00:00 2001 From: mikey dagitses Date: Wed, 2 Mar 2022 02:49:38 -0800 Subject: [PATCH] add benchmark to Bazel build (#71412) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/71412 This is only in CMake and internal builds right now. Add to Bazel for parity. ghstack-source-id: 150235094 Test Plan: Built and ran locally. Rely on CI to verify. Reviewed By: malfet Differential Revision: D33635743 fbshipit-source-id: b9e5abbef5feabd52c53a9c2b95713b87ce81681 (cherry picked from commit 11700dbc80200093fdd74b1be066b4e740cee516) --- WORKSPACE | 7 +++++++ c10/benchmark/BUILD.bazel | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 c10/benchmark/BUILD.bazel diff --git a/WORKSPACE b/WORKSPACE index 95eee3bdd494..fb15aad66cb8 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -33,6 +33,13 @@ http_archive( ], ) +http_archive( + name = "google_benchmark", + sha256 = "6132883bc8c9b0df5375b16ab520fac1a85dc9e4cf5be59480448ece74b278d4", + strip_prefix = "benchmark-1.6.1/", + urls = ["https://github.com/google/benchmark/archive/refs/tags/v1.6.1.tar.gz"], +) + http_archive( name = "pybind11_bazel", strip_prefix = "pybind11_bazel-7f397b5d2cc2434bbd651e096548f7b40c128044", diff --git a/c10/benchmark/BUILD.bazel b/c10/benchmark/BUILD.bazel new file mode 100644 index 000000000000..82c92dd0e030 --- /dev/null +++ b/c10/benchmark/BUILD.bazel @@ -0,0 +1,11 @@ +load("@rules_cc//cc:defs.bzl", "cc_binary") + +cc_binary( + name = "intrusive_ptr", + srcs = ["intrusive_ptr_benchmark.cpp"], + tags = ["benchmark"], + deps = [ + "//c10/util:base", + "@google_benchmark//:benchmark", + ], +)