Update ROCm toolchain configuration
1. Rewrote hipcc_cc_toolchain_config.bzl.tpl.oss based on third_party/bazel/tools/cpp/unix_cc_toolchain_config.bzl 2. Cleaned up non-Linux stuff in toolchain configuration 3. Added support for parameter file in the compiler wrapper script 4. Re-generated preconfigured toolchain by third_party/tensorflow/third_party/toolchains/preconfig/generate/update.sh ubuntu16.04-py3_opt-gcc5-rocm 5. Bumped min Bazel version to 0.27.1 because toolchain configure requires newer Bazel 6. Removed --noincompatible_do_not_split_linking_cmdline PiperOrigin-RevId: 278844463 Change-Id: I477ec5b44e6c634db7c6d65d02b3e307f0be338b
This commit is contained in:
parent
cf615ecdfe
commit
72d0facc37
@ -49,7 +49,7 @@ _TF_BAZELRC_FILENAME = '.tf_configure.bazelrc'
|
||||
_TF_WORKSPACE_ROOT = ''
|
||||
_TF_BAZELRC = ''
|
||||
_TF_CURRENT_BAZEL_VERSION = None
|
||||
_TF_MIN_BAZEL_VERSION = '0.24.1'
|
||||
_TF_MIN_BAZEL_VERSION = '0.27.1'
|
||||
_TF_MAX_BAZEL_VERSION = '0.29.1'
|
||||
|
||||
NCCL_LIB_PATHS = [
|
||||
|
@ -80,6 +80,7 @@ tensorflow/third_party/git/git_configure.bzl
|
||||
tensorflow/third_party/googleapis.BUILD
|
||||
tensorflow/third_party/gpus/BUILD
|
||||
tensorflow/third_party/gpus/crosstool/BUILD
|
||||
tensorflow/third_party/gpus/crosstool/BUILD.rocm.tpl
|
||||
tensorflow/third_party/gpus/crosstool/BUILD.tpl
|
||||
tensorflow/third_party/gpus/crosstool/LICENSE
|
||||
tensorflow/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl
|
||||
|
116
third_party/gpus/crosstool/BUILD.rocm.tpl
vendored
Normal file
116
third_party/gpus/crosstool/BUILD.rocm.tpl
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
# This file is expanded from a template by cuda_configure.bzl
|
||||
# Update cuda_configure.bzl#verify_build_defines when adding new variables.
|
||||
|
||||
load(":cc_toolchain_config.bzl", "cc_toolchain_config")
|
||||
|
||||
licenses(["restricted"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
toolchain(
|
||||
name = "toolchain-linux-x86_64",
|
||||
exec_compatible_with = [
|
||||
"@bazel_tools//platforms:linux",
|
||||
"@bazel_tools//platforms:x86_64",
|
||||
],
|
||||
target_compatible_with = [
|
||||
"@bazel_tools//platforms:linux",
|
||||
"@bazel_tools//platforms:x86_64",
|
||||
],
|
||||
toolchain = ":cc-compiler-local",
|
||||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
||||
)
|
||||
|
||||
cc_toolchain_suite(
|
||||
name = "toolchain",
|
||||
toolchains = {
|
||||
"local|compiler": ":cc-compiler-local",
|
||||
"arm": ":cc-compiler-local",
|
||||
"aarch64": ":cc-compiler-local",
|
||||
"k8": ":cc-compiler-local",
|
||||
"piii": ":cc-compiler-local",
|
||||
"ppc": ":cc-compiler-local",
|
||||
},
|
||||
)
|
||||
|
||||
cc_toolchain(
|
||||
name = "cc-compiler-local",
|
||||
all_files = "%{linker_files}",
|
||||
compiler_files = ":empty",
|
||||
dwp_files = ":empty",
|
||||
linker_files = "%{linker_files}",
|
||||
objcopy_files = ":empty",
|
||||
strip_files = ":empty",
|
||||
# To support linker flags that need to go to the start of command line
|
||||
# we need the toolchain to support parameter files. Parameter files are
|
||||
# last on the command line and contain all shared libraries to link, so all
|
||||
# regular options will be left of them.
|
||||
supports_param_files = 1,
|
||||
toolchain_identifier = "local_linux",
|
||||
toolchain_config = ":cc-compiler-local-config",
|
||||
)
|
||||
|
||||
cc_toolchain_config(
|
||||
name = "cc-compiler-local-config",
|
||||
cpu = "local",
|
||||
compiler = "compiler",
|
||||
toolchain_identifier = "local_linux",
|
||||
host_system_name = "local",
|
||||
target_system_name = "local",
|
||||
target_libc = "local",
|
||||
abi_version = "local",
|
||||
abi_libc_version = "local",
|
||||
cxx_builtin_include_directories = [%{cxx_builtin_include_directories}],
|
||||
host_compiler_path = "%{host_compiler_path}",
|
||||
host_compiler_prefix = "%{host_compiler_prefix}",
|
||||
compile_flags = [
|
||||
"-U_FORTIFY_SOURCE",
|
||||
"-fstack-protector",
|
||||
"-Wall",
|
||||
"-Wunused-but-set-parameter",
|
||||
"-Wno-free-nonheap-object",
|
||||
"-fno-omit-frame-pointer",
|
||||
],
|
||||
opt_compile_flags = [
|
||||
"-g0",
|
||||
"-O2",
|
||||
"-D_FORTIFY_SOURCE=1",
|
||||
"-DNDEBUG",
|
||||
"-ffunction-sections",
|
||||
"-fdata-sections",
|
||||
],
|
||||
dbg_compile_flags = ["-g"],
|
||||
cxx_flags = ["-std=c++11"],
|
||||
link_flags = [
|
||||
"-fuse-ld=gold",
|
||||
"-Wl,-no-as-needed",
|
||||
"-Wl,-z,relro,-z,now",
|
||||
"-pass-exit-codes",
|
||||
"-lstdc++",
|
||||
"-lm",
|
||||
],
|
||||
link_libs = [],
|
||||
opt_link_flags = ["-Wl,--gc-sections"],
|
||||
unfiltered_compile_flags = [
|
||||
"-fno-canonical-system-headers",
|
||||
"-Wno-builtin-macro-redefined",
|
||||
"-D__DATE__=\"redacted\"",
|
||||
"-D__TIMESTAMP__=\"redacted\"",
|
||||
"-D__TIME__=\"redacted\"",
|
||||
] + [%{unfiltered_compile_flags}],
|
||||
linker_bin_path = "%{linker_bin_path}",
|
||||
coverage_compile_flags = ["--coverage"],
|
||||
coverage_link_flags = ["--coverage"],
|
||||
supports_start_end_lib = True,
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "empty",
|
||||
srcs = [],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "crosstool_wrapper_driver_is_not_gcc",
|
||||
srcs = ["clang/bin/crosstool_wrapper_driver_is_not_gcc"],
|
||||
)
|
||||
|
@ -215,7 +215,7 @@ def main():
|
||||
# ignore PWD env var
|
||||
os.environ['PWD']=''
|
||||
|
||||
parser = ArgumentParser()
|
||||
parser = ArgumentParser(fromfile_prefix_chars='@')
|
||||
parser.add_argument('-x', nargs=1)
|
||||
parser.add_argument('--rocm_log', action='store_true')
|
||||
parser.add_argument('-pass-exit-codes', action='store_true')
|
||||
|
File diff suppressed because it is too large
Load Diff
120
third_party/gpus/rocm_configure.bzl
vendored
120
third_party/gpus/rocm_configure.bzl
vendored
@ -18,7 +18,6 @@ load(
|
||||
"make_copy_dir_rule",
|
||||
"make_copy_files_rule",
|
||||
"to_list_of_strings",
|
||||
"verify_build_defines",
|
||||
)
|
||||
|
||||
_GCC_HOST_COMPILER_PATH = "GCC_HOST_COMPILER_PATH"
|
||||
@ -34,21 +33,33 @@ _DEFAULT_MIOPEN_VERSION = ""
|
||||
_DEFAULT_ROCM_TOOLKIT_PATH = "/opt/rocm"
|
||||
_DEFAULT_ROCM_AMDGPU_TARGETS = ["gfx803", "gfx900"]
|
||||
|
||||
def _get_win_rocm_defines(repository_ctx):
|
||||
"""Return CROSSTOOL defines for Windows"""
|
||||
def verify_build_defines(params):
|
||||
"""Verify all variables that crosstool/BUILD.rocm.tpl expects are substituted.
|
||||
|
||||
# Return fake vaules for Windows specific fields.
|
||||
# This ensures the CROSSTOOL file parser is happy.
|
||||
return {
|
||||
"%{msvc_env_tmp}": "msvc_not_used",
|
||||
"%{msvc_env_path}": "msvc_not_used",
|
||||
"%{msvc_env_include}": "msvc_not_used",
|
||||
"%{msvc_env_lib}": "msvc_not_used",
|
||||
"%{msvc_cl_path}": "msvc_not_used",
|
||||
"%{msvc_ml_path}": "msvc_not_used",
|
||||
"%{msvc_link_path}": "msvc_not_used",
|
||||
"%{msvc_lib_path}": "msvc_not_used",
|
||||
}
|
||||
Args:
|
||||
params: dict of variables that will be passed to the BUILD.tpl template.
|
||||
"""
|
||||
missing = []
|
||||
for param in [
|
||||
"cxx_builtin_include_directories",
|
||||
"extra_no_canonical_prefixes_flags",
|
||||
"host_compiler_path",
|
||||
"host_compiler_prefix",
|
||||
"linker_bin_path",
|
||||
"linker_files",
|
||||
"unfiltered_compile_flags",
|
||||
]:
|
||||
if ("%{" + param + "}") not in params:
|
||||
missing.append(param)
|
||||
|
||||
if missing:
|
||||
auto_configure_fail(
|
||||
"BUILD.rocm.tpl template is missing these variables: " +
|
||||
str(missing) +
|
||||
".\nWe only got: " +
|
||||
str(params) +
|
||||
".",
|
||||
)
|
||||
|
||||
def find_cc(repository_ctx):
|
||||
"""Find the C++ compiler."""
|
||||
@ -138,6 +149,12 @@ def auto_configure_fail(msg):
|
||||
no_color = "\033[0m"
|
||||
fail("\n%sROCm Configuration Error:%s %s\n" % (red, no_color, msg))
|
||||
|
||||
def auto_configure_warning(msg):
|
||||
"""Output warning message during auto configuration."""
|
||||
yellow = "\033[1;33m"
|
||||
no_color = "\033[0m"
|
||||
print("\n%sAuto-Configuration Warning:%s %s\n" % (yellow, no_color, msg))
|
||||
|
||||
# END cc_configure common functions (see TODO above).
|
||||
|
||||
def _host_compiler_includes(repository_ctx, cc):
|
||||
@ -225,7 +242,11 @@ def _rocm_include_path(repository_ctx, rocm_config):
|
||||
def _enable_rocm(repository_ctx):
|
||||
if "TF_NEED_ROCM" in repository_ctx.os.environ:
|
||||
enable_rocm = repository_ctx.os.environ["TF_NEED_ROCM"].strip()
|
||||
return enable_rocm == "1"
|
||||
if enable_rocm == "1":
|
||||
if _cpu_value(repository_ctx) != "Linux":
|
||||
auto_configure_warning("ROCm configure is only supported on Linux")
|
||||
return False
|
||||
return True
|
||||
return False
|
||||
|
||||
def _rocm_toolkit_path(repository_ctx):
|
||||
@ -356,40 +377,27 @@ def _cpu_value(repository_ctx):
|
||||
result = repository_ctx.execute(["uname", "-s"])
|
||||
return result.stdout.strip()
|
||||
|
||||
def _lib_name(lib, cpu_value, version = "", static = False):
|
||||
"""Constructs the platform-specific name of a library.
|
||||
def _lib_name(lib, version = "", static = False):
|
||||
"""Constructs the name of a library on Linux.
|
||||
|
||||
Args:
|
||||
lib: The name of the library, such as "hip"
|
||||
cpu_value: The name of the host operating system.
|
||||
version: The version of the library.
|
||||
static: True the library is static or False if it is a shared object.
|
||||
|
||||
Returns:
|
||||
The platform-specific name of the library.
|
||||
"""
|
||||
if cpu_value in ("Linux", "FreeBSD"):
|
||||
if static:
|
||||
return "lib%s.a" % lib
|
||||
else:
|
||||
if version:
|
||||
version = ".%s" % version
|
||||
return "lib%s.so%s" % (lib, version)
|
||||
elif cpu_value == "Windows":
|
||||
return "%s.lib" % lib
|
||||
elif cpu_value == "Darwin":
|
||||
if static:
|
||||
return "lib%s.a" % lib
|
||||
elif version:
|
||||
version = ".%s" % version
|
||||
return "lib%s%s.dylib" % (lib, version)
|
||||
else:
|
||||
auto_configure_fail("Invalid cpu_value: %s" % cpu_value)
|
||||
|
||||
def _find_rocm_lib(
|
||||
lib,
|
||||
repository_ctx,
|
||||
cpu_value,
|
||||
basedir,
|
||||
version = "",
|
||||
static = False):
|
||||
@ -398,7 +406,6 @@ def _find_rocm_lib(
|
||||
Args:
|
||||
lib: The name of the library, such as "hip"
|
||||
repository_ctx: The repository context.
|
||||
cpu_value: The name of the host operating system.
|
||||
basedir: The install directory of ROCm.
|
||||
version: The version of the library.
|
||||
static: True if static library, False if shared object.
|
||||
@ -408,8 +415,8 @@ def _find_rocm_lib(
|
||||
file_name: The basename of the library found on the system.
|
||||
path: The full path to the library.
|
||||
"""
|
||||
file_name = _lib_name(lib, cpu_value, version, static)
|
||||
if cpu_value == "Linux":
|
||||
file_name = _lib_name(lib, version, static)
|
||||
|
||||
path = repository_ctx.path("%s/lib64/%s" % (basedir, file_name))
|
||||
if path.exists:
|
||||
return struct(file_name = file_name, path = str(path.realpath))
|
||||
@ -421,7 +428,6 @@ def _find_rocm_lib(
|
||||
)
|
||||
if path.exists:
|
||||
return struct(file_name = file_name, path = str(path.realpath))
|
||||
|
||||
path = repository_ctx.path("%s/lib/%s" % (basedir, file_name))
|
||||
if path.exists:
|
||||
return struct(file_name = file_name, path = str(path.realpath))
|
||||
@ -442,42 +448,35 @@ def _find_libs(repository_ctx, rocm_config):
|
||||
Map of library names to structs of filename and path as returned by
|
||||
_find_rocm_lib.
|
||||
"""
|
||||
cpu_value = rocm_config.cpu_value
|
||||
return {
|
||||
"hip": _find_rocm_lib(
|
||||
"hip_hcc",
|
||||
repository_ctx,
|
||||
cpu_value,
|
||||
rocm_config.rocm_toolkit_path,
|
||||
),
|
||||
"rocblas": _find_rocm_lib(
|
||||
"rocblas",
|
||||
repository_ctx,
|
||||
cpu_value,
|
||||
rocm_config.rocm_toolkit_path + "/rocblas",
|
||||
),
|
||||
"rocfft": _find_rocm_lib(
|
||||
"rocfft",
|
||||
repository_ctx,
|
||||
cpu_value,
|
||||
rocm_config.rocm_toolkit_path + "/rocfft",
|
||||
),
|
||||
"hiprand": _find_rocm_lib(
|
||||
"hiprand",
|
||||
repository_ctx,
|
||||
cpu_value,
|
||||
rocm_config.rocm_toolkit_path + "/hiprand",
|
||||
),
|
||||
"miopen": _find_rocm_lib(
|
||||
"MIOpen",
|
||||
repository_ctx,
|
||||
cpu_value,
|
||||
rocm_config.rocm_toolkit_path + "/miopen",
|
||||
),
|
||||
"rccl": _find_rocm_lib(
|
||||
"rccl",
|
||||
repository_ctx,
|
||||
cpu_value,
|
||||
rocm_config.rocm_toolkit_path + "/rccl",
|
||||
),
|
||||
}
|
||||
@ -492,14 +491,11 @@ def _get_rocm_config(repository_ctx):
|
||||
A struct containing the following fields:
|
||||
rocm_toolkit_path: The ROCm toolkit installation directory.
|
||||
amdgpu_targets: A list of the system's AMDGPU targets.
|
||||
cpu_value: The name of the host operating system.
|
||||
"""
|
||||
cpu_value = _cpu_value(repository_ctx)
|
||||
rocm_toolkit_path = _rocm_toolkit_path(repository_ctx)
|
||||
return struct(
|
||||
rocm_toolkit_path = rocm_toolkit_path,
|
||||
amdgpu_targets = _amdgpu_targets(repository_ctx),
|
||||
cpu_value = cpu_value,
|
||||
)
|
||||
|
||||
def _tpl(repository_ctx, tpl, substitutions = {}, out = None):
|
||||
@ -544,8 +540,6 @@ error_gpu_disabled()
|
||||
"""
|
||||
|
||||
def _create_dummy_repository(repository_ctx):
|
||||
cpu_value = _cpu_value(repository_ctx)
|
||||
|
||||
# Set up BUILD file for rocm/.
|
||||
_tpl(
|
||||
repository_ctx,
|
||||
@ -559,12 +553,12 @@ def _create_dummy_repository(repository_ctx):
|
||||
repository_ctx,
|
||||
"rocm:BUILD",
|
||||
{
|
||||
"%{hip_lib}": _lib_name("hip", cpu_value),
|
||||
"%{rocblas_lib}": _lib_name("rocblas", cpu_value),
|
||||
"%{miopen_lib}": _lib_name("miopen", cpu_value),
|
||||
"%{rccl_lib}": _lib_name("rccl", cpu_value),
|
||||
"%{rocfft_lib}": _lib_name("rocfft", cpu_value),
|
||||
"%{hiprand_lib}": _lib_name("hiprand", cpu_value),
|
||||
"%{hip_lib}": _lib_name("hip"),
|
||||
"%{rocblas_lib}": _lib_name("rocblas"),
|
||||
"%{miopen_lib}": _lib_name("miopen"),
|
||||
"%{rccl_lib}": _lib_name("rccl"),
|
||||
"%{rocfft_lib}": _lib_name("rocfft"),
|
||||
"%{hiprand_lib}": _lib_name("hiprand"),
|
||||
"%{copy_rules}": "",
|
||||
"%{rocm_headers}": "",
|
||||
},
|
||||
@ -796,28 +790,20 @@ def _create_local_rocm_repository(repository_ctx):
|
||||
|
||||
rocm_defines["%{host_compiler_path}"] = "clang/bin/crosstool_wrapper_driver_is_not_gcc"
|
||||
|
||||
# # Enable a few more warnings that aren't part of -Wall.
|
||||
# compiler_flag: "-Wunused-but-set-parameter"
|
||||
|
||||
# # But disable some that are problematic.
|
||||
# compiler_flag: "-Wno-free-nonheap-object" # has false positives
|
||||
|
||||
rocm_defines["%{host_compiler_warnings}"] = to_list_of_strings(["-Wunused-but-set-parameter", "-Wno-free-nonheap-object"])
|
||||
|
||||
rocm_defines["%{cxx_builtin_include_directories}"] = to_list_of_strings(host_compiler_includes +
|
||||
_rocm_include_path(repository_ctx, rocm_config))
|
||||
|
||||
rocm_defines["%{linker_files}"] = "clang/bin/crosstool_wrapper_driver_is_not_gcc"
|
||||
|
||||
rocm_defines["%{win_linker_files}"] = ":empty"
|
||||
|
||||
# Add the dummy defines for windows...requried to pass the "verify_build_defines" check
|
||||
rocm_defines.update(_get_win_rocm_defines(repository_ctx))
|
||||
|
||||
verify_build_defines(rocm_defines)
|
||||
|
||||
# Only expand template variables in the BUILD file
|
||||
_tpl(repository_ctx, "crosstool:BUILD", rocm_defines)
|
||||
_tpl(
|
||||
repository_ctx,
|
||||
"crosstool:BUILD.rocm",
|
||||
rocm_defines,
|
||||
out = "crosstool/BUILD",
|
||||
)
|
||||
|
||||
# No templating of cc_toolchain_config - use attributes and templatize the
|
||||
# BUILD file.
|
||||
|
@ -72,7 +72,7 @@ def _tensorflow_rbe_config(name, compiler, python_version, os, rocm_version = No
|
||||
docker_toolchain_autoconfig(
|
||||
name = name,
|
||||
base = base,
|
||||
bazel_version = "0.24.1",
|
||||
bazel_version = "0.29.1",
|
||||
build_bazel_src = build_bazel_src,
|
||||
config_repos = config_repos,
|
||||
env = env,
|
||||
|
@ -25,15 +25,11 @@ cc_toolchain_suite(
|
||||
name = "toolchain",
|
||||
toolchains = {
|
||||
"local|compiler": ":cc-compiler-local",
|
||||
"darwin|compiler": ":cc-compiler-darwin",
|
||||
"x64_windows|msvc-cl": ":cc-compiler-windows",
|
||||
"x64_windows": ":cc-compiler-windows",
|
||||
"arm": ":cc-compiler-local",
|
||||
"aarch64": ":cc-compiler-local",
|
||||
"k8": ":cc-compiler-local",
|
||||
"piii": ":cc-compiler-local",
|
||||
"ppc": ":cc-compiler-local",
|
||||
"darwin": ":cc-compiler-darwin",
|
||||
},
|
||||
)
|
||||
|
||||
@ -56,71 +52,21 @@ cc_toolchain(
|
||||
|
||||
cc_toolchain_config(
|
||||
name = "cc-compiler-local-config",
|
||||
builtin_include_directories = [
|
||||
"/usr/include/c++/5",
|
||||
"/usr/include/x86_64-linux-gnu/c++/5",
|
||||
"/usr/include/c++/5/backward",
|
||||
"/usr/lib/gcc/x86_64-linux-gnu/5/include",
|
||||
"/usr/local/include",
|
||||
"/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed",
|
||||
"/usr/include/x86_64-linux-gnu",
|
||||
"/usr/include",
|
||||
"/opt/rocm/include",
|
||||
"/opt/rocm/hsa/include",
|
||||
"/opt/rocm/include/hip",
|
||||
"/opt/rocm/include/hip/hcc_detail",
|
||||
"/opt/rocm/hip/include",
|
||||
"/opt/rocm/llvm/lib/clang/8.0/include",
|
||||
"/opt/rocm/llvm/lib/clang/9.0.0/include",
|
||||
"/opt/rocm/llvm/lib/clang/10.0.0/include",
|
||||
"/opt/rocm/rocrand/include",
|
||||
"/opt/rocm/hiprand/include",
|
||||
"/opt/rocm/rocfft/include",
|
||||
"/opt/rocm/rocblas/include",
|
||||
"/opt/rocm/miopen/include",
|
||||
"/opt/rocm/rccl/include",
|
||||
"/opt/rocm/hcc/include",
|
||||
"/opt/rocm/hcc/compiler/lib/clang/7.0.0/include/",
|
||||
"/opt/rocm/hcc/lib/clang/7.0.0/include",
|
||||
"/opt/rocm/hcc/compiler/lib/clang/8.0.0/include/",
|
||||
"/opt/rocm/hcc/lib/clang/8.0.0/include",
|
||||
"/opt/rocm/hcc/compiler/lib/clang/9.0.0/include/",
|
||||
"/opt/rocm/hcc/lib/clang/9.0.0/include",
|
||||
"/opt/rocm/hcc/compiler/lib/clang/10.0.0/include/",
|
||||
"/opt/rocm/hcc/lib/clang/10.0.0/include",
|
||||
abi_libc_version = "local",
|
||||
abi_version = "local",
|
||||
compile_flags = [
|
||||
"-U_FORTIFY_SOURCE",
|
||||
"-fstack-protector",
|
||||
"-Wall",
|
||||
"-Wunused-but-set-parameter",
|
||||
"-Wno-free-nonheap-object",
|
||||
"-fno-omit-frame-pointer",
|
||||
],
|
||||
compiler = "compiler",
|
||||
coverage_compile_flags = ["--coverage"],
|
||||
coverage_link_flags = ["--coverage"],
|
||||
cpu = "local",
|
||||
extra_no_canonical_prefixes_flags = ["-fno-canonical-system-headers"],
|
||||
host_compiler_path = "clang/bin/crosstool_wrapper_driver_is_not_gcc",
|
||||
host_compiler_prefix = "/usr/bin",
|
||||
host_compiler_warnings = [
|
||||
"-Wunused-but-set-parameter",
|
||||
"-Wno-free-nonheap-object",
|
||||
],
|
||||
host_unfiltered_compile_flags = [
|
||||
"-DTENSORFLOW_USE_ROCM=1",
|
||||
"-D__HIP_PLATFORM_HCC__",
|
||||
"-DEIGEN_USE_HIP",
|
||||
],
|
||||
linker_bin_path = "/opt/rocm/hcc/compiler/bin",
|
||||
)
|
||||
|
||||
cc_toolchain(
|
||||
name = "cc-compiler-darwin",
|
||||
all_files = "clang/bin/crosstool_wrapper_driver_is_not_gcc",
|
||||
compiler_files = ":empty",
|
||||
dwp_files = ":empty",
|
||||
linker_files = "clang/bin/crosstool_wrapper_driver_is_not_gcc",
|
||||
objcopy_files = ":empty",
|
||||
strip_files = ":empty",
|
||||
supports_param_files = 0,
|
||||
toolchain_config = ":cc-compiler-local-darwin",
|
||||
toolchain_identifier = "local_darwin",
|
||||
)
|
||||
|
||||
cc_toolchain_config(
|
||||
name = "cc-compiler-local-darwin",
|
||||
builtin_include_directories = [
|
||||
cxx_builtin_include_directories = [
|
||||
"/usr/include/c++/5",
|
||||
"/usr/include/x86_64-linux-gnu/c++/5",
|
||||
"/usr/include/c++/5/backward",
|
||||
@ -153,79 +99,45 @@ cc_toolchain_config(
|
||||
"/opt/rocm/hcc/compiler/lib/clang/10.0.0/include/",
|
||||
"/opt/rocm/hcc/lib/clang/10.0.0/include",
|
||||
],
|
||||
cpu = "darwin",
|
||||
extra_no_canonical_prefixes_flags = ["-fno-canonical-system-headers"],
|
||||
cxx_flags = ["-std=c++11"],
|
||||
dbg_compile_flags = ["-g"],
|
||||
host_compiler_path = "clang/bin/crosstool_wrapper_driver_is_not_gcc",
|
||||
host_compiler_prefix = "/usr/bin",
|
||||
host_compiler_warnings = [
|
||||
"-Wunused-but-set-parameter",
|
||||
"-Wno-free-nonheap-object",
|
||||
host_system_name = "local",
|
||||
link_flags = [
|
||||
"-fuse-ld=gold",
|
||||
"-Wl,-no-as-needed",
|
||||
"-Wl,-z,relro,-z,now",
|
||||
"-pass-exit-codes",
|
||||
"-lstdc++",
|
||||
"-lm",
|
||||
],
|
||||
host_unfiltered_compile_flags = [
|
||||
link_libs = [],
|
||||
linker_bin_path = "/opt/rocm/hcc/compiler/bin",
|
||||
opt_compile_flags = [
|
||||
"-g0",
|
||||
"-O2",
|
||||
"-D_FORTIFY_SOURCE=1",
|
||||
"-DNDEBUG",
|
||||
"-ffunction-sections",
|
||||
"-fdata-sections",
|
||||
],
|
||||
opt_link_flags = ["-Wl,--gc-sections"],
|
||||
supports_start_end_lib = True,
|
||||
target_libc = "local",
|
||||
target_system_name = "local",
|
||||
toolchain_identifier = "local_linux",
|
||||
unfiltered_compile_flags = [
|
||||
"-fno-canonical-system-headers",
|
||||
"-Wno-builtin-macro-redefined",
|
||||
"-D__DATE__=\"redacted\"",
|
||||
"-D__TIMESTAMP__=\"redacted\"",
|
||||
"-D__TIME__=\"redacted\"",
|
||||
] + [
|
||||
"-DTENSORFLOW_USE_ROCM=1",
|
||||
"-D__HIP_PLATFORM_HCC__",
|
||||
"-DEIGEN_USE_HIP",
|
||||
],
|
||||
linker_bin_path = "/opt/rocm/hcc/compiler/bin",
|
||||
)
|
||||
|
||||
cc_toolchain(
|
||||
name = "cc-compiler-windows",
|
||||
all_files = ":empty",
|
||||
compiler_files = ":empty",
|
||||
dwp_files = ":empty",
|
||||
linker_files = ":empty",
|
||||
objcopy_files = ":empty",
|
||||
strip_files = ":empty",
|
||||
supports_param_files = 1,
|
||||
toolchain_config = ":cc-compiler-windows-config",
|
||||
toolchain_identifier = "local_windows",
|
||||
)
|
||||
|
||||
cc_toolchain_config(
|
||||
name = "cc-compiler-windows-config",
|
||||
builtin_include_directories = [
|
||||
"/usr/include/c++/5",
|
||||
"/usr/include/x86_64-linux-gnu/c++/5",
|
||||
"/usr/include/c++/5/backward",
|
||||
"/usr/lib/gcc/x86_64-linux-gnu/5/include",
|
||||
"/usr/local/include",
|
||||
"/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed",
|
||||
"/usr/include/x86_64-linux-gnu",
|
||||
"/usr/include",
|
||||
"/opt/rocm/include",
|
||||
"/opt/rocm/hsa/include",
|
||||
"/opt/rocm/include/hip",
|
||||
"/opt/rocm/include/hip/hcc_detail",
|
||||
"/opt/rocm/hip/include",
|
||||
"/opt/rocm/llvm/lib/clang/8.0/include",
|
||||
"/opt/rocm/llvm/lib/clang/9.0.0/include",
|
||||
"/opt/rocm/llvm/lib/clang/10.0.0/include",
|
||||
"/opt/rocm/rocrand/include",
|
||||
"/opt/rocm/hiprand/include",
|
||||
"/opt/rocm/rocfft/include",
|
||||
"/opt/rocm/rocblas/include",
|
||||
"/opt/rocm/miopen/include",
|
||||
"/opt/rocm/rccl/include",
|
||||
"/opt/rocm/hcc/include",
|
||||
"/opt/rocm/hcc/compiler/lib/clang/7.0.0/include/",
|
||||
"/opt/rocm/hcc/lib/clang/7.0.0/include",
|
||||
"/opt/rocm/hcc/compiler/lib/clang/8.0.0/include/",
|
||||
"/opt/rocm/hcc/lib/clang/8.0.0/include",
|
||||
"/opt/rocm/hcc/compiler/lib/clang/9.0.0/include/",
|
||||
"/opt/rocm/hcc/lib/clang/9.0.0/include",
|
||||
"/opt/rocm/hcc/compiler/lib/clang/10.0.0/include/",
|
||||
"/opt/rocm/hcc/lib/clang/10.0.0/include",
|
||||
],
|
||||
cpu = "x64_windows",
|
||||
msvc_cl_path = "msvc_not_used",
|
||||
msvc_env_include = "msvc_not_used",
|
||||
msvc_env_lib = "msvc_not_used",
|
||||
msvc_env_path = "msvc_not_used",
|
||||
msvc_env_tmp = "msvc_not_used",
|
||||
msvc_lib_path = "msvc_not_used",
|
||||
msvc_link_path = "msvc_not_used",
|
||||
msvc_ml_path = "msvc_not_used",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
@ -237,8 +149,3 @@ filegroup(
|
||||
name = "crosstool_wrapper_driver_is_not_gcc",
|
||||
srcs = ["clang/bin/crosstool_wrapper_driver_is_not_gcc"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "windows_msvc_wrapper_files",
|
||||
srcs = glob(["windows/msvc_*"]),
|
||||
)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -215,7 +215,7 @@ def main():
|
||||
# ignore PWD env var
|
||||
os.environ['PWD']=''
|
||||
|
||||
parser = ArgumentParser()
|
||||
parser = ArgumentParser(fromfile_prefix_chars='@')
|
||||
parser.add_argument('-x', nargs=1)
|
||||
parser.add_argument('--rocm_log', action='store_true')
|
||||
parser.add_argument('-pass-exit-codes', action='store_true')
|
||||
|
@ -1,36 +1,9 @@
|
||||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
load("@bazel_tools//tools/python:toolchain.bzl", "py_runtime_pair")
|
||||
|
||||
licenses(["restricted"]) # MPL2, portions GPL v3, LGPL v3, BSD-like
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
# Point both runtimes to the same python binary to ensure we always
|
||||
# use the python binary specified by ./configure.py script.
|
||||
py_runtime(
|
||||
name = "py2_runtime",
|
||||
interpreter_path = "/usr/bin/python3",
|
||||
python_version = "PY2",
|
||||
)
|
||||
|
||||
py_runtime(
|
||||
name = "py3_runtime",
|
||||
interpreter_path = "/usr/bin/python3",
|
||||
python_version = "PY3",
|
||||
)
|
||||
|
||||
py_runtime_pair(
|
||||
name = "py_runtime_pair",
|
||||
py2_runtime = ":py2_runtime",
|
||||
py3_runtime = ":py3_runtime",
|
||||
)
|
||||
|
||||
toolchain(
|
||||
name = "py_toolchain",
|
||||
toolchain = ":py_runtime_pair",
|
||||
toolchain_type = "@bazel_tools//tools/python:toolchain_type",
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "using_hipcc",
|
||||
values = {
|
||||
|
Loading…
Reference in New Issue
Block a user