move build_variables.bzl and ufunc_defs.bzl from pytorch-root/tools/ to the root

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78542

This makes importing easier in different build systems that have
different absolute names for the pytorch-root.

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

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D36782582/)!

Approved by: https://github.com/malfet
This commit is contained in:
Michael Andreas Dagitses
2022-06-02 08:57:03 -07:00
committed by PyTorch MergeBot
parent 5ef378a30f
commit 501d0729cb
8 changed files with 12 additions and 13 deletions

View File

@ -4,11 +4,11 @@ load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library", "cc_test") load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library", "cc_test")
load("//third_party:substitution.bzl", "header_template_rule") load("//third_party:substitution.bzl", "header_template_rule")
load("//:tools/bazel.bzl", "rules") load("//:tools/bazel.bzl", "rules")
load("//:tools/build_variables.bzl", "jit_core_sources", "libtorch_core_sources", "libtorch_cuda_sources", "libtorch_distributed_sources", "libtorch_extra_sources", "libtorch_nvfuser_generated_headers", "libtorch_nvfuser_runtime_sources", "libtorch_python_core_sources", "torch_cpp_srcs", "lazy_tensor_ts_sources")
load("//tools/rules:cu.bzl", "cu_library") load("//tools/rules:cu.bzl", "cu_library")
load("//tools/config:defs.bzl", "if_cuda") load("//tools/config:defs.bzl", "if_cuda")
load("//:aten.bzl", "intern_build_aten_ops", "generate_aten", "aten_ufunc_generated_cpu_sources", "aten_ufunc_generated_cpu_kernel_sources", "aten_ufunc_generated_cuda_sources") load("//:aten.bzl", "intern_build_aten_ops", "generate_aten", "aten_ufunc_generated_cpu_sources", "aten_ufunc_generated_cpu_kernel_sources", "aten_ufunc_generated_cuda_sources")
load(":build.bzl", "define_targets", "GENERATED_AUTOGRAD_CPP", "GENERATED_AUTOGRAD_PYTHON") load(":build.bzl", "define_targets", "GENERATED_AUTOGRAD_CPP", "GENERATED_AUTOGRAD_PYTHON")
load(":build_variables.bzl", "jit_core_sources", "libtorch_core_sources", "libtorch_cuda_sources", "libtorch_distributed_sources", "libtorch_extra_sources", "libtorch_nvfuser_generated_headers", "libtorch_nvfuser_runtime_sources", "libtorch_python_core_sources", "torch_cpp_srcs", "lazy_tensor_ts_sources")
define_targets(rules = rules) define_targets(rules = rules)

View File

@ -1,7 +1,7 @@
load("//tools/build_defs:glob_defs.bzl", "subdir_glob") load("//tools/build_defs:glob_defs.bzl", "subdir_glob")
load("//tools/build_defs:fb_xplat_genrule.bzl", "fb_xplat_genrule") load("//tools/build_defs:fb_xplat_genrule.bzl", "fb_xplat_genrule")
load( load(
"//tools:build_variables.bzl", ":build_variables.bzl",
"aten_cpu_source_list", "aten_cpu_source_list",
"aten_native_source_list", "aten_native_source_list",
"core_sources_common", "core_sources_common",
@ -10,7 +10,7 @@ load(
"libtorch_profiler_sources", "libtorch_profiler_sources",
) )
load( load(
"//:pt_defs.oss.bzl", ":pt_defs.oss.bzl",
"USED_PT_BACKENDS", "USED_PT_BACKENDS",
"build_aten_cpu", "build_aten_cpu",
"gen_aten_files", "gen_aten_files",

View File

@ -4,8 +4,10 @@ include CITATION
include LICENSE include LICENSE
include NOTICE include NOTICE
include .gitmodules include .gitmodules
include build_variables.bzl
include mypy.ini include mypy.ini
include requirements.txt include requirements.txt
include ufunc_defs.bzl
include version.txt include version.txt
recursive-include android *.* recursive-include android *.*
recursive-include aten *.* recursive-include aten *.*

View File

@ -1,6 +1,6 @@
load("@bazel_skylib//lib:paths.bzl", "paths") load("@bazel_skylib//lib:paths.bzl", "paths")
load("@rules_cc//cc:defs.bzl", "cc_library") load("@rules_cc//cc:defs.bzl", "cc_library")
load("//:tools/build_variables.bzl", "aten_ufunc_headers") load(":build_variables.bzl", "aten_ufunc_headers")
CPU_CAPABILITY_NAMES = ["DEFAULT", "AVX2"] CPU_CAPABILITY_NAMES = ["DEFAULT", "AVX2"]
CAPABILITY_COMPILER_FLAGS = { CAPABILITY_COMPILER_FLAGS = {

View File

@ -349,11 +349,11 @@ function(append_filelist name outputvar)
set(_rootdir "${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/") set(_rootdir "${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/")
# configure_file adds its input to the list of CMAKE_RERUN dependencies # configure_file adds its input to the list of CMAKE_RERUN dependencies
configure_file( configure_file(
${PROJECT_SOURCE_DIR}/tools/build_variables.bzl ${PROJECT_SOURCE_DIR}/build_variables.bzl
${PROJECT_BINARY_DIR}/caffe2/build_variables.bzl) ${PROJECT_BINARY_DIR}/caffe2/build_variables.bzl)
execute_process( execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c COMMAND "${PYTHON_EXECUTABLE}" -c
"exec(open('${PROJECT_SOURCE_DIR}/tools/build_variables.bzl').read());print(';'.join(['${_rootdir}' + x for x in ${name}]))" "exec(open('${PROJECT_SOURCE_DIR}/build_variables.bzl').read());print(';'.join(['${_rootdir}' + x for x in ${name}]))"
WORKING_DIRECTORY "${_rootdir}" WORKING_DIRECTORY "${_rootdir}"
RESULT_VARIABLE _retval RESULT_VARIABLE _retval
OUTPUT_VARIABLE _tempvar) OUTPUT_VARIABLE _tempvar)

View File

@ -1,16 +1,13 @@
load("@bazel_skylib//lib:paths.bzl", "paths") load("@bazel_skylib//lib:paths.bzl", "paths")
load("//tools/build_defs:fb_xplat_genrule.bzl", "fb_xplat_genrule")
load("//tools/build_defs:type_defs.bzl", "is_list", "is_string")
load(":build_variables.bzl", "aten_native_source_list")
load( load(
"//tools:build_variables.bzl", ":ufunc_defs.bzl",
"aten_native_source_list",
)
load(
"//tools:ufunc_defs.bzl",
"aten_ufunc_generated_cpu_kernel_sources", "aten_ufunc_generated_cpu_kernel_sources",
"aten_ufunc_generated_cpu_sources", "aten_ufunc_generated_cpu_sources",
"aten_ufunc_generated_cuda_sources", "aten_ufunc_generated_cuda_sources",
) )
load("//tools/build_defs:fb_xplat_genrule.bzl", "fb_xplat_genrule")
load("//tools/build_defs:type_defs.bzl", "is_list", "is_string")
USED_PT_BACKENDS = [ USED_PT_BACKENDS = [
"CPU", "CPU",