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