"include/ck/config.hpp" did not exist on "2778e99758e149a6cb5309ca307bf7c1e61a562f"
gemm_dl_fp16.cpp 3.24 KB
Newer Older
Chao Liu's avatar
Chao Liu committed
1
// SPDX-License-Identifier: MIT
Illia Silin's avatar
Illia Silin committed
2
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
Chao Liu's avatar
Chao Liu committed
3

4
#include "common.hpp"
Jianfeng Yan's avatar
Jianfeng Yan committed
5

6
#include "ck/tensor_operation/gpu/device/impl/device_gemm_dl.hpp"
Jianfeng Yan's avatar
Jianfeng Yan committed
7
8

using ADataType   = ck::half_t;
Jing Zhang's avatar
Jing Zhang committed
9
using BDataType   = int8_t;
Jianfeng Yan's avatar
Jianfeng Yan committed
10
11
12
using CDataType   = ck::half_t;
using AccDataType = float;

Jing Zhang's avatar
Jing Zhang committed
13
using ALayout = Row;
Jing Zhang's avatar
Jing Zhang committed
14
using BLayout = Row;
Jianfeng Yan's avatar
Jianfeng Yan committed
15
16
using CLayout = Row;

17
18
19
using AElementOp = PassThrough;
using BElementOp = PassThrough;
using CElementOp = PassThrough;
Jianfeng Yan's avatar
Jianfeng Yan committed
20

Jing Zhang's avatar
Jing Zhang committed
21
22
// static constexpr auto GemmDefault = ck::tensor_operation::device::GemmSpecialization::Default;
static constexpr auto GemmMNPadding = ck::tensor_operation::device::GemmSpecialization::MNPadding;
Jianfeng Yan's avatar
Jianfeng Yan committed
23
24

// clang-format off
25
using DeviceGemmInstance = ck::tensor_operation::device::DeviceGemmDl
Jing Zhang's avatar
Jing Zhang committed
26
// ######|     AData|     BData|     CData|     AccData| ALayout| BLayout| CLayout|           A|           B|           C|           GEMM| Block|  MPer|  NPer| K0Per| K1|      M1Per|      N1Per|   KPer|     ABlockTransfer|       ABlockTransfer| ABlockTransfer| ABlockTransfer|      ABlockTransfer|     ABlockTransfer|      ABlockTransfer| BBlockTransfer|  BThreadTransfer|    BThreadTransfer|     CThreadTransfer| CThreadTransfer|    CThreadTransfer|
Jing Zhang's avatar
Jing Zhang committed
27
28
29
// ######|      Type|      Type|      Type|        Type|        |        |        | Elementwise| Elementwise| Elementwise| Spacialization|  Size| Block| Block| Block|   | ThreadM111| ThreadN111| Thread| ThreadSliceLengths| ThreadClusterLengths|  ThreadCluster|      SrcAccess|     SrcVectorTensor|    SrcVectorTensor|     DstVectorTensor|      SrcAccess|     SrcVectorDim| SrcScalarPerVector|        SrcDstAccess| SrcDstVectorDim| DstScalarPerVector|
// ######|          |          |          |            |        |        |        |   Operation|   Operation|   Operation|               |      |      |      |      |   |           |           |       |        K0_M0_M1_K1|          K0_M0_M1_K1|   ArrangeOrder|          Order| Lengths_K0_M0_M1_K1| ContiguousDimOrder| Lengths_K0_M0_M1_K1|          Order|                 |                   |               Order|                |                   |
// ######|          |          |          |            |        |        |        |            |            |            |               |      |      |      |      |   |           |           |       |                   |                     |               |               |                    |                   |                    |               |                 |                   |                    |                |                   |
Jing Zhang's avatar
Jing Zhang committed
30
         < ADataType, BDataType, CDataType, AccDataType, ALayout, BLayout, CLayout,  AElementOp,  BElementOp,  CElementOp,  GemmMNPadding,    64,     1,   512,     2,  4,          1,          8,      1,      S<1, 1, 1, 4>,       S<2, 1,  1, 1>,  S<1, 2, 0, 3>,  S<1, 2, 0, 3>,       S<1, 1, 1, 4>,      S<1, 2, 0, 3>,       S<1, 1, 1, 4>,  S<1, 2, 0, 3>,                2,                  8, S<0, 1, 2, 3, 4, 5>,               5,                  1>;
Jianfeng Yan's avatar
Jianfeng Yan committed
31
32
33
// clang-format on

using ReferenceGemmInstance = ck::tensor_operation::host::
34
    ReferenceGemm<ADataType, BDataType, CDataType, AccDataType, AElementOp, BElementOp, CElementOp>;
Jianfeng Yan's avatar
Jianfeng Yan committed
35

36
#include "run_gemm_example.inc"
Jianfeng Yan's avatar
Jianfeng Yan committed
37

38
int main(int argc, char* argv[]) { return !run_gemm_example(argc, argv); }