[fbsync] Apply changes from D36937789 & D36937774 (#78956)

This commit is contained in:
Jon Janzen
2022-06-06 12:54:10 -07:00
parent c461d8a977
commit 4e27863739
5 changed files with 0 additions and 310 deletions

View File

@ -1,19 +0,0 @@
load("@fbsource//tools/build_defs:fb_xplat_cxx_test.bzl", "fb_xplat_cxx_test")
load("@fbsource//xplat/caffe2:pt_defs.bzl", "get_build_from_deps_query", "pt_operator_registry")
DEFAULT_PT_OP_DEPS = [
"fbsource//xplat/caffe2:torch_mobile_ops_full_dev",
]
def pt_xplat_cxx_test(name, deps = [], pt_op_deps = DEFAULT_PT_OP_DEPS, **kwargs):
code_gen_lib = []
if get_build_from_deps_query():
lib_name = name + "_lib"
pt_operator_registry(lib_name, preferred_linkage = "static", template_select = False, deps = pt_op_deps)
code_gen_lib = [":" + lib_name]
deps = deps + code_gen_lib
fb_xplat_cxx_test(
name = name,
deps = deps,
**kwargs
)

View File

@ -1,83 +0,0 @@
# @nolint
load("//arvr/tools/build_defs:genrule_utils.bzl", "gen_cmake_header")
load("//arvr/tools/build_defs:oxx.bzl", "oxx_static_library")
load(
"@fbsource//xplat/caffe2:pt_defs.bzl",
"gen_aten_files",
"get_aten_codegen_extra_params",
)
def define_aten_gen():
backends = [
"CPU",
"SparseCPU",
"SparseCsrCPU",
# "MkldnnCPU",
"CUDA",
"SparseCUDA",
"SparseCsrCUDA",
"QuantizedCPU",
"QuantizedCUDA",
"Meta",
"ZeroTensor"
]
gen_aten_files(
name = "gen_aten_ovrsource",
extra_flags = get_aten_codegen_extra_params(backends),
visibility = ["PUBLIC"],
)
oxx_static_library(
name = "ovrsource_aten_generated_cuda_headers",
header_namespace = "ATen",
public_generated_headers = {
"CUDAFunctions.h": ":gen_aten_ovrsource[CUDAFunctions.h]",
"CUDAFunctions_inl.h": ":gen_aten_ovrsource[CUDAFunctions_inl.h]",
},
visibility = ["PUBLIC"],
)
oxx_static_library(
name = "ovrsource_aten_generated_meta_headers",
header_namespace = "ATen",
public_generated_headers = {
"MetaFunctions.h": ":gen_aten_ovrsource[MetaFunctions.h]",
"MetaFunctions_inl.h": ":gen_aten_ovrsource[MetaFunctions_inl.h]",
},
visibility = ["PUBLIC"],
)
gen_cmake_header(
src = "aten/src/ATen/Config.h.in",
defines = [
("@AT_MKLDNN_ENABLED@", "0"),
("@AT_MKL_ENABLED@", "0"),
("@AT_MKL_SEQUENTIAL@", "0"),
("@AT_FFTW_ENABLED@", "0"),
("@AT_NNPACK_ENABLED@", "0"),
("@AT_PARALLEL_OPENMP@", "0"),
("@AT_PARALLEL_NATIVE@", "1"),
("@AT_PARALLEL_NATIVE_TBB@", "0"),
("@AT_POCKETFFT_ENABLED@", "0"),
("@CAFFE2_STATIC_LINK_CUDA_INT@", "1"),
("@AT_BUILD_WITH_BLAS@", "1"),
("@AT_BUILD_WITH_LAPACK@", "1"),
("@AT_BLAS_F2C@", "1"),
("@AT_BLAS_USE_CBLAS_DOT@", "0")
],
header = "ATen/Config.h",
prefix = "ovrsource_aten_",
)
gen_cmake_header(
src = "aten/src/ATen/cuda/CUDAConfig.h.in",
defines = [
("@AT_CUDNN_ENABLED@", "1"),
("@AT_ROCM_ENABLED@", "0"),
("@NVCC_FLAGS_EXTRA@", " "),
("@AT_MAGMA_ENABLED@", "0")
],
header = "ATen/cuda/CUDAConfig.h",
prefix = "ovrsource_aten_",
)

View File

@ -1,87 +0,0 @@
# @nolint
load("//arvr/tools/build_defs:oxx.bzl", "oxx_static_library")
load("@fbsource//xplat/caffe2/c10:ovrsource_defs.bzl", "cpu_supported_platforms")
def define_caffe2_perfkernels():
[
oxx_static_library(
name = "perfkernels_{}_ovrsource".format(arch),
srcs = native.glob(["caffe2/perfkernels/*_{}.cc".format(arch)]),
compatible_with = ["ovr_config//cpu:x86_64"],
compiler_flags = select({
"DEFAULT": [],
"ovr_config//compiler:cl": [
"/arch:AVX2",
"/w",
],
"ovr_config//compiler:clang": [
"-Wno-error",
"-mf16c",
] + (["-mf16c", "-mavx"] if arch == "avx" else ["-mfma", "-mavx2"] if arch == "avx2" else ["-mavx512f"]),
}),
raw_headers = native.glob([
"caffe2/core/*.h",
"caffe2/perfkernels/*.h",
"caffe2/proto/*.h",
"caffe2/utils/*.h",
], exclude = [
"caffe2/core/macros.h",
]),
reexport_all_header_dependencies = False,
deps = [
":caffe2_proto_ovrsource",
":ovrsource_caffe2_macros.h",
"@fbsource//xplat/caffe2/c10:c10_ovrsource",
],
)
for arch in ["avx", "avx2", "avx512"]
]
oxx_static_library(
name = "perfkernels_ovrsource",
srcs = native.glob([
"caffe2/perfkernels/*.cc",
], exclude = [
"**/*_avx*",
]),
compatible_with = cpu_supported_platforms,
compiler_flags = select({
"DEFAULT": [],
"ovr_config//compiler:cl": [
"/w",
],
"ovr_config//compiler:clang": [
"-Wno-macro-redefined",
"-Wno-shadow",
"-Wno-undef",
"-Wno-unused-function",
"-Wno-unused-local-typedef",
"-Wno-unused-variable",
],
}),
public_include_directories = [],
public_raw_headers = native.glob([
"caffe2/perfkernels/*.h",
]),
raw_headers = native.glob([
"caffe2/core/*.h",
"caffe2/proto/*.h",
"caffe2/utils/*.h",
], exclude = [
"caffe2/core/macros.h",
]),
reexport_all_header_dependencies = False,
deps = [
":caffe2_proto_ovrsource",
":ovrsource_caffe2_macros.h",
"//third-party/cpuinfo:cpuinfo",
"@fbsource//xplat/caffe2/c10:c10_ovrsource",
"//third-party/protobuf:libprotobuf",
] + select({
"DEFAULT": [],
"ovr_config//cpu:x86_64": [
":perfkernels_avx_ovrsource",
":perfkernels_avx2_ovrsource",
],
}),
)

View File

@ -1,20 +0,0 @@
# @nolint
load("//arvr/tools/build_defs:oxx.bzl", "oxx_static_library", "oxx_test")
load("//arvr/tools/build_defs:oxx_python.bzl", "oxx_python_binary", "oxx_python_library")
load("//arvr/tools/build_defs:genrule_utils.bzl", "gen_cmake_header")
load("//arvr/tools/build_defs:protobuf.bzl", "proto_cxx_library")
load("@bazel_skylib//lib:paths.bzl", "paths")
def define_caffe2_proto():
proto_cxx_library(
name = "caffe2_proto_ovrsource",
protos = [
"caffe2/proto/caffe2.proto",
"caffe2/proto/caffe2_legacy.proto",
"caffe2/proto/hsm.proto",
"caffe2/proto/metanet.proto",
"caffe2/proto/predictor_consts.proto",
"caffe2/proto/prof_dag.proto",
"caffe2/proto/torch.proto",
],
)

View File

@ -1,101 +0,0 @@
# @nolint
load("//arvr/tools/build_defs:oxx.bzl", "oxx_static_library", "oxx_test")
load("//arvr/tools/build_defs:oxx_python.bzl", "oxx_python_binary", "oxx_python_library")
load("//arvr/tools/build_defs:genrule_utils.bzl", "gen_cmake_header")
load("@bazel_skylib//lib:paths.bzl", "paths")
def define_nomnigraph():
oxx_python_binary(
name = "nomnigraph_gen_py_ovrsource",
main_module = "caffe2.core.nomnigraph.op_gen",
deps = [":nomnigraph_gen_py_main_ovrsource"],
)
oxx_python_library(
name = "nomnigraph_gen_py_main_ovrsource",
srcs = native.glob(["caffe2/core/nomnigraph/*.py"]),
base_module = "",
)
nomnigraph_gen_py_cmd = " ".join([
"--install_dir=$OUT",
"--source_def=caffe2/core/nomnigraph/ops.def",
# "--source_def=caffe2/core/nomnigraph/fb/ops.def",
])
native.genrule(
name = "nomnigraph_gen_ovrsource",
srcs = [
# "caffe2/core/nomnigraph/fb/ops.def",
"caffe2/core/nomnigraph/op_gen.py",
"caffe2/core/nomnigraph/ops.def",
],
cmd_exe = "mkdir $OUT && $(exe :nomnigraph_gen_py_ovrsource) " + nomnigraph_gen_py_cmd,
out = "gen",
)
TEST_SRCS = native.glob([
"caffe2/core/nomnigraph/tests/*.cc",
], exclude = [
"caffe2/core/nomnigraph/tests/GraphTest.cc", # fails because debug iterator check
])
oxx_static_library(
name = "nomnigraph_ovrsource",
srcs = [
"caffe2/core/nomnigraph/Representations/NeuralNet.cc",
],
compiler_flags = select({
"ovr_config//compiler:clang": [
"-Wno-undef",
"-Wno-shadow",
"-Wno-macro-redefined",
"-Wno-unused-variable",
"-Wno-unused-local-typedef",
"-Wno-unused-function",
],
"DEFAULT": [],
}),
public_include_directories = ["caffe2/core/nomnigraph/include"],
public_raw_headers = native.glob([
"caffe2/core/nomnigraph/include/**/*.h",
]),
raw_headers = ["caffe2/core/common.h"],
reexport_all_header_dependencies = False,
tests = [
":" + paths.basename(filename)[:-len(".cc")] + "_ovrsource"
for filename in TEST_SRCS
],
deps = [
":ovrsource_caffe2_macros.h",
"@fbsource//xplat/caffe2/c10:c10_ovrsource",
],
)
[
oxx_test(
name = paths.basename(filename)[:-len(".cc")] + "_ovrsource",
srcs = [
filename,
"caffe2/core/nomnigraph/tests/test_util.cc",
],
compiler_flags = select({
"ovr_config//compiler:clang": [
"-Wno-macro-redefined",
"-Wno-shadow",
"-Wno-undef",
"-Wno-unused-variable",
],
"DEFAULT": [],
}),
framework = "gtest",
oncall = "frl_gemini",
raw_headers = native.glob([
"caffe2/core/nomnigraph/tests/*.h",
]),
deps = [
":nomnigraph_ovrsource",
],
)
for filename in TEST_SRCS
]