diff --git a/.buckconfig.oss b/.buckconfig.oss index 097106924613..a289ddd82a14 100644 --- a/.buckconfig.oss +++ b/.buckconfig.oss @@ -1,5 +1,8 @@ +[pt] + is_oss=1 + [buildfile] -name = BUCK.oss + name = BUCK.oss [repositories] bazel_skylib = third_party/bazel-skylib/ diff --git a/BUCK.oss b/BUCK.oss index 1a1c21e51a50..3e275b4bd5cd 100644 --- a/BUCK.oss +++ b/BUCK.oss @@ -23,6 +23,11 @@ load( "aten_ufunc_generated_all_cpu_sources", "TEMPLATE_SOURCE_LIST", ) +load(":buckbuild.bzl", + "define_buck_targets", +) + +define_buck_targets() cxx_library( name = "pthreadpool", @@ -85,67 +90,23 @@ cxx_library( visibility = ['PUBLIC'], ) -cxx_library( - name = "aten_header", - header_namespace = "", - exported_headers = subdir_glob([ - # ATen Core - ("aten/src", "ATen/core/**/*.h"), - ("aten/src", "ATen/ops/*.h"), - # ATen Base - ("aten/src", "ATen/*.h"), - ("aten/src", "ATen/cpu/**/*.h"), - ("aten/src", "ATen/detail/*.h"), - ("aten/src", "ATen/quantized/*.h"), - ("aten/src", "ATen/vulkan/*.h"), - ("aten/src", "ATen/metal/*.h"), - ("aten/src", "ATen/mps/*.h"), - ("aten/src", "ATen/nnapi/*.h"), - # ATen Native - ("aten/src", "ATen/native/*.h"), - ("aten/src", "ATen/native/ao_sparse/quantized/cpu/*.h"), - ("aten/src", "ATen/native/cpu/**/*.h"), - ("aten/src", "ATen/native/sparse/*.h"), - ("aten/src", "ATen/native/mps/*.h"), - ("aten/src", "ATen/native/nested/*.h"), - ("aten/src", "ATen/native/quantized/*.h"), - ("aten/src", "ATen/native/quantized/cpu/*.h"), - ("aten/src", "ATen/native/transformers/*.h"), - ("aten/src", "ATen/native/ufunc/*.h"), - ("aten/src", "ATen/native/utils/*.h"), - ("aten/src", "ATen/native/vulkan/ops/*.h"), - ("aten/src", "ATen/native/xnnpack/*.h"), - # Remove the following after modifying codegen for mobile. - ("aten/src", "ATen/mkl/*.h"), - ("aten/src", "ATen/native/mkl/*.h"), - ("aten/src", "ATen/native/mkldnn/*.h"), - ], exclude = ["aten/src/ATen/Config.h"]), - visibility = ["PUBLIC"], -) - -cxx_library( - name = "jit_core_headers", - header_namespace = "", - exported_headers = subdir_glob([("", x) for x in jit_core_headers]), -) - -cxx_library( - name = "generated_aten_config_header", - header_namespace = "ATen", - exported_headers = { - "Config.h": ":generate_aten_config[Config.h]", - }, -) - -cxx_library( - name = "torch_mobile_headers", - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "torch/csrc/jit/mobile/*.h"), - ], - ), - visibility = ["PUBLIC"], +build_aten_cpu( + name = "aten_cpu", + srcs = jit_core_sources + + aten_cpu_source_list + [ + # Generated + ":gen_aten[Functions.cpp]", + ":gen_aten[Operators_0.cpp]", + ":gen_aten[Operators_1.cpp]", + ":gen_aten[Operators_2.cpp]", + ":gen_aten[Operators_3.cpp]", + ":gen_aten[Operators_4.cpp]", + ":gen_aten[core/ATenOpList.cpp]", + ":gen_aten[core/TensorMethods.cpp]", + ] + [ + # Needed by ATen/native/EmbeddingBag.cpp + "caffe2/perfkernels/embedding_lookup_idx.cc", + ], ) fb_xplat_genrule( @@ -169,7 +130,7 @@ fb_xplat_genrule( "-e 's/@AT_BUILD_WITH_LAPACK@/USE_LAPACK_FBXPLAT/g'", "-e 's/@AT_BLAS_F2C@/AT_BLAS_F2C_FBXPLAT/g'", "-e 's/@AT_BLAS_USE_CBLAS_DOT@/AT_BLAS_USE_CBLAS_DOT_FBXPLAT/g'", - "aten/src/ATen/Config.h.in > $OUT/Config.h" + "aten/src/ATen/Config.h.in > $OUT/Config.h", ]), outs = { "Config.h": ["Config.h"], @@ -206,56 +167,8 @@ cxx_library( header_namespace = "ATen", exported_headers = ATEN_EXPORTED_HEADERS, ) - -filegroup( - name = "aten_src_path", - srcs = [ - "aten/src/ATen/native/native_functions.yaml", - "aten/src/ATen/native/tags.yaml", - ] + glob(["aten/src/ATen/templates/*"]), - visibility = [ - "PUBLIC", - ], -) - -build_aten_cpu( - name = "aten_cpu", - srcs = jit_core_sources + - aten_cpu_source_list + [ - # Generated - ":gen_aten[Functions.cpp]", - ":gen_aten[Operators_0.cpp]", - ":gen_aten[Operators_1.cpp]", - ":gen_aten[Operators_2.cpp]", - ":gen_aten[Operators_3.cpp]", - ":gen_aten[Operators_4.cpp]", - ":gen_aten[core/ATenOpList.cpp]", - ":gen_aten[core/TensorMethods.cpp]", - ] + [ - # Needed by ATen/native/EmbeddingBag.cpp - "caffe2/perfkernels/embedding_lookup_idx.cc", - ], -) - gen_aten_libtorch_files(name = "gen_aten_libtorch") - -GENERATED_AUTOGRAD_H = { - "Functions.h": ":gen_aten_libtorch[autograd/generated/Functions.h]", - "VariableType.h": ":gen_aten_libtorch[autograd/generated/VariableType.h]", - "variable_factories.h": ":gen_aten_libtorch[autograd/generated/variable_factories.h]", - - # Don't build python bindings on mobile. - #"python_functions.h", -} - -cxx_library( - name = "generated-autograd-headers", - header_namespace = "torch/csrc/autograd/generated", - exported_headers = GENERATED_AUTOGRAD_H, - visibility = ["PUBLIC"], -) - cxx_library( name = "torch_mobile_observer", srcs = [ @@ -276,63 +189,13 @@ cxx_library( ], ) -fb_xplat_genrule( - name = "generate-version-header", - srcs = [ - "torch/csrc/api/include/torch/version.h.in", - "version.txt", - ], - cmd = "$(exe //tools/setup_helpers:gen-version-header) " + " ".join([ - "--template-path", - "torch/csrc/api/include/torch/version.h.in", - "--version-path", - "version.txt", - "--output-path", - "$OUT/version.h", +python_library( + name = "aten_code_template", + srcs = subdir_glob([ + ("aten", "src/ATen/code_template.py"), ]), - outs = { - "version.h": ["version.h"], - }, - default_outs = ["."], -) - -cxx_library( - name = "generated-version-header", - header_namespace = "torch", - exported_headers = { - "version.h": ":generate-version-header[version.h]", - }, -) - -cxx_library( - name = "torch_headers", - header_namespace = "", - exported_headers = subdir_glob( - [ - ("torch/csrc/api/include", "torch/**/*.h"), - ("", "torch/csrc/**/*.h"), - ("", "torch/csrc/generic/*.cpp"), - ("", "torch/script.h"), - ("", "torch/library.h"), - ("", "torch/custom_class.h"), - ("", "torch/custom_class_detail.h"), - # Add again due to namespace difference from aten_header. - ("", "aten/src/ATen/*.h"), - ("", "aten/src/ATen/quantized/*.h"), - ], - exclude = [ - # Don't need on mobile. - "torch/csrc/Exceptions.h", - "torch/csrc/python_headers.h", - "torch/csrc/utils/auto_gil.h", - "torch/csrc/jit/serialization/mobile_bytecode_generated.h", - "torch/csrc/api/include/torch/version.h", - ], - ), + base_module = "", visibility = ["PUBLIC"], - deps = [ - ":generated-version-header", - ], ) @@ -541,6 +404,17 @@ python_library( ], ) +python_binary( + name = "gen_aten_bin", + main_module = "torchgen.gen", + visibility = [ + "PUBLIC", + ], + deps = [ + "//torchgen:torchgen", + ], +) + python_binary( name = "gen_operators_yaml", main_module = "gen_operators_yaml", diff --git a/buckbuild.bzl b/buckbuild.bzl new file mode 100644 index 000000000000..9150061912c8 --- /dev/null +++ b/buckbuild.bzl @@ -0,0 +1,242 @@ +load("//tools/build_defs:expect.bzl", "expect") + +# NOTE: This file is shared by internal and OSS BUCK build. +# These load paths point to different files in internal and OSS environment +load("//tools/build_defs:fb_native_wrapper.bzl", "fb_native") +load("//tools/build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library") +load("//tools/build_defs:glob_defs.bzl", "subdir_glob") +load( + ":build_variables.bzl", + "jit_core_headers", +) + +def read_bool(section, field, default): + # @lint-ignore BUCKRESTRICTEDSYNTAX + value = read_config(section, field) + if value == None: + return default + expect( + value == "0" or value == "1", + "{}.{} == \"{}\", wanted \"0\" or \"1\".".format(section, field, value), + ) + return bool(int(value)) + +def is_oss_build(): + return read_bool("pt", "is_oss", False) + +# for targets in caffe2 root path +ROOT_NAME = "//" if is_oss_build() else "//xplat/caffe2" + +# for targets in subfolders +ROOT_PATH = "//" if is_oss_build() else "//xplat/caffe2/" + +# these targets are shared by internal and OSS BUCK +def define_buck_targets( + feature = None, + labels = []): + fb_xplat_cxx_library( + name = "th_header", + header_namespace = "", + exported_headers = subdir_glob([ + # TH + ("aten/src", "TH/*.h"), + ("aten/src", "TH/*.hpp"), + ("aten/src", "TH/generic/*.h"), + ("aten/src", "TH/generic/*.hpp"), + ("aten/src", "TH/generic/simd/*.h"), + ("aten/src", "TH/vector/*.h"), + ("aten/src", "TH/generic/*.c"), + ("aten/src", "TH/generic/*.cpp"), + ("aten/src/TH", "*.h"), # for #include + # THNN + ("aten/src", "THNN/*.h"), + ("aten/src", "THNN/generic/*.h"), + ("aten/src", "THNN/generic/*.c"), + ]), + feature = feature, + labels = labels, + ) + + fb_xplat_cxx_library( + name = "aten_header", + header_namespace = "", + exported_headers = subdir_glob([ + # ATen Core + ("aten/src", "ATen/core/**/*.h"), + ("aten/src", "ATen/ops/*.h"), + # ATen Base + ("aten/src", "ATen/*.h"), + ("aten/src", "ATen/cpu/**/*.h"), + ("aten/src", "ATen/detail/*.h"), + ("aten/src", "ATen/quantized/*.h"), + ("aten/src", "ATen/vulkan/*.h"), + ("aten/src", "ATen/metal/*.h"), + ("aten/src", "ATen/nnapi/*.h"), + # ATen Native + ("aten/src", "ATen/native/*.h"), + ("aten/src", "ATen/native/ao_sparse/quantized/cpu/*.h"), + ("aten/src", "ATen/native/cpu/**/*.h"), + ("aten/src", "ATen/native/sparse/*.h"), + ("aten/src", "ATen/native/nested/*.h"), + ("aten/src", "ATen/native/quantized/*.h"), + ("aten/src", "ATen/native/quantized/cpu/*.h"), + ("aten/src", "ATen/native/transformers/*.h"), + ("aten/src", "ATen/native/ufunc/*.h"), + ("aten/src", "ATen/native/utils/*.h"), + ("aten/src", "ATen/native/vulkan/ops/*.h"), + ("aten/src", "ATen/native/xnnpack/*.h"), + ("aten/src", "ATen/mps/*.h"), + ("aten/src", "ATen/native/mps/*.h"), + # Remove the following after modifying codegen for mobile. + ("aten/src", "ATen/mkl/*.h"), + ("aten/src", "ATen/native/mkl/*.h"), + ("aten/src", "ATen/native/mkldnn/*.h"), + ]), + visibility = ["PUBLIC"], + feature = feature, + labels = labels, + ) + + fb_xplat_cxx_library( + name = "aten_vulkan_header", + header_namespace = "", + exported_headers = subdir_glob([ + ("aten/src", "ATen/native/vulkan/*.h"), + ("aten/src", "ATen/native/vulkan/api/*.h"), + ("aten/src", "ATen/native/vulkan/ops/*.h"), + ("aten/src", "ATen/vulkan/*.h"), + ]), + feature = feature, + labels = labels, + visibility = ["PUBLIC"], + ) + + fb_xplat_cxx_library( + name = "jit_core_headers", + header_namespace = "", + exported_headers = subdir_glob([("", x) for x in jit_core_headers]), + feature = feature, + labels = labels, + ) + + fb_xplat_cxx_library( + name = "torch_headers", + header_namespace = "", + exported_headers = subdir_glob( + [ + ("torch/csrc/api/include", "torch/**/*.h"), + ("", "torch/csrc/**/*.h"), + ("", "torch/csrc/generic/*.cpp"), + ("", "torch/script.h"), + ("", "torch/library.h"), + ("", "torch/custom_class.h"), + ("", "torch/custom_class_detail.h"), + # Add again due to namespace difference from aten_header. + ("", "aten/src/ATen/*.h"), + ("", "aten/src/ATen/quantized/*.h"), + ], + exclude = [ + # Don't need on mobile. + "torch/csrc/Exceptions.h", + "torch/csrc/python_headers.h", + "torch/csrc/utils/auto_gil.h", + "torch/csrc/jit/serialization/mobile_bytecode_generated.h", + ], + ), + feature = feature, + labels = labels, + visibility = ["PUBLIC"], + deps = [ + ":generated-version-header", + ], + ) + + fb_xplat_cxx_library( + name = "aten_test_header", + header_namespace = "", + exported_headers = subdir_glob([ + ("aten/src", "ATen/test/*.h"), + ]), + ) + + fb_xplat_cxx_library( + name = "torch_mobile_headers", + header_namespace = "", + exported_headers = subdir_glob( + [ + ("", "torch/csrc/jit/mobile/*.h"), + ], + ), + feature = feature, + labels = labels, + visibility = ["PUBLIC"], + ) + + fb_xplat_cxx_library( + name = "generated_aten_config_header", + header_namespace = "ATen", + exported_headers = { + "Config.h": ":generate_aten_config[Config.h]", + }, + feature = feature, + labels = labels, + ) + + fb_xplat_cxx_library( + name = "generated-autograd-headers", + header_namespace = "torch/csrc/autograd/generated", + exported_headers = { + "Functions.h": ":gen_aten_libtorch[autograd/generated/Functions.h]", + "VariableType.h": ":gen_aten_libtorch[autograd/generated/VariableType.h]", + "variable_factories.h": ":gen_aten_libtorch[autograd/generated/variable_factories.h]", + # Don't build python bindings on mobile. + #"python_functions.h", + }, + feature = feature, + labels = labels, + visibility = ["PUBLIC"], + ) + + fb_xplat_cxx_library( + name = "generated-version-header", + header_namespace = "torch", + exported_headers = { + "version.h": ":generate-version-header[version.h]", + }, + feature = feature, + labels = labels, + ) + + # @lint-ignore BUCKLINT + fb_native.genrule( + name = "generate-version-header", + srcs = [ + "torch/csrc/api/include/torch/version.h.in", + "version.txt", + ], + cmd = "$(exe {}tools/setup_helpers:gen-version-header) ".format(ROOT_PATH) + " ".join([ + "--template-path", + "torch/csrc/api/include/torch/version.h.in", + "--version-path", + "version.txt", + "--output-path", + "$OUT/version.h", + ]), + outs = { + "version.h": ["version.h"], + }, + default_outs = ["."], + ) + + # @lint-ignore BUCKLINT + fb_native.filegroup( + name = "aten_src_path", + srcs = [ + "aten/src/ATen/native/native_functions.yaml", + "aten/src/ATen/native/tags.yaml", + # @lint-ignore BUCKRESTRICTEDSYNTAX + ] + glob(["aten/src/ATen/templates/*"]), + visibility = [ + "PUBLIC", + ], + ) diff --git a/tools/build_defs/buck_helpers.bzl b/tools/build_defs/buck_helpers.bzl new file mode 100644 index 000000000000..c946f87eba06 --- /dev/null +++ b/tools/build_defs/buck_helpers.bzl @@ -0,0 +1,73 @@ +# Only used for PyTorch open source BUCK build + +IGNORED_ATTRIBUTE_PREFIX = [ + "apple", + "fbobjc", + "windows", + "fbandroid", + "macosx", +] + +IGNORED_ATTRIBUTES = [ + "feature", + "platforms", +] + +def filter_attributes(kwgs): + keys = list(kwgs.keys()) + + # drop unncessary attributes + for key in keys: + if key in IGNORED_ATTRIBUTES: + kwgs.pop(key) + else: + for invalid_prefix in IGNORED_ATTRIBUTE_PREFIX: + if key.startswith(invalid_prefix): + kwgs.pop(key) + return kwgs + +# maps known fbsource deps to OSS deps +DEPS_MAP = { + "//third-party/FP16:FP16": "//third_party:FP16", + "//third-party/FXdiv:FXdiv": "//third_party:FXdiv", + "//third-party/XNNPACK:XNNPACK": "//third_party:XNNPACK", + "//third-party/clog:clog": "//third_party:clog", + "//third-party/cpuinfo:cpuinfo": "//third_party:cpuinfo", + "//third-party/fmt:fmt": "//third_party:fmt", + "//third-party/glog:glog": "//third_party:glog", + "//third-party/psimd:psimd": "//third_party:psimd", + "//third-party/pthreadpool:pthreadpool": "//third_party:pthreadpool", + "//third-party/pthreadpool:pthreadpool_header": "//third_party:pthreadpool_header", + "//third-party/ruy:ruy_xplat_lib": "//third_party:ruy_lib", +} + +# map fbsource deps to OSS deps +def to_oss_deps(deps = []): + new_deps = [] + for dep in deps: + new_deps += map_deps(dep) + return new_deps + +def map_deps(dep): + # remove @fbsource prefix + if dep.startswith("@fbsource"): + dep = dep[len("@fbsource"):] + + # ignore all fbsource linker_lib targets + if dep.startswith("//xplat/third-party/linker_lib"): + return [] + + # map targets in caffe2 root folder. Just use relative path + if dep.startswith("//xplat/caffe2:"): + return [dep[len("//xplat/caffe2"):]] + + # map targets in caffe2 subfolders + if dep.startswith("//xplat/caffe2/"): + return ["//" + dep[len("//xplat/caffe2/"):]] + + # map other known targets + if dep in DEPS_MAP: + return DEPS_MAP[dep] + + # drop other unknown deps + return [] diff --git a/tools/build_defs/default_platform_defs.bzl b/tools/build_defs/default_platform_defs.bzl new file mode 100644 index 000000000000..643789e8d0b0 --- /dev/null +++ b/tools/build_defs/default_platform_defs.bzl @@ -0,0 +1,18 @@ +# Only used for PyTorch open source BUCK build +# @lint-ignore-every BUCKRESTRICTEDSYNTAX + +def compose_platform_setting_list(settings): + """Settings object: + os/cpu pair: should be valid key, or at most one part can be wildcard. + flags: the values added to the compiler flags + """ + if read_config("pt", "is_oss", "0") == "0": + fail("This file is for open source pytorch build. Do not use it in fbsource!") + + result = [] + for setting in settings: + result.append([ + "^{}-{}$".format(setting["os"], setting["cpu"]), + setting["flags"], + ]) + return result diff --git a/tools/build_defs/expect.bzl b/tools/build_defs/expect.bzl new file mode 100644 index 000000000000..b298b40b7705 --- /dev/null +++ b/tools/build_defs/expect.bzl @@ -0,0 +1,5 @@ +# Only used for PyTorch open source BUCK build + +def expect(condition, message = None): + if not condition: + fail(message) diff --git a/tools/build_defs/fb_native_wrapper.bzl b/tools/build_defs/fb_native_wrapper.bzl new file mode 100644 index 000000000000..7d4ca06b2161 --- /dev/null +++ b/tools/build_defs/fb_native_wrapper.bzl @@ -0,0 +1,22 @@ +# Only used for PyTorch open source BUCK build +# @lint-ignore-every BUCKRESTRICTEDSYNTAX +def _genrule(default_outs = ["."], **kwargs): + if read_config("pt", "is_oss", "0") == "0": + fail("This file is for open source pytorch build. Do not use it in fbsource!") + + genrule( + # default_outs is only needed for internal BUCK + **kwargs + ) + +def _read_config(**kwargs): + read_config(**kwargs) + +def _filegroup(**kwargs): + filegroup(**kwargs) + +fb_native = struct( + genrule = _genrule, + read_config = _read_config, + filegroup = _filegroup, +) diff --git a/tools/build_defs/fb_python_binary.bzl b/tools/build_defs/fb_python_binary.bzl new file mode 100644 index 000000000000..f403b4bbbda6 --- /dev/null +++ b/tools/build_defs/fb_python_binary.bzl @@ -0,0 +1,10 @@ +# Only used for PyTorch open source BUCK build +# @lint-ignore-every BUCKRESTRICTEDSYNTAX + +load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") + +def fb_python_binary(**kwgs): + if read_config("pt", "is_oss", "0") == "0": + fail("This file is for open source pytorch build. Do not use it in fbsource!") + + python_binary(**kwgs) diff --git a/tools/build_defs/fb_xplat_cxx_library.bzl b/tools/build_defs/fb_xplat_cxx_library.bzl new file mode 100644 index 000000000000..785983606213 --- /dev/null +++ b/tools/build_defs/fb_xplat_cxx_library.bzl @@ -0,0 +1,19 @@ +# Only used for PyTorch open source BUCK build +# @lint-ignore-every BUCKRESTRICTEDSYNTAX + +load(":buck_helpers.bzl", "filter_attributes", "to_oss_deps") + +def fb_xplat_cxx_library( + name, + deps = [], + exported_deps = [], + **kwgs): + if read_config("pt", "is_oss", "0") == "0": + fail("This file is for open source pytorch build. Do not use it in fbsource!") + + cxx_library( + name = name, + deps = to_oss_deps(deps), + exported_deps = to_oss_deps(exported_deps), + **filter_attributes(kwgs) + ) diff --git a/tools/build_defs/fb_xplat_genrule.bzl b/tools/build_defs/fb_xplat_genrule.bzl index ddc19b2373e9..8d61967cdb41 100644 --- a/tools/build_defs/fb_xplat_genrule.bzl +++ b/tools/build_defs/fb_xplat_genrule.bzl @@ -1,4 +1,10 @@ +# Only used for PyTorch open source BUCK build +# @lint-ignore-every BUCKRESTRICTEDSYNTAX + def fb_xplat_genrule(default_outs = ["."], **kwargs): + if read_config("pt", "is_oss", "0") == "0": + fail("This file is for open source pytorch build. Do not use it in fbsource!") + genrule( # default_outs=default_outs, # only needed for internal BUCK **kwargs diff --git a/tools/build_defs/fbsource_utils.bzl b/tools/build_defs/fbsource_utils.bzl new file mode 100644 index 000000000000..0cbfd63304d1 --- /dev/null +++ b/tools/build_defs/fbsource_utils.bzl @@ -0,0 +1,8 @@ +# Only used for PyTorch open source BUCK build +# @lint-ignore-every BUCKRESTRICTEDSYNTAX + +def is_arvr_mode(): + if read_config("pt", "is_oss", "0") == "0": + fail("This file is for open source pytorch build. Do not use it in fbsource!") + + return False diff --git a/tools/build_defs/glob_defs.bzl b/tools/build_defs/glob_defs.bzl index a0eea247e839..2fad1bc518d2 100644 --- a/tools/build_defs/glob_defs.bzl +++ b/tools/build_defs/glob_defs.bzl @@ -1,3 +1,5 @@ +# Only used for PyTorch open source BUCK build + """Provides utility macros for working with globs.""" load("@bazel_skylib//lib:paths.bzl", "paths") diff --git a/tools/build_defs/platform_defs.bzl b/tools/build_defs/platform_defs.bzl new file mode 100644 index 000000000000..04d6c2dd4e33 --- /dev/null +++ b/tools/build_defs/platform_defs.bzl @@ -0,0 +1,38 @@ +# Only used for PyTorch open source BUCK build + +CXX = "Default" + +ANDROID = "Android" + +APPLE = "Apple" + +FBCODE = "Fbcode" + +WINDOWS = "Windows" + +UNIFIED = "Unified" + +# Apple SDK Definitions +IOS = "ios" + +WATCHOS = "watchos" + +MACOSX = "macosx" + +APPLETVOS = "appletvos" + +xplat_platforms = struct( + ANDROID = ANDROID, + APPLE = APPLE, + CXX = CXX, + FBCODE = FBCODE, + WINDOWS = WINDOWS, + UNIFIED = UNIFIED, +) + +apple_sdks = struct( + IOS = IOS, + WATCHOS = WATCHOS, + MACOSX = MACOSX, + APPLETVOS = APPLETVOS, +) diff --git a/tools/build_defs/type_defs.bzl b/tools/build_defs/type_defs.bzl index afc02702e8ad..7a905e7d6cc0 100644 --- a/tools/build_defs/type_defs.bzl +++ b/tools/build_defs/type_defs.bzl @@ -1,3 +1,5 @@ +# Only used for PyTorch open source BUCK build + """Provides macros for queries type information.""" _SELECT_TYPE = type(select({"DEFAULT": []}))