diff --git a/tensorflow/compiler/xla/service/cpu/BUILD b/tensorflow/compiler/xla/service/cpu/BUILD index 41e2a3e08d2..0a9b749e8e8 100644 --- a/tensorflow/compiler/xla/service/cpu/BUILD +++ b/tensorflow/compiler/xla/service/cpu/BUILD @@ -229,6 +229,9 @@ cc_library( "@llvm-project//llvm:Target", "@llvm-project//llvm:X86CodeGen", # fixdeps: keep ] + select({ + "//tensorflow:linux_aarch64": [ + "@llvm-project//llvm:AArch64CodeGen", # fixdeps: keep + ], "//tensorflow:linux_ppc64le": [ "@llvm-project//llvm:PowerPCCodeGen", # fixdeps: keep ], diff --git a/tensorflow/compiler/xla/service/cpu/test_target_triple_helper.h b/tensorflow/compiler/xla/service/cpu/test_target_triple_helper.h index bfd04ab60a7..a57ebb9b37c 100644 --- a/tensorflow/compiler/xla/service/cpu/test_target_triple_helper.h +++ b/tensorflow/compiler/xla/service/cpu/test_target_triple_helper.h @@ -16,18 +16,19 @@ limitations under the License. #ifndef TENSORFLOW_TEST_TARGET_TRIPLE_HELPER_H_ #define TENSORFLOW_TEST_TARGET_TRIPLE_HELPER_H_ -#if (defined(__powerpc__) || \ - defined(__ppc__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) +#if defined(__aarch64__) +static const char kTargetCpuForHost[] = "aarch64"; +static const char kTargetTripleForHost[] = "aarch64-unknown-linux-gnu", +#elif (defined(__powerpc__) || \ + defined(__ppc__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) static const char kTargetCpuForHost[] = "ppc"; static const char kTargetTripleForHost[] = "ppc64le-ibm-linux-gnu"; -#else -#if defined(__s390x__) +#elif defined(__s390x__) static const char kTargetCpuForHost[] = "s390x"; static const char kTargetTripleForHost[] = "systemz-none-linux-gnu"; #else static const char kTargetCpuForHost[] = ""; static const char kTargetTripleForHost[] = "x86_64-pc-linux"; #endif -#endif #endif diff --git a/third_party/llvm/llvm.bzl b/third_party/llvm/llvm.bzl index e025fb2eb13..6d11002023e 100644 --- a/third_party/llvm/llvm.bzl +++ b/third_party/llvm/llvm.bzl @@ -315,6 +315,14 @@ llvm_all_cmake_vars = select({ darwin_cmake_vars, ), ), + "@org_tensorflow//tensorflow:linux_aarch64": cmake_var_string( + _dict_add( + cmake_vars, + llvm_target_cmake_vars("AArch64", "aarch64-unknown-linux_gnu"), + posix_cmake_vars, + linux_cmake_vars, + ), + ), "@org_tensorflow//tensorflow:linux_ppc64le": cmake_var_string( _dict_add( cmake_vars,