gemm_reduce_fp16.cpp 1.39 KB
Newer Older
Chao Liu's avatar
Chao Liu committed
1
2
3
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2022, Advanced Micro Devices, Inc. All rights reserved.

Chao Liu's avatar
Chao Liu committed
4
5
#include <iostream>

Chao Liu's avatar
Chao Liu committed
6
#include "profiler/include/profile_gemm_reduce_impl.hpp"
Chao Liu's avatar
Chao Liu committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

int main()
{
    using Row = ck::tensor_layout::gemm::RowMajor;
    using Col = ck::tensor_layout::gemm::ColumnMajor;

    int M = 512;
    int N = 256;
    int K = 128;

    bool pass = true;

    pass = pass &&
           ck::profiler::
               profile_gemm_reduce_impl<ck::half_t, ck::half_t, ck::half_t, float, Row, Row, Row>(
JD's avatar
JD committed
22
                   true, 1, false, false, M, N, K, K, N, N);
Chao Liu's avatar
Chao Liu committed
23
24
25
26

    pass = pass &&
           ck::profiler::
               profile_gemm_reduce_impl<ck::half_t, ck::half_t, ck::half_t, float, Row, Col, Row>(
JD's avatar
JD committed
27
                   true, 1, false, false, M, N, K, K, K, N);
Chao Liu's avatar
Chao Liu committed
28
29
30
31

    pass = pass &&
           ck::profiler::
               profile_gemm_reduce_impl<ck::half_t, ck::half_t, ck::half_t, float, Col, Row, Row>(
JD's avatar
JD committed
32
                   true, 1, false, false, M, N, K, M, N, N);
Chao Liu's avatar
Chao Liu committed
33
34
35
36

    pass = pass &&
           ck::profiler::
               profile_gemm_reduce_impl<ck::half_t, ck::half_t, ck::half_t, float, Col, Col, Row>(
JD's avatar
JD committed
37
                   true, 1, false, false, M, N, K, M, K, N);
Chao Liu's avatar
Chao Liu committed
38
39
40
41
42
43
44
45
46
47
48
49

    if(pass)
    {
        std::cout << "test GEMM+Reduce fp16: Pass" << std::endl;
        return 0;
    }
    else
    {
        std::cout << "test GEMM+Reduce fp16: Fail" << std::endl;
        return -1;
    }
}