From f7ea583082c670103fb2cebd6035b944c71d64c4 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 27 Mar 2020 21:58:51 -0400 Subject: 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 --- ruy/test_slow.cc | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 ruy/test_slow.cc (limited to 'ruy/test_slow.cc') 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>; + +TEST(RuyTest, TestBigNarrowMuls) { + for (int width : {1, 2, 3, 4, 5, 8}) { + TestRCC(width, 401, 601); + TestRCC(587, 443, width); + } + TestRCC(7, 45984, + 5); // Large enough to trigger row-sum overflows. + TestRCC(512, 256, 16); +} + +TEST(RuyTest, TestBigShallowMuls) { + TestLinearAllOrders(501, 1, 321); + TestLinearAllOrders(301, 5, 403); + TestLinearAllOrders(256, 32, 512); +} + +TEST(RuyTest, TestBigMuls) { + TestRCC(225, 303, 199); + TestLinearAllOrders(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(70, 1024, 80); + TestLinearAllOrders(60, 2048, 70); + TestLinearAllOrders(40, 4096, 50); +} + +TEST(RuyTest, TestGEMV) { + for (int size = 1025; size <= 1409; size += 384) { + for (int depth = 350; depth < 500; depth += 47) { + TestLinearAllOrders(size, depth, 1); + } + } +} + +} // namespace ruy -- cgit v1.2.3