Require dotprod when running the tests on ChromiumOS/ARM64. At the moment this is being used to run tests on emulator, we're currently getting dotprod support there, we don't want to regress that.
PiperOrigin-RevId: 263584804
diff --git a/tensorflow/lite/experimental/ruy/test.h b/tensorflow/lite/experimental/ruy/test.h
index 4081f216..db2ef88 100644
--- a/tensorflow/lite/experimental/ruy/test.h
+++ b/tensorflow/lite/experimental/ruy/test.h
@@ -145,6 +145,32 @@
struct LogCoveredPathsOnDestruction final {
~LogCoveredPathsOnDestruction() {
std::cerr << "Covered paths: " << Join(*CoveredPaths()) << std::endl;
+
+ // When testing on ARM64 ChromiumOS emulator, make sure that we covered
+ // the dotprod path. We're getting such coverage at the moment thanks to
+ // using a sufficiently recent emulator, and we don't want to regress that.
+#if RUY_PLATFORM(ARM_64) && defined RUY_TESTING_ON_CHROMIUMOS
+ bool found_dotprod = false;
+ for (const std::string& covered_path : *CoveredPaths()) {
+ if (covered_path == "kNeonDotprod") {
+ found_dotprod = true;
+ }
+ }
+ if (!found_dotprod) {
+ std::cerr
+ << "Error: we haven't tested the kNeonDotprod path as we should "
+ "have. At the moment, this is required on ChromiumOS as this is "
+ "what we run emulator tests in, that currently supports "
+ "dot-product "
+ "instructions, and we care very much about not regressing that. "
+ "If this test was run in an emulator, please upgrade to a newer "
+ "emulator version. If this test was run on an actual device, and "
+ "you need to be able to run ruy tests on devices not supporting "
+ "dot-product instructions, get in touch with us.\n"
+ << std::endl;
+ abort();
+ }
+#endif
}
static void Singleton() { static LogCoveredPathsOnDestruction singleton; }
};