Switch to a preconfigured Clang for k8 and armv7
This one reuses more of Bazel's builtin features to remain up to date
more easily, and it's easier to expand support for more platforms. This
also takes care of upgrading to a newer Clang.
This will require updating to raspios bullseye on the Raspberry Pis.
This also renames armhf-debian to armv7 to match the broader Bazel
ecosystem's name for this architecture.
Change-Id: I3e2a4f4efea43e76314ca34a9293c7b4b45edd2c
Signed-off-by: Brian Silverman <bsilver16834@gmail.com>
diff --git a/y2020/vision/sift/fast_gaussian.bzl b/y2020/vision/sift/fast_gaussian.bzl
index b699282..fdf5afe 100644
--- a/y2020/vision/sift/fast_gaussian.bzl
+++ b/y2020/vision/sift/fast_gaussian.bzl
@@ -37,12 +37,12 @@
]) + " " + cpu_select({
"amd64": "k8",
"roborio": "roborio",
- "armhf": "armhf-debian",
+ "armhf": "armv7",
"cortex-m": "cortex-m",
"cortex-m0plus": "cortex-m0plus",
}),
outs = headers + objects + htmls,
- # The tool doesn't support anything other than k8 and armhf-debian
+ # The tool doesn't support anything other than k8 and armv7.
# right now.
target_compatible_with = platforms.any_of([
"@platforms//cpu:x86_64",
diff --git a/y2020/vision/sift/fast_gaussian_halide_generator.sh b/y2020/vision/sift/fast_gaussian_halide_generator.sh
index d808296..a90f218 100755
--- a/y2020/vision/sift/fast_gaussian_halide_generator.sh
+++ b/y2020/vision/sift/fast_gaussian_halide_generator.sh
@@ -29,7 +29,7 @@
ZLIB1G_DEV="$(mktemp -d)"
-LLVM_TOOLCHAIN="$(dirname "$(dirname "$(rlocation llvm_toolchain_llvm/bin/clang)")")"
+LLVM_TOOLCHAIN="$(dirname "$(dirname "$(rlocation llvm_k8/bin/clang)")")"
dpkg-deb -x "${ZLIB1G_DEV_AMD64_DEB}" "${ZLIB1G_DEV}"
TARGET=x86_64-unknown-linux-gnu
MULTIARCH=x86_64-linux-gnu
@@ -40,8 +40,8 @@
-fcolor-diagnostics \
-I"${HALIDE}/include" \
-nostdinc \
- -isystem"${SYSROOT}/usr/include/c++/7" \
- -isystem"${SYSROOT}/usr/include/${MULTIARCH}/c++/7" \
+ -isystem"${SYSROOT}/usr/include/c++/10" \
+ -isystem"${SYSROOT}/usr/include/${MULTIARCH}/c++/10" \
-isystem"${SYSROOT}/usr/include/c++/7/backward" \
-isystem"${LLVM_TOOLCHAIN}/lib/clang/13.0.0/include" \
-isystem"${SYSROOT}/usr/include/${MULTIARCH}" \
diff --git a/y2020/vision/sift/fast_gaussian_runner.py b/y2020/vision/sift/fast_gaussian_runner.py
index 6faa9fc..cc45208 100755
--- a/y2020/vision/sift/fast_gaussian_runner.py
+++ b/y2020/vision/sift/fast_gaussian_runner.py
@@ -16,7 +16,7 @@
target_cpu = sys.argv[3]
target = {
- 'armhf-debian': 'arm-32-linux-no_asserts',
+ 'armv7': 'arm-32-linux-no_asserts',
'k8': 'x86-64-linux-no_asserts',
}[target_cpu]
diff --git a/y2020/vision/sift/fast_gaussian_test.cc b/y2020/vision/sift/fast_gaussian_test.cc
index a34c6c7..73fd8a7 100644
--- a/y2020/vision/sift/fast_gaussian_test.cc
+++ b/y2020/vision/sift/fast_gaussian_test.cc
@@ -1,8 +1,8 @@
#include "y2020/vision/sift/fast_gaussian.h"
#include <opencv2/imgproc.hpp>
-#include "gtest/gtest.h"
+#include "gtest/gtest.h"
#include "y2020/vision/sift/fast_gaussian_all.h"
namespace frc971 {
@@ -36,13 +36,14 @@
ExpectEqual(default_blurred, explicitly_blurred);
}
-// Verifies that with 8U just a 9x9 blur is as much as you get.
-TEST_F(FastGaussianTest, GaussianSizeS8) {
+// Verifies that with 8U just a 9x9 blur is as much as you get, except for a bit
+// of rounding.
+TEST_F(FastGaussianTest, GaussianSize8U) {
const auto image = RandomImage(500, 500, CV_8UC3);
cv::Mat big_blurred, little_blurred;
cv::GaussianBlur(image, big_blurred, cv::Size(15, 15), 1.6, 1.6);
cv::GaussianBlur(image, little_blurred, cv::Size(9, 9), 1.6, 1.6);
- ExpectEqual(big_blurred, little_blurred);
+ ExpectEqual(big_blurred, little_blurred, 3);
}
// Verifies that FastGaussian and cv::GaussianBlur give the same result.
@@ -62,7 +63,6 @@
DoGeneratedFastGaussian(MatToHalide<const int16_t>(image),
MatToHalide<int16_t>(fast_direct), kSigma));
-
// 1500/65536 = 0.0228, which is under 3%, which is pretty close.
ExpectEqual(slow, fast, 1500);
// The wrapper should be calling the exact same code, so it should end up with