Skip to content

Commit

Permalink
generate caffe2/core/macros.h in shared build structure (pytorch#98131)
Browse files Browse the repository at this point in the history
This is only used by Bazel for now.

Differential Revision: [D44604078](https://our.internmc.facebook.com/intern/diff/D44604078/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D44604078/)!
Pull Request resolved: pytorch#98131
Approved by: https://github.com/ezyang, https://github.com/PaliC
  • Loading branch information
mikey dagitses authored and pytorchmergebot committed Apr 4, 2023
1 parent d47a4bf commit 301f00f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
22 changes: 0 additions & 22 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -450,28 +450,6 @@ CAFFE2_COPTS = COMMON_COPTS + [
"-fno-trapping-math",
]

header_template_rule(
name = "caffe2_core_macros_h",
src = "caffe2/core/macros.h.in",
out = "caffe2/core/macros.h",
substitutions = {
"cmakedefine": "define",
"#define CAFFE2_FORCE_FALLBACK_CUDA_MPI": "/* #undef CAFFE2_FORCE_FALLBACK_CUDA_MPI */",
"#define CAFFE2_HAS_MKL_DNN": "/* #undef CAFFE2_HAS_MKL_DNN */",
"#define CAFFE2_HAS_MKL_SGEMM_PACK": "/* #undef CAFFE2_HAS_MKL_SGEMM_PACK */",
"#define CAFFE2_THREADPOOL_MAIN_IMBALANCE": "/* #undef CAFFE2_THREADPOOL_MAIN_IMBALANCE */",
"#define CAFFE2_THREADPOOL_STATS": "/* #undef CAFFE2_THREADPOOL_STATS */",
"#define CAFFE2_USE_ACCELERATE": "/* #undef CAFFE2_USE_ACCELERATE */",
"#define CAFFE2_USE_EIGEN_FOR_BLAS": "/* #undef CAFFE2_USE_EIGEN_FOR_BLAS */",
"#define CAFFE2_USE_FBCODE": "/* #undef CAFFE2_USE_FBCODE */",
"#define CAFFE2_USE_GOOGLE_GLOG": "/* #undef CAFFE2_USE_GOOGLE_GLOG */",
"#define CAFFE2_USE_LITE_PROTO": "/* #undef CAFFE2_USE_LITE_PROTO */",
"#define CAFFE2_USE_MKL\n": "/* #undef CAFFE2_USE_MKL */\n",
"#define CAFFE2_USE_NVTX": "/* #undef CAFFE2_USE_NVTX */",
"#define CAFFE2_USE_TRT": "/* #undef CAFFE2_USE_TRT */",
},
)

filegroup(
name = "caffe2_contrib_srcs",
srcs = [
Expand Down
18 changes: 18 additions & 0 deletions build.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ load(
)

def define_targets(rules):
rules.cmake_configure_file(
name = "caffe2_core_macros_h",
src = "caffe2/core/macros.h.in",
out = "caffe2/core/macros.h",
definitions = [
"CAFFE2_BUILD_SHARED_LIBS",
"CAFFE2_PERF_WITH_AVX",
"CAFFE2_PERF_WITH_AVX2",
"CAFFE2_PERF_WITH_AVX512",
"CAFFE2_USE_EXCEPTION_PTR",
"CAFFE2_USE_CUDNN",
"USE_MKLDNN",
"CAFFE2_USE_ITT",
"TORCH_DISABLE_GPU_ASSERTS",
"EIGEN_MPL2_ONLY",
],
)

rules.cc_library(
name = "caffe2_serialize",
srcs = [
Expand Down

0 comments on commit 301f00f

Please sign in to comment.