1exports_files(["LICENSE"])
2
3load(
4    "@org_tensorflow//third_party:common.bzl",
5    "template_rule",
6)
7
8config_setting(
9    name = "clang_linux_x86_64",
10    values = {
11        "cpu": "k8",
12        "define": "using_clang=true",
13    },
14)
15
16template_rule(
17    name = "mkldnn_config_h",
18    src = "include/mkldnn_config.h.in",
19    out = "include/mkldnn_config.h",
20    substitutions = {
21        "#cmakedefine MKLDNN_CPU_BACKEND MKLDNN_BACKEND_${MKLDNN_CPU_BACKEND}": "#define MKLDNN_CPU_BACKEND MKLDNN_BACKEND_NATIVE",
22        "#cmakedefine MKLDNN_GPU_BACKEND MKLDNN_BACKEND_${MKLDNN_GPU_BACKEND}": "#define MKLDNN_GPU_BACKEND MKLDNN_BACKEND_NONE",
23    },
24)
25
26# Create the file mkldnn_version.h with MKL-DNN version numbers.
27# Currently, the version numbers are hard coded here. If MKL-DNN is upgraded then
28# the version numbers have to be updated manually. The version numbers can be
29# obtained from the PROJECT_VERSION settings in CMakeLists.txt. The variable is
30# set to "version_major.version_minor.version_patch". The git hash version can
31# be set to NA.
32# TODO(agramesh1) Automatically get the version numbers from CMakeLists.txt.
33# TODO(bhavanis): MKL-DNN minor version needs to be updated for MKL-DNN v1.x.
34# The current version numbers will work only if MKL-DNN v0.21 is used.
35
36template_rule(
37    name = "mkldnn_version_h",
38    src = "include/mkldnn_version.h.in",
39    out = "include/mkldnn_version.h",
40    substitutions = {
41        "@MKLDNN_VERSION_MAJOR@": "0",
42        "@MKLDNN_VERSION_MINOR@": "21",
43        "@MKLDNN_VERSION_PATCH@": "3",
44        "@MKLDNN_VERSION_HASH@": "N/A",
45    },
46)
47
48cc_library(
49    name = "mkldnn_single_threaded",
50    srcs = glob([
51        "src/common/*.cpp",
52        "src/common/*.hpp",
53        "src/cpu/*.cpp",
54        "src/cpu/*.hpp",
55        "src/cpu/**/*.cpp",
56        "src/cpu/**/*.hpp",
57        "src/cpu/xbyak/*.h",
58    ]) + [":mkldnn_version_h"],
59    hdrs = glob(["include/*"]),
60    copts = select({
61        "@org_tensorflow//tensorflow:windows": [],
62        "//conditions:default": ["-fexceptions"],
63    }) + [
64        "-DMKLDNN_THR=MKLDNN_THR_SEQ",  # Disables threading.
65    ],
66    includes = [
67        "include",
68        "src",
69        "src/common",
70        "src/cpu",
71        "src/cpu/gemm",
72        "src/cpu/xbyak",
73    ],
74    visibility = ["//visibility:public"],
75)
76