aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/jemalloc.BUILD
diff options
context:
space:
mode:
authorGravatar Shanqing Cai <cais@google.com>2017-04-22 06:08:17 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-04-22 07:28:38 -0700
commit326942394e69074d50d5889218a24c9371eff259 (patch)
tree50c78852c36b828440761a16650718f224560f7b /third_party/jemalloc.BUILD
parent3c0900a49c11b7975c7accc026153bbc2001c018 (diff)
Merge changes from github.
Change: 153925676
Diffstat (limited to 'third_party/jemalloc.BUILD')
-rw-r--r--third_party/jemalloc.BUILD33
1 files changed, 29 insertions, 4 deletions
diff --git a/third_party/jemalloc.BUILD b/third_party/jemalloc.BUILD
index aabff39d7b..8ed13c51a5 100644
--- a/third_party/jemalloc.BUILD
+++ b/third_party/jemalloc.BUILD
@@ -89,6 +89,14 @@ cc_library(
"-D_REENTRANT",
],
includes = ["include"],
+ # pthread_atfork() is called for PPC.
+ linkopts = select({
+ "@%ws%//tensorflow:linux_ppc64le": [
+ "-lpthread",
+ ],
+ "//conditions:default": [
+ ],
+ }),
visibility = ["//visibility:public"],
)
@@ -183,12 +191,17 @@ sh_binary(
srcs = ["include/jemalloc/internal/size_classes.sh"],
)
-# Size classes for Linux x86_64. Update if adding builds for other
+# Size classes for Linux x86_64 and ppc64le. Update if adding builds for other
# architectures. See size_classes.sh for details on the arguments.
+# For default case, kept the arguments same as that of x86_64 for now.
genrule(
name = "size_classes_h",
outs = ["include/jemalloc/internal/size_classes.h"],
- cmd = "$(location :size_classes_sh) \"3 4\" 3 12 2 >$@",
+ cmd = select({
+ "@%ws%//tensorflow:linux_ppc64le": "$(location :size_classes_sh) \"3 4\" 3 16 2 >$@",
+ "@%ws%//tensorflow:linux_x86_64": "$(location :size_classes_sh) \"3 4\" 3 12 2 >$@",
+ "//conditions:default": "$(location :size_classes_sh) \"3 4\" 3 12 2 >$@",
+ }),
tools = [":size_classes_sh"],
)
@@ -210,7 +223,13 @@ template_rule(
"#undef JEMALLOC_PREFIX": "#define JEMALLOC_PREFIX \"jemalloc_\"",
"#undef JEMALLOC_CPREFIX": "#define JEMALLOC_CPREFIX \"JEMALLOC_\"",
"#undef JEMALLOC_PRIVATE_NAMESPACE": "#define JEMALLOC_PRIVATE_NAMESPACE je_",
- "#undef CPU_SPINWAIT": "#define CPU_SPINWAIT __asm__ volatile(\"pause\")",
+ "#undef CPU_SPINWAIT": "\n".join([
+ "#if defined(__powerpc64__) || defined(__powerpc__)",
+ "#define CPU_SPINWAIT __asm__ volatile(\"or 27,27,27\")",
+ "#else",
+ "#define CPU_SPINWAIT __asm__ volatile(\"pause\")",
+ "#endif",
+ ]),
"#undef JEMALLOC_HAVE_BUILTIN_CLZ": "#define JEMALLOC_HAVE_BUILTIN_CLZ",
"#undef JEMALLOC_USE_SYSCALL": "#define JEMALLOC_USE_SYSCALL",
"#undef JEMALLOC_HAVE_SECURE_GETENV": "#define JEMALLOC_HAVE_SECURE_GETENV",
@@ -226,7 +245,13 @@ template_rule(
"#undef JEMALLOC_DSS": "#define JEMALLOC_DSS",
"#undef JEMALLOC_FILL": "#define JEMALLOC_FILL",
"#undef LG_TINY_MIN": "#define LG_TINY_MIN 3",
- "#undef LG_PAGE": "#define LG_PAGE 12",
+ "#undef LG_PAGE": "\n".join([
+ "#if defined(__powerpc64__) || defined(__powerpc__)",
+ "#define LG_PAGE 16",
+ "#else",
+ "#define LG_PAGE 12",
+ "#endif",
+ ]),
"#undef JEMALLOC_MAPS_COALESCE": "#define JEMALLOC_MAPS_COALESCE",
"#undef JEMALLOC_TLS": "#define JEMALLOC_TLS",
"#undef JEMALLOC_INTERNAL_UNREACHABLE": "#define JEMALLOC_INTERNAL_UNREACHABLE __builtin_unreachable",