contraction_bilinear_xdl_fp32.cpp 4.48 KB
Newer Older
1
// SPDX-License-Identifier: MIT
Illia Silin's avatar
Illia Silin committed
2
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
3
4
5
6

#include "ck/ck.hpp"
#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp"

7
#include "common_instances.hpp"
8
9
10
11
12
13
14
15
16
17

using F32 = float;

using ADataType        = F32;
using BDataType        = F32;
using AccDataType      = F32;
using CShuffleDataType = F32;
using DDataType        = F32;
using DsDataType       = ck::Tuple<DDataType>;
using EDataType        = F32;
18
using ComputeDataType  = F32;
19
20
21
22
23
24
25
26
27

static constexpr ck::index_t NumDimM = 2;
static constexpr ck::index_t NumDimN = 2;
static constexpr ck::index_t NumDimK = 2;

using AElementOp   = ck::tensor_operation::element_wise::PassThrough;
using BElementOp   = ck::tensor_operation::element_wise::PassThrough;
using CDEElementOp = ck::tensor_operation::element_wise::Bilinear;

28
29
30
31
32
33
34
35
36
37
38
39
40
using DeviceOpInstanceKKNN = DeviceOpInstanceKK_Generic<NumDimM,
                                                        NumDimN,
                                                        NumDimK,
                                                        ADataType,
                                                        BDataType,
                                                        AccDataType,
                                                        CShuffleDataType,
                                                        DsDataType,
                                                        EDataType,
                                                        ComputeDataType,
                                                        AElementOp,
                                                        BElementOp,
                                                        CDEElementOp>;
41

42
43
44
45
46
47
48
49
50
51
52
53
54
using DeviceOpInstanceKNNN = DeviceOpInstanceKN_Generic<NumDimM,
                                                        NumDimN,
                                                        NumDimK,
                                                        ADataType,
                                                        BDataType,
                                                        AccDataType,
                                                        CShuffleDataType,
                                                        DsDataType,
                                                        EDataType,
                                                        ComputeDataType,
                                                        AElementOp,
                                                        BElementOp,
                                                        CDEElementOp>;
55

56
57
58
59
60
61
62
63
64
65
66
67
68
using DeviceOpInstanceMKNN = DeviceOpInstanceMK_Generic<NumDimM,
                                                        NumDimN,
                                                        NumDimK,
                                                        ADataType,
                                                        BDataType,
                                                        AccDataType,
                                                        CShuffleDataType,
                                                        DsDataType,
                                                        EDataType,
                                                        ComputeDataType,
                                                        AElementOp,
                                                        BElementOp,
                                                        CDEElementOp>;
69

70
71
72
73
74
75
76
77
78
79
80
81
82
using DeviceOpInstanceMNNN = DeviceOpInstanceMN_Generic<NumDimM,
                                                        NumDimN,
                                                        NumDimK,
                                                        ADataType,
                                                        BDataType,
                                                        AccDataType,
                                                        CShuffleDataType,
                                                        DsDataType,
                                                        EDataType,
                                                        ComputeDataType,
                                                        AElementOp,
                                                        BElementOp,
                                                        CDEElementOp>;
83
84
85

using DeviceOpInstance = DeviceOpInstanceKKNN;

86
#include "run_contraction_bilinear_example.inc"
87

88
int main(int argc, char* argv[]) { return run_contraction_bilinear_example(argc, argv); }