test_transpose.cpp 1.09 KB
Newer Older
arai713's avatar
arai713 committed
1
2
3
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2022, Advanced Micro Devices, Inc. All rights reserved.
#include "gtest/gtest.h"
arai713's avatar
arai713 committed
4
#include "profiler/profile_transpose_impl.hpp"
arai713's avatar
arai713 committed
5
6
7

using F16 = ck::half_t;
using F32 = float;
arai713's avatar
arai713 committed
8
using ck::index_t;
arai713's avatar
arai713 committed
9
10
11
12

template <typename Tuple>
class TestTranspose : public ::testing::Test
{
arai713's avatar
arai713 committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    protected:
    using ADataType = std::tuple_element_t<0, Tuple>;
    using BDataType = std::tuple_element_t<1, Tuple>;

    void Run()
    {
        std::vector<std::vector<ck::index_t>> lengths = {
            {4, 16, 16, 32, 5}, {8, 16, 16, 32, 8} /**{32, 16, 16, 32, 8},**/};

        for(auto length : lengths)
        {
            bool success = ck::profiler::profile_transpose_impl<ADataType, BDataType, 5>(
                true, 2, false, false, length);
            EXPECT_TRUE(success);
        }
    }
arai713's avatar
arai713 committed
29
30
};

arai713's avatar
arai713 committed
31
using KernelTypes = ::testing::Types<std::tuple<F16, F16>, std::tuple<F32, F32>>;
arai713's avatar
arai713 committed
32
33

TYPED_TEST_SUITE(TestTranspose, KernelTypes);
arai713's avatar
arai713 committed
34
35
TYPED_TEST(TestTranspose, Test_FP16) { this->Run(); }
TYPED_TEST(TestTranspose, Test_FP32) { this->Run(); }