STT-tensorflow/third_party/mkl_dnn/mkldnn.BUILD
Penporn Koanantakool fe1bce6717 Bringing back PR #42339.
PR #42339: [INTEL MKL] MKL DNN v0.x cleanup - Reset MKL build config and remove DNN v0.x related macros

Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/42339

This is the first PR for MKL DNN v0.x clean - for Tensorflow 2.4, only MKL DNN v1.x will be supported
   (1) Reset MKL DNN related build config (mostly in third_part/mkl or mkl_dnn folder)
   (2) Remove MKL DNN v0.x related macros in core/util/mkl_types.c
   (3) Minor code style fix in one MKL kernel op.

There will be a sequence of PR's which will clean up all related MKL kernels ops.

PiperOrigin-RevId: 331205640
Change-Id: I2c3c3671fe8906a5dd18c6b017d05fc69a1e3f59
2020-09-11 13:21:53 -07:00

74 lines
2.2 KiB
Plaintext

exports_files(["LICENSE"])
load(
"@org_tensorflow//third_party:common.bzl",
"template_rule",
)
config_setting(
name = "clang_linux_x86_64",
values = {
"cpu": "k8",
"define": "using_clang=true",
},
)
template_rule(
name = "mkldnn_config_h",
src = "include/mkldnn_config.h.in",
out = "include/mkldnn_config.h",
substitutions = {
"#cmakedefine MKLDNN_CPU_BACKEND MKLDNN_BACKEND_${MKLDNN_CPU_BACKEND}": "#define MKLDNN_CPU_BACKEND MKLDNN_BACKEND_NATIVE",
"#cmakedefine MKLDNN_GPU_BACKEND MKLDNN_BACKEND_${MKLDNN_GPU_BACKEND}": "#define MKLDNN_GPU_BACKEND MKLDNN_BACKEND_NONE",
},
)
# Create the file mkldnn_version.h with MKL-DNN version numbers.
# Currently, the version numbers are hard coded here. If MKL-DNN is upgraded then
# the version numbers have to be updated manually. The version numbers can be
# obtained from the PROJECT_VERSION settings in CMakeLists.txt. The variable is
# set to "version_major.version_minor.version_patch". The git hash version can
# be set to NA.
# TODO(agramesh1) Automatically get the version numbers from CMakeLists.txt.
# TODO(bhavanis): MKL-DNN minor version needs to be updated for MKL-DNN v1.x.
# The current version numbers will work only if MKL-DNN v0.21 is used.
template_rule(
name = "mkldnn_version_h",
src = "include/mkldnn_version.h.in",
out = "include/mkldnn_version.h",
substitutions = {
"@MKLDNN_VERSION_MAJOR@": "0",
"@MKLDNN_VERSION_MINOR@": "21",
"@MKLDNN_VERSION_PATCH@": "3",
"@MKLDNN_VERSION_HASH@": "N/A",
},
)
cc_library(
name = "mkldnn_single_threaded",
srcs = glob([
"src/common/*.cpp",
"src/common/*.hpp",
"src/cpu/*.cpp",
"src/cpu/*.hpp",
"src/cpu/**/*.cpp",
"src/cpu/**/*.hpp",
"src/cpu/xbyak/*.h",
]) + [":mkldnn_version_h"],
hdrs = glob(["include/*"]),
copts = [
"-fexceptions",
"-DMKLDNN_THR=MKLDNN_THR_SEQ", # Disables threading.
],
includes = [
"include",
"src",
"src/common",
"src/cpu",
"src/cpu/gemm",
"src/cpu/xbyak",
],
visibility = ["//visibility:public"],
)