1# This file is expanded from a template by cuda_configure.bzl
2# Update cuda_configure.bzl#verify_build_defines when adding new variables.
3
4load(":cc_toolchain_config.bzl", "cc_toolchain_config")
5
6licenses(["restricted"])
7
8package(default_visibility = ["//visibility:public"])
9
10toolchain(
11    name = "toolchain-linux-x86_64",
12    exec_compatible_with = [
13        "@bazel_tools//platforms:linux",
14        "@bazel_tools//platforms:x86_64",
15    ],
16    target_compatible_with = [
17        "@bazel_tools//platforms:linux",
18        "@bazel_tools//platforms:x86_64",
19    ],
20    toolchain = ":cc-compiler-local",
21    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
22)
23
24cc_toolchain_suite(
25    name = "toolchain",
26    toolchains = {
27        "local|compiler": ":cc-compiler-local",
28        "arm": ":cc-compiler-local",
29        "aarch64": ":cc-compiler-local",
30        "k8": ":cc-compiler-local",
31        "piii": ":cc-compiler-local",
32        "ppc": ":cc-compiler-local",
33    },
34)
35
36cc_toolchain(
37    name = "cc-compiler-local",
38    all_files = ":crosstool_wrapper_driver_is_not_gcc",
39    ar_files = ":crosstool_wrapper_driver_is_not_gcc",
40    as_files = ":crosstool_wrapper_driver_is_not_gcc",
41    compiler_files = ":crosstool_wrapper_driver_is_not_gcc",
42    dwp_files = ":empty",
43    linker_files = ":crosstool_wrapper_driver_is_not_gcc",
44    objcopy_files = ":empty",
45    strip_files = ":empty",
46    # To support linker flags that need to go to the start of command line
47    # we need the toolchain to support parameter files. Parameter files are
48    # last on the command line and contain all shared libraries to link, so all
49    # regular options will be left of them.
50    supports_param_files = 1,
51    toolchain_config = ":cc-compiler-local-config",
52    toolchain_identifier = "local_linux",
53)
54
55cc_toolchain_config(
56    name = "cc-compiler-local-config",
57    abi_libc_version = "local",
58    abi_version = "local",
59    compile_flags = [
60        "-U_FORTIFY_SOURCE",
61        "-fstack-protector",
62        "-Wall",
63        "-Wunused-but-set-parameter",
64        "-Wno-free-nonheap-object",
65        "-fno-omit-frame-pointer",
66    ],
67    compiler = "compiler",
68    coverage_compile_flags = ["--coverage"],
69    coverage_link_flags = ["--coverage"],
70    cpu = "local",
71    cxx_builtin_include_directories = [
72        "/usr/include/c++/5",
73        "/usr/include/x86_64-linux-gnu/c++/5",
74        "/usr/include/c++/5/backward",
75        "/usr/lib/gcc/x86_64-linux-gnu/5/include",
76        "/usr/local/include",
77        "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed",
78        "/usr/include/x86_64-linux-gnu",
79        "/usr/include",
80        "/opt/rocm/include",
81        "/opt/rocm/hsa/include",
82        "/opt/rocm/include/hip",
83        "/opt/rocm/include/hip/hcc_detail",
84        "/opt/rocm/hip/include",
85        "/opt/rocm/llvm/lib/clang/8.0/include",
86        "/opt/rocm/llvm/lib/clang/9.0.0/include",
87        "/opt/rocm/llvm/lib/clang/10.0.0/include",
88        "/opt/rocm/llvm/lib/clang/11.0.0/include",
89        "/opt/rocm/rocrand/include",
90        "/opt/rocm/hiprand/include",
91        "/opt/rocm/rocfft/include",
92        "/opt/rocm/rocblas/include",
93        "/opt/rocm/miopen/include",
94        "/opt/rocm/rccl/include",
95        "/opt/rocm/hcc/include",
96        "/opt/rocm/hcc/compiler/lib/clang/7.0.0/include/",
97        "/opt/rocm/hcc/lib/clang/7.0.0/include",
98        "/opt/rocm/hcc/compiler/lib/clang/8.0.0/include/",
99        "/opt/rocm/hcc/lib/clang/8.0.0/include",
100        "/opt/rocm/hcc/compiler/lib/clang/9.0.0/include/",
101        "/opt/rocm/hcc/lib/clang/9.0.0/include",
102        "/opt/rocm/hcc/compiler/lib/clang/10.0.0/include/",
103        "/opt/rocm/hcc/lib/clang/10.0.0/include",
104    ],
105    cxx_flags = ["-std=c++11"],
106    dbg_compile_flags = ["-g"],
107    host_compiler_path = "clang/bin/crosstool_wrapper_driver_is_not_gcc",
108    host_compiler_prefix = "/usr/bin",
109    host_system_name = "local",
110    link_flags = [
111        "-fuse-ld=gold",
112        "-Wl,-no-as-needed",
113        "-Wl,-z,relro,-z,now",
114        "-pass-exit-codes",
115        "-lstdc++",
116        "-lm",
117    ],
118    link_libs = [],
119    linker_bin_path = "/opt/rocm/hcc/compiler/bin",
120    opt_compile_flags = [
121        "-g0",
122        "-O2",
123        "-D_FORTIFY_SOURCE=1",
124        "-DNDEBUG",
125        "-ffunction-sections",
126        "-fdata-sections",
127    ],
128    opt_link_flags = [],
129    supports_start_end_lib = True,
130    target_libc = "local",
131    target_system_name = "local",
132    toolchain_identifier = "local_linux",
133    unfiltered_compile_flags = [
134        "-fno-canonical-system-headers",
135        "-Wno-builtin-macro-redefined",
136        "-D__DATE__=\"redacted\"",
137        "-D__TIMESTAMP__=\"redacted\"",
138        "-D__TIME__=\"redacted\"",
139    ] + [
140        "-DTENSORFLOW_USE_ROCM=1",
141        "-D__HIP_PLATFORM_HCC__",
142        "-DEIGEN_USE_HIP",
143    ],
144)
145
146filegroup(
147    name = "empty",
148    srcs = [],
149)
150
151filegroup(
152    name = "crosstool_wrapper_driver_is_not_gcc",
153    srcs = ["clang/bin/crosstool_wrapper_driver_is_not_gcc"],
154)
155