Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/google/ruy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Jacob <benoitjacob@google.com>2020-03-28 04:58:51 +0300
committerBenoit Jacob <benoitjacob@google.com>2020-03-30 23:51:39 +0300
commitf7ea583082c670103fb2cebd6035b944c71d64c4 (patch)
tree4a58b4b3a210fc78776e16cf19b46e671714ac4a /ruy/test_slow.cc
parent299a33a5c2affb88c75726c77be6dd4491418b17 (diff)
Move ruy's code to a ruy/ subdirectory.
The motivation is that having source files in the repository root runs into a number of corner cases with copybara setups and with external CMake build systems, so enclosing all code in ruy/ avoids that while generally making our setup much more similar to that of other related projects (TensorFlow, IREE). PiperOrigin-RevId: 303448881
Diffstat (limited to 'ruy/test_slow.cc')
-rw-r--r--ruy/test_slow.cc71
1 files changed, 71 insertions, 0 deletions
diff --git a/ruy/test_slow.cc b/ruy/test_slow.cc
new file mode 100644
index 0000000..9f0f218
--- /dev/null
+++ b/ruy/test_slow.cc
@@ -0,0 +1,71 @@
+/* Copyright 2019 Google LLC. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+// This test contains more expensive test cases.
+
+#include "ruy/test.h"
+
+namespace ruy {
+
+using LhsScalar = RUY_TEST_LHSSCALAR;
+using RhsScalar = RUY_TEST_RHSSCALAR;
+using AccumScalar = RUY_TEST_ACCUMSCALAR;
+using DstScalar = RUY_TEST_DSTSCALAR;
+
+using TestSetType =
+ TestSet<LhsScalar, RhsScalar, BasicSpec<AccumScalar, DstScalar>>;
+
+TEST(RuyTest, TestBigNarrowMuls) {
+ for (int width : {1, 2, 3, 4, 5, 8}) {
+ TestRCC<TestSetType>(width, 401, 601);
+ TestRCC<TestSetType>(587, 443, width);
+ }
+ TestRCC<TestSetType>(7, 45984,
+ 5); // Large enough to trigger row-sum overflows.
+ TestRCC<TestSetType>(512, 256, 16);
+}
+
+TEST(RuyTest, TestBigShallowMuls) {
+ TestLinearAllOrders<TestSetType>(501, 1, 321);
+ TestLinearAllOrders<TestSetType>(301, 5, 403);
+ TestLinearAllOrders<TestSetType>(256, 32, 512);
+}
+
+TEST(RuyTest, TestBigMuls) {
+ TestRCC<TestSetType>(225, 303, 199);
+ TestLinearAllOrders<TestSetType>(256, 192, 128);
+}
+
+TEST(RuyTest, TestBigPowerOfTwoDepthWithAvoidAliasing) {
+ // Important to test some power-of-two depths: that's when the
+ // RUY_AVOID_ALIASING optimization kicks in and makes packed matrices
+ // strided, exposing bugs in kernels mixing up size and stride.
+ // Moreover, it's important that the test matrices be sufficiently wide
+ // that they will result in multiple blocks, exposing bugs in the
+ // computation of the base address of each block.
+ TestLinearAllOrders<TestSetType>(70, 1024, 80);
+ TestLinearAllOrders<TestSetType>(60, 2048, 70);
+ TestLinearAllOrders<TestSetType>(40, 4096, 50);
+}
+
+TEST(RuyTest, TestGEMV) {
+ for (int size = 1025; size <= 1409; size += 384) {
+ for (int depth = 350; depth < 500; depth += 47) {
+ TestLinearAllOrders<TestSetType>(size, depth, 1);
+ }
+ }
+}
+
+} // namespace ruy