From c2e3dbf8c897d37ec1146a321e129198f2ac8423 Mon Sep 17 00:00:00 2001 From: "ag.ramesh" Date: Mon, 19 Oct 2020 17:00:28 -0700 Subject: [PATCH] Address review comments. --- .../core/kernels/mkl/mkl_quantized_conv_ops.h | 2 +- third_party/llvm_openmp/BUILD | 18 ++++++++-------- third_party/llvm_openmp/openmp.bzl | 1 + third_party/mkl/BUILD | 21 +++++++++++-------- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/tensorflow/core/kernels/mkl/mkl_quantized_conv_ops.h b/tensorflow/core/kernels/mkl/mkl_quantized_conv_ops.h index 4ee208f7c95..1624a00331a 100644 --- a/tensorflow/core/kernels/mkl/mkl_quantized_conv_ops.h +++ b/tensorflow/core/kernels/mkl/mkl_quantized_conv_ops.h @@ -74,7 +74,7 @@ void MklQuantizationRangeForMultiplication(float min_a, float max_a, #pragma omp parallel for #endif // !ENABLE_MKLDNN_THREADPOOL // TODO: Add eigen parallel_for - for (ssize_t n = 0; n < n_channel; ++n) { + for (int64_t n = 0; n < n_channel; ++n) { float a_float_for_one_quant_level = MklFloatForOneQuantizedLevel(min_a, max_a); float b_float_for_one_quant_level = diff --git a/third_party/llvm_openmp/BUILD b/third_party/llvm_openmp/BUILD index 719315d65e0..427ac34ef74 100644 --- a/third_party/llvm_openmp/BUILD +++ b/third_party/llvm_openmp/BUILD @@ -1,7 +1,5 @@ # Build file for OpenMP library that is part of llvm -exports_files(["LICENSE.txt"]) - load( "@org_tensorflow//third_party/llvm:llvm.bzl", "cmake_var_string", @@ -16,6 +14,8 @@ load( "dict_add", ) +exports_files(["LICENSE.txt"]) + genrule( name = "kmp_i18n_id", srcs = [ @@ -164,12 +164,12 @@ common_includes = [ cc_binary( name = "libiomp5.so", - srcs = glob(cppsources + [ + srcs = cppsources + [ #linux specific files "runtime/src/z_Linux_util.cpp", "runtime/src/kmp_gsupport.cpp", "runtime/src/z_Linux_asm.S", - ]) + srcdeps, + ] + srcdeps, copts = ["-Domp_EXPORTS -D_GNU_SOURCE -D_REENTRANT"], includes = common_includes, linkopts = ["-lpthread -ldl -Wl,--version-script=$(location :ldscript)"], @@ -179,11 +179,11 @@ cc_binary( cc_binary( name = "libiomp5md.dll", - srcs = glob(cppsources + [ + srcs = cppsources + [ #window specific files "runtime/src/z_Windows_NT_util.cpp", "runtime/src/z_Windows_NT-586_util.cpp", - ]) + srcdeps + [":openmp_asm"], + ] + srcdeps + [":openmp_asm"], copts = ["/Domp_EXPORTS /D_M_AMD64 /DOMPT_SUPPORT=0 /D_WINDOWS /D_WINNT /D_USRDLL"], includes = common_includes, linkopts = ["/MACHINE:X64"], @@ -192,15 +192,15 @@ cc_binary( ) # MacOS build has not been tested, however since the MacOS build of openmp -# uses the same configuration as Lunix, the following should work. +# uses the same configuration as Linux, the following should work. cc_binary( name = "libiomp5.dylib", - srcs = glob(cppsources + [ + srcs = cppsources + [ #linux/MacOS specific files "runtime/src/z_Linux_util.cpp", "runtime/src/kmp_gsupport.cpp", "runtime/src/z_Linux_asm.S", - ]) + srcdeps, + ] + srcdeps, copts = ["-Domp_EXPORTS -D_GNU_SOURCE -D_REENTRANT"], includes = common_includes, linkopts = ["-lpthread -ldl -Wl,--version-script=$(location :ldscript)"], diff --git a/third_party/llvm_openmp/openmp.bzl b/third_party/llvm_openmp/openmp.bzl index 4497c19e1e4..cd11eb00e50 100644 --- a/third_party/llvm_openmp/openmp.bzl +++ b/third_party/llvm_openmp/openmp.bzl @@ -1,5 +1,6 @@ # This file contains BUILD extensions for building llvm_openmp. +# TODO(Intel-tf), delete this and re-use a similar function in third_party/llvm. def dict_add(*dictionaries): """Returns a new `dict` that has all the entries of the given dictionaries. diff --git a/third_party/mkl/BUILD b/third_party/mkl/BUILD index 3f8479daf99..aa65b585b85 100644 --- a/third_party/mkl/BUILD +++ b/third_party/mkl/BUILD @@ -23,25 +23,25 @@ config_setting( config_setting( name = "build_with_mkl_lnx_openmp", + constraint_values = [ + "@platforms//os:linux", + ], define_values = { "build_with_mkl": "true", "build_with_openmp": "true", }, - constraint_values = [ - "@platforms//os:linux" - ], visibility = ["//visibility:public"], ) config_setting( name = "build_with_mkl_windows_openmp", + constraint_values = [ + "@platforms//os:windows", + ], define_values = { "build_with_mkl": "true", "build_with_openmp": "true", }, - constraint_values = [ - "@platforms//os:windows" - ], visibility = ["//visibility:public"], ) @@ -64,7 +64,10 @@ config_setting( filegroup( name = "LICENSE", - srcs = ["MKL_LICENSE"] + ["@llvm_openmp//:LICENSE.txt"], + srcs = [ + "MKL_LICENSE", + "@llvm_openmp//:LICENSE.txt", + ], visibility = ["//visibility:public"], ) @@ -104,10 +107,10 @@ cc_library( ":mkl_libs_linux", ], "@org_tensorflow//tensorflow:macos": [ - ":mkl_libs_darwin", + ":mkl_libs_darwin", ], "@org_tensorflow//tensorflow:windows": [ - ":mkl_libs_windows", + ":mkl_libs_windows", ], "//conditions:default": [], }),