1 // SPDX-License-Identifier: Apache-2.0
2 
3 // SpGEMM Test Fixtures
4 // Provides test setup and teardown, data generators and covers
5 // all 12 cases for the masked GEMM ( C, M, A, B) in GraphBLAS
6 // Connects to the jitFactory for launches.
7 
8 #include <cassert>
9 #include <cmath>
10 #include <random>
11 #include <algorithm>
12 #include <cstdint>
13 #include "jitTestFactory.hpp"
14 #include "gtest/gtest.h"
15 
16 
17 //Test generators using jitify
18 
19 
TEST(SpGEMMvsvsTest,PlusTimesLongBoolIntInt)20 TEST(SpGEMMvsvsTest, PlusTimesLongBoolIntInt) {
21   test_spGEMM_vsvs_factory<int64_t, uint8_t, int, int>(5, 32, 256, 128, "PLUS_TIMES");
22 }
23 
TEST(SpGEMMvsvsTest,PlusTimesInt4Test)24 TEST(SpGEMMvsvsTest, PlusTimesInt4Test ) {
25 
26   test_spGEMM_vsvs_factory<int, int, int, int>(5, 32, 256, 128, "PLUS_TIMES");
27 }
28 
TEST(SpGEMMvsvsTest,PlusTimesInt4TestMed)29 TEST(SpGEMMvsvsTest, PlusTimesInt4TestMed ) {
30 
31   test_spGEMM_vsvs_factory<int, int, int, int>(5, 4096, 25600, 25600, "PLUS_TIMES");
32 }
33 
TEST(SpGEMMvsvsTest,PlusTimesFloat4Test)34 TEST(SpGEMMvsvsTest, PlusTimesFloat4Test ) {
35 
36   test_spGEMM_vsvs_factory<float, float, float, float>(5, 32, 256, 128, "PLUS_TIMES");
37 }
38 
TEST(SpGEMMvsdnTest,PlusTimesInt4Test)39 TEST(SpGEMMvsdnTest, PlusTimesInt4Test) {
40 
41   test_spGEMM_vsdn_factory<int, int, int, int>(5, 32, 256, 32*32, "PLUS_TIMES");
42 }
TEST(SpGEMMvsdnTest,PlusTimesInt4TestMed)43 TEST(SpGEMMvsdnTest, PlusTimesInt4TestMed) {
44 
45   test_spGEMM_vsdn_factory<int, int, int, int>(5, 256, 4096, 256*256, "PLUS_TIMES");
46 }
47 
TEST(Reductions,PlusFloat)48 TEST( Reductions, PlusFloat) {
49   test_reducefactoryUM<float>(4096, "PLUS");
50 }
51 
TEST(Reductions,PlusDouble)52 TEST( Reductions, PlusDouble) {
53   test_reducefactoryUM<double>(4096, "PLUS");
54 }
55 
TEST(Reductions,MinFloat)56 TEST( Reductions, MinFloat) {
57   test_reducefactoryUM<float>(32,"MIN");
58 }
59 
TEST(Reductions,MinInt)60 TEST( Reductions, MinInt) {
61   test_reducefactoryUM<int>(32,"MIN");
62 }
63 
TEST(Reductions,MaxInt)64 TEST( Reductions, MaxInt) {
65   test_reducefactoryUM<int>(32,"MAX");
66 }
67 
68