Add arm64 support
This patch adds `--config=arm64` and `--cpu=arm64` flags for users to
compile for the 64-bit version of the Raspberry Pi.
The existing 32-bit ARM build should still work. This patch only adds
additional 64-bit capabilities. Future patches can remove 32-bit
support.
Eigen needed some tweaks because we have `LDBL_MANT_DIG` of 113 on
arm64. None of the code paths that used the parameters `U` and `V`
actually gets compiled in. Adding `[[maybe_unused]]` fixed the error.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: Ibf919b2964fe971769449a1c556c13e3bf1d48e9
diff --git a/third_party/BUILD b/third_party/BUILD
index 040d3f7..aff739f 100644
--- a/third_party/BUILD
+++ b/third_party/BUILD
@@ -42,6 +42,7 @@
deps = select({
"//tools:cpu_k8": ["@opencv_k8//:opencv"],
"//tools:cpu_armhf": ["@opencv_armhf//:opencv"],
+ "//tools:cpu_arm64": ["@opencv_arm64//:opencv"],
"//conditions:default": [":unavailable"],
}),
)
@@ -86,6 +87,7 @@
deps = select({
"//tools:cpu_k8": ["@halide_k8//:runtime"],
"//tools:cpu_armhf": ["@halide_armhf//:runtime"],
+ "//tools:cpu_arm64": ["@halide_arm64//:runtime"],
"//conditions:default": [":unavailable"],
}),
)
@@ -95,7 +97,7 @@
visibility = ["//visibility:public"],
deps = select({
"//tools:cpu_k8": ["@lzma_amd64//:lib"],
- "//tools:cpu_aarch64": ["@lzma_arm64//:lib"],
+ "//tools:cpu_arm64": ["@lzma_arm64//:lib"],
"//conditions:default": [":unavailable"],
}),
)
diff --git a/third_party/bazel-toolchain/toolchain/internal/llvm_distributions.bzl b/third_party/bazel-toolchain/toolchain/internal/llvm_distributions.bzl
index 4ba4601..4cdbf75 100644
--- a/third_party/bazel-toolchain/toolchain/internal/llvm_distributions.bzl
+++ b/third_party/bazel-toolchain/toolchain/internal/llvm_distributions.bzl
@@ -180,6 +180,7 @@
"clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz": "d051234eca1db1f5e4bc08c64937c879c7098900f7a0370f3ceb7544816a8b09",
"clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz": "76d0bf002ede7a893f69d9ad2c4e101d15a8f4186fbfe24e74856c8449acd7c1",
"clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz": "2c2fb857af97f41a5032e9ecadf7f78d3eff389a5cd3c9ec620d24f134ceb3c8",
+ "clang+llvm-13.0.0-aarch64-linux-gnu.tar.xz": "968d65d2593850ee9b37fcda074fb7641529bd45d2f976af6c8197de3c22612f",
}
# Note: Unlike the user-specified llvm_mirror attribute, the URL prefixes in
diff --git a/third_party/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h b/third_party/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
index e5ebbcf..3519611 100644
--- a/third_party/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
+++ b/third_party/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
@@ -264,7 +264,7 @@
struct matrix_exp_computeUV<MatrixType, long double>
{
template <typename ArgType>
- static void run(const ArgType& arg, MatrixType& U, MatrixType& V, int& squarings)
+ static void run(const ArgType& arg, [[maybe_unused]] MatrixType& U, [[maybe_unused]] MatrixType& V, int& squarings)
{
#if LDBL_MANT_DIG == 53 // double precision
matrix_exp_computeUV<MatrixType, double>::run(arg, U, V, squarings);
@@ -273,7 +273,7 @@
using std::frexp;
using std::pow;
- const long double l1norm = arg.cwiseAbs().colwise().sum().maxCoeff();
+ [[maybe_unused]] const long double l1norm = arg.cwiseAbs().colwise().sum().maxCoeff();
squarings = 0;
#if LDBL_MANT_DIG <= 64 // extended precision
diff --git a/third_party/gperftools/BUILD b/third_party/gperftools/BUILD
index 7dd86dc..2022ee6 100644
--- a/third_party/gperftools/BUILD
+++ b/third_party/gperftools/BUILD
@@ -102,12 +102,18 @@
"-DPRIuS=\\\"lu\\\"",
"-DPRIxS=\\\"lx\\\"",
],
- "arm": [
+ "arm32": [
"-DPC_FROM_UCONTEXT=uc_mcontext.arm_pc",
"-DPRIdS=\\\"d\\\"",
"-DPRIuS=\\\"u\\\"",
"-DPRIxS=\\\"x\\\"",
],
+ "arm64": [
+ "-DPC_FROM_UCONTEXT=uc_mcontext.pc",
+ "-DPRIdS=\\\"ld\\\"",
+ "-DPRIuS=\\\"lu\\\"",
+ "-DPRIxS=\\\"lx\\\"",
+ ],
}) + compiler_select({
"clang": [
"-Wno-unused-const-variable",