Add a new flag that's always true for all oss build.
Switch to use this flag instead of if_static/framework_shared_object, as this was misleading. The choice of using cuda stubs is independent of monolithic build. This change also make windows pip package switch to use cuda stubs. PiperOrigin-RevId: 260215104
This commit is contained in:
parent
5fb3a694ed
commit
8032b46d3f
4
.bazelrc
4
.bazelrc
@ -30,6 +30,10 @@ build:monolithic --define framework_shared_object=false
|
|||||||
# opts in to modular op registration support by default.
|
# opts in to modular op registration support by default.
|
||||||
build --define framework_shared_object=true
|
build --define framework_shared_object=true
|
||||||
|
|
||||||
|
# Flags for open source build, always set to be true.
|
||||||
|
build --define open_source_build=true
|
||||||
|
test --define open_source_build=true
|
||||||
|
|
||||||
# Please note that MKL on MacOS or windows is still not supported.
|
# Please note that MKL on MacOS or windows is still not supported.
|
||||||
# If you would like to use a local MKL instead of downloading, please set the
|
# If you would like to use a local MKL instead of downloading, please set the
|
||||||
# environment variable "TF_MKL_ROOT" every time before build.
|
# environment variable "TF_MKL_ROOT" every time before build.
|
||||||
|
@ -356,11 +356,20 @@ config_setting(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Flag to indicate open source build, .bazelrc always has it set to be true
|
||||||
config_setting(
|
config_setting(
|
||||||
name = "using_cuda_clang_with_dynamic_build",
|
name = "oss",
|
||||||
|
define_values = {
|
||||||
|
"open_source_build": "true",
|
||||||
|
},
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
config_setting(
|
||||||
|
name = "build_oss_using_cuda_clang",
|
||||||
define_values = {
|
define_values = {
|
||||||
"using_cuda_clang": "true",
|
"using_cuda_clang": "true",
|
||||||
"framework_shared_object": "true",
|
"open_source_build": "true",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -381,10 +390,10 @@ config_setting(
|
|||||||
)
|
)
|
||||||
|
|
||||||
config_setting(
|
config_setting(
|
||||||
name = "using_cuda_nvcc_with_dynamic_build",
|
name = "build_oss_using_cuda_nvcc",
|
||||||
define_values = {
|
define_values = {
|
||||||
"using_cuda_nvcc": "true",
|
"using_cuda_nvcc": "true",
|
||||||
"framework_shared_object": "true",
|
"open_source_build": "true",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
load("//tensorflow/compiler/xla:xla.bzl", "xla_proto_library")
|
load("//tensorflow/compiler/xla:xla.bzl", "xla_proto_library")
|
||||||
load(
|
load(
|
||||||
"//tensorflow/core:platform/default/build_config_root.bzl",
|
"//tensorflow/core:platform/default/build_config_root.bzl",
|
||||||
"if_static",
|
|
||||||
"tf_cuda_tests_tags",
|
"tf_cuda_tests_tags",
|
||||||
)
|
)
|
||||||
load("//tensorflow:tensorflow.bzl", "tf_cc_test", "tf_copts", "tf_cuda_library")
|
load("//tensorflow:tensorflow.bzl", "tf_cc_test", "tf_copts", "tf_cuda_library")
|
||||||
@ -703,10 +702,8 @@ cc_library(
|
|||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
"//tensorflow/core:stream_executor_no_cuda",
|
"//tensorflow/core:stream_executor_no_cuda",
|
||||||
"//tensorflow/stream_executor:blas",
|
"//tensorflow/stream_executor:blas",
|
||||||
] + if_static(
|
"//tensorflow/stream_executor/cuda:cusolver_lib",
|
||||||
["@local_config_cuda//cuda:cusolver"],
|
],
|
||||||
["//tensorflow/stream_executor/cuda:cusolver_stub"],
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
|
@ -29,7 +29,6 @@ load(
|
|||||||
)
|
)
|
||||||
load(
|
load(
|
||||||
"//tensorflow/core:platform/default/build_config_root.bzl",
|
"//tensorflow/core:platform/default/build_config_root.bzl",
|
||||||
"if_static",
|
|
||||||
"tf_cuda_tests_tags",
|
"tf_cuda_tests_tags",
|
||||||
)
|
)
|
||||||
load(
|
load(
|
||||||
@ -3296,16 +3295,9 @@ tf_kernel_library(
|
|||||||
"//tensorflow/core:framework",
|
"//tensorflow/core:framework",
|
||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
"//tensorflow/core/platform/default/build_config:cublas_plugin",
|
"//tensorflow/core/platform/default/build_config:cublas_plugin",
|
||||||
] + if_static(
|
"//tensorflow/stream_executor/cuda:cublas_lib",
|
||||||
[
|
"//tensorflow/stream_executor/cuda:cusolver_lib",
|
||||||
"@local_config_cuda//cuda:cusolver",
|
],
|
||||||
"@local_config_cuda//cuda:cublas",
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"//tensorflow/stream_executor/cuda:cusolver_stub",
|
|
||||||
"//tensorflow/stream_executor/cuda:cublas_stub",
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
tf_kernel_library(
|
tf_kernel_library(
|
||||||
@ -3315,10 +3307,8 @@ tf_kernel_library(
|
|||||||
deps = [
|
deps = [
|
||||||
"//tensorflow/core:framework",
|
"//tensorflow/core:framework",
|
||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
] + if_static(
|
"//tensorflow/stream_executor/cuda:cusparse_lib",
|
||||||
["@local_config_cuda//cuda:cusparse"],
|
],
|
||||||
["//tensorflow/stream_executor/cuda:cusparse_stub"],
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
LINALG_DEPS = [
|
LINALG_DEPS = [
|
||||||
|
@ -54,8 +54,8 @@ tf_cuda_library(
|
|||||||
}) + select({
|
}) + select({
|
||||||
"//tensorflow:using_cuda_clang": ["//tensorflow/stream_executor/cuda:all_runtime"],
|
"//tensorflow:using_cuda_clang": ["//tensorflow/stream_executor/cuda:all_runtime"],
|
||||||
"//tensorflow:using_cuda_nvcc": ["//tensorflow/stream_executor/cuda:all_runtime"],
|
"//tensorflow:using_cuda_nvcc": ["//tensorflow/stream_executor/cuda:all_runtime"],
|
||||||
"//tensorflow:using_cuda_clang_with_dynamic_build": [],
|
"//tensorflow:build_oss_using_cuda_clang": [],
|
||||||
"//tensorflow:using_cuda_nvcc_with_dynamic_build": [],
|
"//tensorflow:build_oss_using_cuda_nvcc": [],
|
||||||
"//tensorflow:using_rocm_hipcc": ["//tensorflow/stream_executor/rocm:all_runtime"],
|
"//tensorflow:using_rocm_hipcc": ["//tensorflow/stream_executor/rocm:all_runtime"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
|
@ -16,7 +16,6 @@ load(
|
|||||||
)
|
)
|
||||||
load(
|
load(
|
||||||
"//tensorflow/core:platform/default/build_config_root.bzl",
|
"//tensorflow/core:platform/default/build_config_root.bzl",
|
||||||
"if_static",
|
|
||||||
"tf_cuda_tests_tags",
|
"tf_cuda_tests_tags",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -139,8 +138,8 @@ cc_library(
|
|||||||
"//tensorflow/stream_executor/platform:dso_loader",
|
"//tensorflow/stream_executor/platform:dso_loader",
|
||||||
] + tf_additional_cuda_driver_deps()) + select({
|
] + tf_additional_cuda_driver_deps()) + select({
|
||||||
# include dynamic loading implementation only when if_cuda_is_configured and build dynamically
|
# include dynamic loading implementation only when if_cuda_is_configured and build dynamically
|
||||||
"//tensorflow:using_cuda_nvcc_with_dynamic_build": ["cudart_stub"],
|
"//tensorflow:build_oss_using_cuda_nvcc": ["cudart_stub"],
|
||||||
"//tensorflow:using_cuda_clang_with_dynamic_build": ["cudart_stub"],
|
"//tensorflow:build_oss_using_cuda_clang": ["cudart_stub"],
|
||||||
"//conditions:default": ["//tensorflow/core:cuda"],
|
"//conditions:default": ["//tensorflow/core:cuda"],
|
||||||
}) + [
|
}) + [
|
||||||
"@com_google_absl//absl/base:core_headers",
|
"@com_google_absl//absl/base:core_headers",
|
||||||
@ -154,20 +153,20 @@ cc_library(
|
|||||||
name = "cudart_stub",
|
name = "cudart_stub",
|
||||||
srcs = select({
|
srcs = select({
|
||||||
# include dynamic loading implementation only when if_cuda_is_configured and build dynamically
|
# include dynamic loading implementation only when if_cuda_is_configured and build dynamically
|
||||||
"//tensorflow:using_cuda_nvcc_with_dynamic_build": ["cudart_stub.cc"],
|
"//tensorflow:build_oss_using_cuda_nvcc": ["cudart_stub.cc"],
|
||||||
"//tensorflow:using_cuda_clang_with_dynamic_build": ["cudart_stub.cc"],
|
"//tensorflow:build_oss_using_cuda_clang": ["cudart_stub.cc"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
textual_hdrs = glob(["cuda_runtime_*.inc"]),
|
textual_hdrs = glob(["cuda_runtime_*.inc"]),
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = select({
|
deps = select({
|
||||||
"//tensorflow:using_cuda_nvcc_with_dynamic_build": [
|
"//tensorflow:build_oss_using_cuda_nvcc": [
|
||||||
":cuda_stub",
|
":cuda_stub",
|
||||||
"@local_config_cuda//cuda:cuda_headers",
|
"@local_config_cuda//cuda:cuda_headers",
|
||||||
"//tensorflow/stream_executor/lib",
|
"//tensorflow/stream_executor/lib",
|
||||||
"//tensorflow/stream_executor/platform:dso_loader",
|
"//tensorflow/stream_executor/platform:dso_loader",
|
||||||
],
|
],
|
||||||
"//tensorflow:using_cuda_clang_with_dynamic_build": [
|
"//tensorflow:build_oss_using_cuda_clang": [
|
||||||
":cuda_stub",
|
":cuda_stub",
|
||||||
"@local_config_cuda//cuda:cuda_headers",
|
"@local_config_cuda//cuda:cuda_headers",
|
||||||
"//tensorflow/stream_executor/lib",
|
"//tensorflow/stream_executor/lib",
|
||||||
@ -232,11 +231,11 @@ cc_library(
|
|||||||
|
|
||||||
alias(
|
alias(
|
||||||
name = "cublas_lib",
|
name = "cublas_lib",
|
||||||
actual = if_static(
|
actual = select({
|
||||||
"@local_config_cuda//cuda:cublas",
|
"//tensorflow:oss": ":cublas_stub",
|
||||||
":cublas_stub",
|
"//conditions:default": "@local_config_cuda//cuda:cublas",
|
||||||
),
|
}),
|
||||||
visibility = ["//visibility:private"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
@ -288,11 +287,11 @@ cc_library(
|
|||||||
|
|
||||||
alias(
|
alias(
|
||||||
name = "cufft_lib",
|
name = "cufft_lib",
|
||||||
actual = if_static(
|
actual = select({
|
||||||
"@local_config_cuda//cuda:cufft",
|
"//tensorflow:oss": ":cufft_stub",
|
||||||
":cufft_stub",
|
"//conditions:default": "@local_config_cuda//cuda:cufft",
|
||||||
),
|
}),
|
||||||
visibility = ["//visibility:private"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
@ -333,11 +332,11 @@ cc_library(
|
|||||||
|
|
||||||
alias(
|
alias(
|
||||||
name = "cudnn_lib",
|
name = "cudnn_lib",
|
||||||
actual = if_static(
|
actual = select({
|
||||||
"@local_config_cuda//cuda:cudnn",
|
"//tensorflow:oss": ":cudnn_stub",
|
||||||
":cudnn_stub",
|
"//conditions:default": "@local_config_cuda//cuda:cudnn",
|
||||||
),
|
}),
|
||||||
visibility = ["//visibility:private"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
@ -386,11 +385,11 @@ cc_library(
|
|||||||
|
|
||||||
alias(
|
alias(
|
||||||
name = "curand_lib",
|
name = "curand_lib",
|
||||||
actual = if_static(
|
actual = select({
|
||||||
"@local_config_cuda//cuda:curand",
|
"//tensorflow:oss": ":curand_stub",
|
||||||
":curand_stub",
|
"//conditions:default": "@local_config_cuda//cuda:curand",
|
||||||
),
|
}),
|
||||||
visibility = ["//visibility:private"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
@ -443,6 +442,15 @@ cc_library(
|
|||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
alias(
|
||||||
|
name = "cusolver_lib",
|
||||||
|
actual = select({
|
||||||
|
"//tensorflow:oss": ":cusolver_stub",
|
||||||
|
"//conditions:default": "@local_config_cuda//cuda:cusolver",
|
||||||
|
}),
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "cusparse_stub",
|
name = "cusparse_stub",
|
||||||
srcs = if_cuda_is_configured(["cusparse_stub.cc"]),
|
srcs = if_cuda_is_configured(["cusparse_stub.cc"]),
|
||||||
@ -454,6 +462,15 @@ cc_library(
|
|||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
alias(
|
||||||
|
name = "cusparse_lib",
|
||||||
|
actual = select({
|
||||||
|
"//tensorflow:oss": ":cusparse_stub",
|
||||||
|
"//conditions:default": "@local_config_cuda//cuda:cusparse",
|
||||||
|
}),
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "cuda_kernel",
|
name = "cuda_kernel",
|
||||||
srcs = if_cuda_is_configured(["cuda_kernel.cc"]),
|
srcs = if_cuda_is_configured(["cuda_kernel.cc"]),
|
||||||
|
Loading…
Reference in New Issue
Block a user