Merge pull request from ROCmSoftwarePlatform/google_upstream_r21_rocm_updates_200923

[ROCm] Porting changes to support newer ROCm versions to r2.1
This commit is contained in:
Mihai Maruseac 2020-12-17 09:23:11 -08:00 committed by GitHub
commit 3937ea1851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 15 additions and 14 deletions
tensorflow
compiler/xla/service/gpu/llvm_gpu_backend
core
tools/ci_build
third_party/gpus

View File

@ -542,10 +542,9 @@ static std::vector<string> GetROCDLPaths(int amdgpu_version,
const string& rocdl_dir_path) { const string& rocdl_dir_path) {
// AMDGPU version-neutral bitcodes. // AMDGPU version-neutral bitcodes.
static std::vector<string>* rocdl_filenames = new std::vector<string>( static std::vector<string>* rocdl_filenames = new std::vector<string>(
{"hc.amdgcn.bc", "opencl.amdgcn.bc", "ocml.amdgcn.bc", "ockl.amdgcn.bc", {"hc.bc", "opencl.bc", "ocml.bc", "ockl.bc", "oclc_finite_only_off.bc",
"oclc_finite_only_off.amdgcn.bc", "oclc_daz_opt_off.amdgcn.bc", "oclc_daz_opt_off.bc", "oclc_correctly_rounded_sqrt_on.bc",
"oclc_correctly_rounded_sqrt_on.amdgcn.bc", "oclc_unsafe_math_off.bc"});
"oclc_unsafe_math_off.amdgcn.bc"});
// Construct full path to ROCDL bitcode libraries. // Construct full path to ROCDL bitcode libraries.
std::vector<string> result; std::vector<string> result;
@ -556,7 +555,7 @@ static std::vector<string> GetROCDLPaths(int amdgpu_version,
// Add AMDGPU version-specific bitcodes. // Add AMDGPU version-specific bitcodes.
result.push_back(tensorflow::io::JoinPath( result.push_back(tensorflow::io::JoinPath(
rocdl_dir_path, rocdl_dir_path,
absl::StrCat("oclc_isa_version_", amdgpu_version, ".amdgcn.bc"))); absl::StrCat("oclc_isa_version_", amdgpu_version, ".bc")));
return result; return result;
} }

View File

