Reviewer requests

This commit is contained in:
Eugene Kuznetsov 2020-05-15 19:34:30 +00:00
parent 0a980f2969
commit 8dd2845769
3 changed files with 10 additions and 6 deletions

View File

@ -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;

View File

@ -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 = [

View File

@ -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,