1# Lower-level functionality for build config.
2# The functions in this file might be referred by tensorflow.bzl. They have to
3# be separate to avoid cyclic references.
4
5load("@local_config_remote_execution//:remote_execution.bzl", "gpu_test_tags")
6
7def tf_gpu_tests_tags():
8    return ["requires-gpu", "gpu"] + gpu_test_tags()
9
10# terminology changes: saving tf_cuda_* for compatibility
11def tf_cuda_tests_tags():
12    return tf_gpu_tests_tags()
13
14def tf_sycl_tests_tags():
15    return ["requires-gpu", "gpu"] + gpu_test_tags()
16
17def tf_exec_compatible_with(kwargs):
18    if ("tags" in kwargs and kwargs["tags"] != None and
19        "remote-gpu" in kwargs["tags"]):
20        return ["@org_tensorflow//third_party/toolchains:gpu_test"]
21    return []
22
23def tf_additional_plugin_deps():
24    return select({
25        str(Label("//tensorflow:with_xla_support")): [
26            str(Label("//tensorflow/compiler/jit")),
27        ],
28        "//conditions:default": [],
29    })
30
31def tf_additional_xla_deps_py():
32    return []
33
34def tf_additional_grpc_deps_py():
35    return []
36
37def tf_additional_license_deps():
38    return select({
39        str(Label("//tensorflow:with_xla_support")): ["@llvm//:LICENSE.TXT"],
40        "//conditions:default": [],
41    })
42
43def tf_additional_verbs_deps():
44    return select({
45        str(Label("//tensorflow:with_verbs_support")): [
46            str(Label("//tensorflow/contrib/verbs:verbs_server_lib")),
47            str(Label("//tensorflow/contrib/verbs:grpc_verbs_client")),
48        ],
49        "//conditions:default": [],
50    })
51
52def tf_additional_mpi_deps():
53    return select({
54        str(Label("//tensorflow:with_mpi_support")): [
55            str(Label("//tensorflow/contrib/mpi:mpi_server_lib")),
56        ],
57        "//conditions:default": [],
58    })
59
60def tf_additional_gdr_deps():
61    return select({
62        str(Label("//tensorflow:with_gdr_support")): [
63            str(Label("//tensorflow/contrib/gdr:gdr_server_lib")),
64        ],
65        "//conditions:default": [],
66    })
67
68def if_static(extra_deps, otherwise = []):
69    return select({
70        str(Label("//tensorflow:framework_shared_object")): otherwise,
71        "//conditions:default": extra_deps,
72    })
73
74def if_dynamic_kernels(extra_deps, otherwise = []):
75    return select({
76        str(Label("//tensorflow:dynamic_loaded_kernels")): extra_deps,
77        "//conditions:default": otherwise,
78    })
79