• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Description:
2#   Host-platform specific StreamExecutor support code.
3
4load("//tensorflow:tensorflow.bzl", "filegroup")
5load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
6load("//tensorflow/stream_executor:build_defs.bzl", "stream_executor_friends")
7load("//tensorflow:tensorflow.bzl", "tf_cc_test")
8
9package(
10    default_visibility = [":friends"],
11    licenses = ["notice"],  # Apache 2.0
12)
13
14package_group(
15    name = "friends",
16    packages = stream_executor_friends(),
17)
18
19# Filegroup used to collect source files for the dependency check.
20filegroup(
21    name = "c_srcs",
22    data = glob([
23        "**/*.cc",
24        "**/*.h",
25    ]),
26)
27
28cc_library(
29    name = "host_platform_id",
30    srcs = [
31        "host_platform_id.cc",
32    ],
33    hdrs = [
34        "host_platform_id.h",
35    ],
36    deps = [
37        "//tensorflow/stream_executor:platform",
38    ],
39)
40
41cc_library(
42    name = "host_platform",
43    srcs = [
44        "host_platform.cc",
45    ],
46    hdrs = [
47        "host_platform.h",
48    ],
49    visibility = ["//visibility:public"],
50    deps = [
51        ":host_gpu_executor",
52        ":host_platform_id",
53        "//tensorflow/core:lib",
54        "//tensorflow/stream_executor:executor_cache",
55        "//tensorflow/stream_executor:multi_platform_manager",
56        "//tensorflow/stream_executor:stream_executor_headers",
57        "//tensorflow/stream_executor/lib",
58        "//tensorflow/stream_executor/platform",
59        "@com_google_absl//absl/memory",
60        "@com_google_absl//absl/strings:str_format",
61        "@com_google_absl//absl/synchronization",
62    ],
63    alwayslink = True,  # Registers itself with the MultiPlatformManager.
64)
65
66cc_library(
67    name = "host_stream",
68    srcs = [
69        "host_stream.cc",
70    ],
71    hdrs = [
72        "host_stream.h",
73    ],
74    deps = [
75        "//tensorflow/core:lib_internal",
76        "//tensorflow/stream_executor:kernel",
77        "//tensorflow/stream_executor/lib",
78        "@com_google_absl//absl/synchronization",
79    ],
80)
81
82cc_library(
83    name = "host_timer",
84    srcs = [
85        "host_timer.cc",
86    ],
87    hdrs = [
88        "host_timer.h",
89    ],
90    deps = [
91        "//tensorflow/stream_executor:stream_executor_internal",
92        "//tensorflow/stream_executor:timer",
93        "//tensorflow/stream_executor/platform",
94    ],
95)
96
97# TODO(22689637): Rename this target.
98cc_library(
99    name = "host_gpu_executor",
100    srcs = [
101        "host_gpu_executor.cc",
102    ],
103    hdrs = [
104        "host_gpu_executor.h",
105    ],
106    deps = [
107        ":host_platform_id",
108        ":host_stream",
109        ":host_timer",
110        "//tensorflow/core:lib",
111        "//tensorflow/stream_executor:kernel",
112        "//tensorflow/stream_executor:rng",
113        "//tensorflow/stream_executor:stream",
114        "//tensorflow/stream_executor:stream_executor_internal",
115        "//tensorflow/stream_executor:stream_executor_pimpl",
116        "//tensorflow/stream_executor:timer",
117        "//tensorflow/stream_executor/lib",
118        "@com_google_absl//absl/strings",
119        "@com_google_absl//absl/synchronization",
120    ],
121    alwayslink = True,
122)
123
124tf_cc_test(
125    name = "host_stream_test",
126    srcs = ["host_stream_test.cc"],
127    deps = [
128        ":host_platform",
129        "//tensorflow/core:test",
130        "//tensorflow/core:test_main",
131        "//tensorflow/stream_executor",
132        "//tensorflow/stream_executor:multi_platform_manager",
133        "//tensorflow/stream_executor:platform",
134        "//tensorflow/stream_executor:stream",
135        "@com_google_absl//absl/synchronization",
136    ],
137)
138