From f93e79aab5d571ad354d608f69f628fda2168d20 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" <gardener@tensorflow.org> Date: Wed, 20 Jan 2021 09:53:21 -0800 Subject: [PATCH] Add build support for Linux on riscv64 (64 bit RISC-V) PiperOrigin-RevId: 352813740 Change-Id: I2e8290d28d1a28b993fa381bb433fd1d94ba4e45 --- tensorflow/BUILD | 6 ++++++ third_party/cpuinfo/BUILD.bazel | 6 ++++++ third_party/remote_config/remote_platform_configure.bzl | 2 ++ 3 files changed, 14 insertions(+) diff --git a/tensorflow/BUILD b/tensorflow/BUILD index 4edc7ed88f4..c6419474ae0 100644 --- a/tensorflow/BUILD +++ b/tensorflow/BUILD @@ -266,6 +266,12 @@ config_setting( visibility = ["//visibility:public"], ) +config_setting( + name = "linux_riscv64", + values = {"cpu": "riscv64"}, + visibility = ["//visibility:public"], +) + config_setting( name = "debug", values = { diff --git a/third_party/cpuinfo/BUILD.bazel b/third_party/cpuinfo/BUILD.bazel index cac7cc39b47..8e9239c0efb 100644 --- a/third_party/cpuinfo/BUILD.bazel +++ b/third_party/cpuinfo/BUILD.bazel @@ -103,6 +103,7 @@ cc_library( ":linux_armeabi": COMMON_SRCS + ARM_SRCS + LINUX_SRCS + LINUX_ARM32_SRCS, ":linux_aarch64": COMMON_SRCS + ARM_SRCS + LINUX_SRCS + LINUX_ARM64_SRCS, ":linux_mips64": COMMON_SRCS + LINUX_SRCS, + ":linux_riscv64": COMMON_SRCS + LINUX_SRCS, ":linux_s390x": COMMON_SRCS + LINUX_SRCS, ":macos_x86_64": COMMON_SRCS + X86_SRCS + MACH_SRCS + MACH_X86_SRCS, ":macos_arm64": COMMON_SRCS + MACH_SRCS + MACH_ARM_SRCS, @@ -216,6 +217,11 @@ config_setting( values = {"cpu": "mips64"}, ) +config_setting( + name = "linux_riscv64", + values = {"cpu": "riscv64"}, +) + config_setting( name = "linux_s390x", values = {"cpu": "s390x"}, diff --git a/third_party/remote_config/remote_platform_configure.bzl b/third_party/remote_config/remote_platform_configure.bzl index 0c03c7e98b1..c8a5dc8b877 100644 --- a/third_party/remote_config/remote_platform_configure.bzl +++ b/third_party/remote_config/remote_platform_configure.bzl @@ -26,6 +26,8 @@ def _remote_platform_configure_impl(repository_ctx): cpu = "arm" elif machine_type.startswith("mips64"): cpu = "mips64" + elif machine_type.startswith("riscv64"): + cpu = "riscv64" exec_properties = repository_ctx.attr.platform_exec_properties