@ -388,7 +388,7 @@ __global__ __launch_bounds__(1024) void ColumnReduceKernel(
// - = // - =
// = // =
const int numRowsThisBlock = const int numRowsThisBlock =
min(blockDim.y, num_rows - blockIdx.y * blockDim.y); min(int(blockDim.y), num_rows - blockIdx.y * blockDim.y);
for (int row = 1; row < numRowsThisBlock; ++row) { for (int row = 1; row < numRowsThisBlock; ++row) {
value_type t = partial_sums[threadIdx.x * (TF_RED_WARPSIZE + 1) + row]; value_type t = partial_sums[threadIdx.x * (TF_RED_WARPSIZE + 1) + row];

View File

@ -37,7 +37,7 @@ string RocmRoot() {
string RocdlRoot() { string RocdlRoot() {
#if TENSORFLOW_COMPILER_IS_HIP_CLANG #if TENSORFLOW_COMPILER_IS_HIP_CLANG
return tensorflow::io::JoinPath(tensorflow::RocmRoot(), "lib"); return tensorflow::io::JoinPath(tensorflow::RocmRoot(), "amdgcn/bitcode");
#else #else
return tensorflow::io::JoinPath(tensorflow::RocmRoot(), "hcc/lib"); return tensorflow::io::JoinPath(tensorflow::RocmRoot(), "hcc/lib");
#endif #endif

View File

@ -27,7 +27,7 @@ TEST(RocmRocdlPathTest, ROCDLPath) {
VLOG(2) << "ROCm-Deivce-Libs root = " << RocdlRoot(); VLOG(2) << "ROCm-Deivce-Libs root = " << RocdlRoot();
std::vector<string> rocdl_files; std::vector<string> rocdl_files;
TF_EXPECT_OK(Env::Default()->GetMatchingPaths( TF_EXPECT_OK(Env::Default()->GetMatchingPaths(
io::JoinPath(RocdlRoot(), "*.amdgcn.bc"), &rocdl_files)); io::JoinPath(RocdlRoot(), "*.bc"), &rocdl_files));
EXPECT_LT(0, rocdl_files.size()); EXPECT_LT(0, rocdl_files.size());
} }
#endif #endif

View File

@ -3,10 +3,10 @@
FROM ubuntu:bionic FROM ubuntu:bionic
MAINTAINER Jeff Poznanovic <jeffrey.poznanovic@amd.com> MAINTAINER Jeff Poznanovic <jeffrey.poznanovic@amd.com>
ARG ROCM_DEB_REPO=http://repo.radeon.com/rocm/apt/3.7/ ARG ROCM_DEB_REPO=http://repo.radeon.com/rocm/apt/3.9/
ARG ROCM_BUILD_NAME=xenial ARG ROCM_BUILD_NAME=xenial
ARG ROCM_BUILD_NUM=main ARG ROCM_BUILD_NUM=main
ARG ROCM_PATH=/opt/rocm-3.7.0 ARG ROCM_PATH=/opt/rocm-3.9.0
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
ENV TF_NEED_ROCM 1 ENV TF_NEED_ROCM 1

View File

@ -28,7 +28,7 @@ echo "Bazel will use ${N_BUILD_JOBS} concurrent build job(s) and ${N_TEST_JOBS}
echo "" echo ""
# First positional argument (if any) specifies the ROCM_INSTALL_DIR # First positional argument (if any) specifies the ROCM_INSTALL_DIR
ROCM_INSTALL_DIR=/opt/rocm-3.7.0 ROCM_INSTALL_DIR=/opt/rocm-3.9.0
if [[ -n $1 ]]; then if [[ -n $1 ]]; then
ROCM_INSTALL_DIR=$1 ROCM_INSTALL_DIR=$1
fi fi

View File

@ -28,7 +28,7 @@ echo "Bazel will use ${N_BUILD_JOBS} concurrent build job(s) and ${N_TEST_JOBS}
echo "" echo ""
# First positional argument (if any) specifies the ROCM_INSTALL_DIR # First positional argument (if any) specifies the ROCM_INSTALL_DIR
ROCM_INSTALL_DIR=/opt/rocm-3.7.0 ROCM_INSTALL_DIR=/opt/rocm-3.9.0
if [[ -n $1 ]]; then if [[ -n $1 ]]; then
ROCM_INSTALL_DIR=$1 ROCM_INSTALL_DIR=$1
fi fi

View File

@ -28,7 +28,7 @@ echo "Bazel will use ${N_BUILD_JOBS} concurrent build job(s) and ${N_TEST_JOBS}
echo "" echo ""
# First positional argument (if any) specifies the ROCM_INSTALL_DIR # First positional argument (if any) specifies the ROCM_INSTALL_DIR
ROCM_INSTALL_DIR=/opt/rocm-3.7.0 ROCM_INSTALL_DIR=/opt/rocm-3.9.0
if [[ -n $1 ]]; then if [[ -n $1 ]]; then
ROCM_INSTALL_DIR=$1 ROCM_INSTALL_DIR=$1
fi fi

View File

@ -30,7 +30,7 @@ export PYTHON_BIN_PATH=`which python3`
export CC_OPT_FLAGS='-mavx' export CC_OPT_FLAGS='-mavx'
export TF_NEED_ROCM=1 export TF_NEED_ROCM=1
export ROCM_PATH=/opt/rocm-3.3.0 export ROCM_PATH=/opt/rocm-3.9.0
export TF_GPU_COUNT=${N_GPUS} export TF_GPU_COUNT=${N_GPUS}
yes "" | $PYTHON_BIN_PATH configure.py yes "" | $PYTHON_BIN_PATH configure.py

View File

@ -186,6 +186,7 @@ def InvokeHipcc(argv, log=False):
# of link time. This allows the default host compiler (gcc) be used as the # of link time. This allows the default host compiler (gcc) be used as the
# linker for TensorFlow on ROCm platform. # linker for TensorFlow on ROCm platform.
hipccopts += ' -fno-gpu-rdc ' hipccopts += ' -fno-gpu-rdc '
hipccopts += ' -fcuda-flush-denormals-to-zero '
hipccopts += undefines hipccopts += undefines
hipccopts += defines hipccopts += defines
hipccopts += std_options hipccopts += std_options

View File

@ -204,6 +204,7 @@ def _rocm_include_path(repository_ctx, rocm_config):
inc_dirs.append(rocm_config.rocm_toolkit_path + "/llvm/lib/clang/9.0.0/include") inc_dirs.append(rocm_config.rocm_toolkit_path + "/llvm/lib/clang/9.0.0/include")
inc_dirs.append(rocm_config.rocm_toolkit_path + "/llvm/lib/clang/10.0.0/include") inc_dirs.append(rocm_config.rocm_toolkit_path + "/llvm/lib/clang/10.0.0/include")
inc_dirs.append(rocm_config.rocm_toolkit_path + "/llvm/lib/clang/11.0.0/include") inc_dirs.append(rocm_config.rocm_toolkit_path + "/llvm/lib/clang/11.0.0/include")
inc_dirs.append(rocm_config.rocm_toolkit_path + "/llvm/lib/clang/12.0.0/include")
# Add rocrand and hiprand headers # Add rocrand and hiprand headers
inc_dirs.append(rocm_config.rocm_toolkit_path + "/rocrand/include") inc_dirs.append(rocm_config.rocm_toolkit_path + "/rocrand/include")