move intrusive_ptr benchmark to shared build structure (#71413)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/71413

ghstack-source-id: 150235101

Test Plan: Verified manually. Rely on CI to validate.

Reviewed By: malfet

Differential Revision: D33635740

fbshipit-source-id: 82c6798a20c01c16fb17547d4a0ba30e6ffc272d
(cherry picked from commit d7a0b39f510f59fe16f138a712d380e0091b230a)
This commit is contained in:
mikey dagitses
2022-03-02 02:49:38 -08:00
committed by PyTorch MergeBot
parent 4bf8a9b259
commit 026c0af479
3 changed files with 15 additions and 11 deletions

View File

@ -1,11 +1,4 @@
load("@rules_cc//cc:defs.bzl", "cc_binary")
load("//:tools/bazel.bzl", "rules")
load(":build.bzl", "define_targets")
cc_binary(
name = "intrusive_ptr",
srcs = ["intrusive_ptr_benchmark.cpp"],
tags = ["benchmark"],
deps = [
"//c10/util:base",
"@google_benchmark//:benchmark",
],
)
define_targets(rules = rules)

10
c10/benchmark/build.bzl Normal file
View File

@ -0,0 +1,10 @@
def define_targets(rules):
rules.cc_binary(
name = "intrusive_ptr",
srcs = ["intrusive_ptr_benchmark.cpp"],
tags = ["benchmark"],
deps = [
"//c10/util:base",
"@google_benchmark//:benchmark",
],
)

View File

@ -1,4 +1,4 @@
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load("@rules_cuda//cuda:defs.bzl", "requires_cuda_enabled")
load("//c10/macros:cmake_configure_file.bzl", "cmake_configure_file")
load("//tools/config:defs.bzl", "if_cuda")
@ -7,6 +7,7 @@ load("//tools/config:defs.bzl", "if_cuda")
# build structure aims to replicate Bazel as much as possible, most of
# the rules simply forward to the Bazel definitions.
rules = struct(
cc_binary = cc_binary,
cc_library = cc_library,
cc_test = cc_test,
cmake_configure_file = cmake_configure_file,