From 8dd28457699100145cad17aa4d44da81fddefda9 Mon Sep 17 00:00:00 2001 From: Eugene Kuznetsov Date: Fri, 15 May 2020 19:34:30 +0000 Subject: [PATCH] Reviewer requests --- tensorflow/stream_executor/rocm/rocm_gpu_executor.cc | 3 ++- third_party/gpus/cuda_configure.bzl | 10 +++++++--- third_party/gpus/rocm_configure.bzl | 3 +-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tensorflow/stream_executor/rocm/rocm_gpu_executor.cc b/tensorflow/stream_executor/rocm/rocm_gpu_executor.cc index 216602a7597..fd3b5f19913 100644 --- a/tensorflow/stream_executor/rocm/rocm_gpu_executor.cc +++ b/tensorflow/stream_executor/rocm/rocm_gpu_executor.cc @@ -133,8 +133,9 @@ bool GpuExecutor::UnloadGpuBinary(const void* gpu_binary) { GpuDriver::UnloadModule(context_, module); gpu_binary_to_module_.erase(module_it); const char* mem_it = nullptr; - for (auto x : in_memory_modules_) + for (auto x : in_memory_modules_) { if (x.second == module) mem_it = x.first; + } if (mem_it != nullptr) in_memory_modules_.erase(mem_it); } return true; diff --git a/third_party/gpus/cuda_configure.bzl b/third_party/gpus/cuda_configure.bzl index ce924fe4cd2..7e779a993e2 100644 --- a/third_party/gpus/cuda_configure.bzl +++ b/third_party/gpus/cuda_configure.bzl @@ -809,20 +809,24 @@ def make_copy_files_rule(repository_ctx, name, srcs, outs): )""" % (name, "\n".join(outs), " && \\\n".join(cmds)) def make_copy_dir_rule(repository_ctx, name, src_dir, out_dir, exceptions=None): - """Returns a rule to recursively copy a directory.""" + """Returns a rule to recursively copy a directory. + If exceptions is not None, it must be a list of files or directories in + 'src_dir'; these will be excluded from copying. + """ src_dir = _norm_path(src_dir) out_dir = _norm_path(out_dir) outs = read_dir(repository_ctx, src_dir) post_cmd='' if exceptions!=None: - outs = [x for x in outs if not any([x.startswith(y) for y in exceptions])] + outs = [x for x in outs if not any([x.startswith(src_dir+"/"+y) + for y in exceptions])] outs = [(' "%s",' % out.replace(src_dir, out_dir)) for out in outs] # '@D' already contains the relative path for a single file, see # http://docs.bazel.build/versions/master/be/make-variables.html#predefined_genrule_variables out_dir = "$(@D)/%s" % out_dir if len(outs) > 1 else "$(@D)" if exceptions!=None: for x in exceptions: - post_cmd+=" ; rm -fR " + x.replace(src_dir, out_dir) + post_cmd+=" ; rm -fR " + out_dir + "/" + x return """genrule( name = "%s", outs = [ diff --git a/third_party/gpus/rocm_configure.bzl b/third_party/gpus/rocm_configure.bzl index 3f518fb05f1..4cfec2459e4 100644 --- a/third_party/gpus/rocm_configure.bzl +++ b/third_party/gpus/rocm_configure.bzl @@ -615,8 +615,7 @@ def _create_local_rocm_repository(repository_ctx): name = "rocm-include", src_dir = rocm_toolkit_path + "/include", out_dir = "rocm/include", - exceptions = [rocm_toolkit_path + "/include/gtest", - rocm_toolkit_path + "/include/gmock"], + exceptions = ["gtest", "gmock"], ), make_copy_dir_rule( repository_ctx,