/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/develop/include/ck_tile/core/arch/mma/amdgcn_mma.hpp Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/develop/include/ck_tile/core/arch/mma/amdgcn_mma.hpp Source File#

Composable Kernel: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/develop/include/ck_tile/core/arch/mma/amdgcn_mma.hpp Source File
amdgcn_mma.hpp
Go to the documentation of this file.
1 // Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
2 // SPDX-License-Identifier: MIT
3 
4 #pragma once
5 
9 
11 
16 struct Unsupported;
17 
18 #if defined(__cpp_concepts) && __cpp_concepts >= 201907L
23 template <typename MmaOp>
24 concept MmaOpI = requires(MmaOp op) {
25  // Requires an op context
26  typename MmaOp::OpType;
27 
28  // Captures types for inputs / outputs to mma function
29  typename MmaOp::AVecType;
30  typename MmaOp::BVecType;
31  typename MmaOp::CVecType;
32 
33  // Captures CK-specific layout properties
34  { MmaOp::kAMBlock } -> std::convertible_to<unsigned int>;
35  { MmaOp::kBNBlock } -> std::convertible_to<unsigned int>;
36  { MmaOp::kAMLane } -> std::convertible_to<unsigned int>;
37  { MmaOp::kBNLane } -> std::convertible_to<unsigned int>;
38  { MmaOp::kABKLane } -> std::convertible_to<unsigned int>;
39  { MmaOp::kABKPerLane } -> std::convertible_to<unsigned int>;
40  { MmaOp::kCMLane } -> std::convertible_to<unsigned int>;
41  { MmaOp::kCNLane } -> std::convertible_to<unsigned int>;
42  { MmaOp::kCM0PerLane } -> std::convertible_to<unsigned int>;
43  { MmaOp::kCM1PerLane } -> std::convertible_to<unsigned int>;
44 
45  // Static exec function
46  {
47  MmaOp::exec(
48  typename MmaOp::AVecType{}, typename MmaOp::BVecType{}, typename MmaOp::CVecType{})
49  } -> std::convertible_to<typename MmaOp::CVecType>;
50 };
51 
52 #endif // defined(__cpp_concepts) && __cpp_concepts >= 201907L
53 
72 template <typename ADataType,
73  typename BDataType,
74  typename CDataType,
75  uint32_t BlockM,
76  uint32_t BlockN,
77  uint32_t BlockK,
78  typename CtrlFlags,
79  typename CompilerTarget,
80  typename Enabler = void>
81 struct amdgcn_mma
82 {
83  // The base instance is unsupported because there is no __builtin to wrap.
85 
86  // Interface types for A, B, C vectors types
90 
91  // Layout constants - default to 0
92  static constexpr index_t kAMBlock = 0;
93  static constexpr index_t kBNBlock = 0;
94 
95  static constexpr index_t kAMLane = 0;
96  static constexpr index_t kBNLane = 0;
97  static constexpr index_t kABKLane = 0;
98  static constexpr index_t kABKPerLane = 0;
99 
100  static constexpr index_t kCMLane = 0;
101  static constexpr index_t kCNLane = 0;
102  static constexpr index_t kCM0PerLane = 0;
103  static constexpr index_t kCM1PerLane = 0;
104 
105  // This is a default pass-through implementation that doesn't do anything practical.
106  CK_TILE_DEVICE static CVecType const&
107  exec(AVecType const& regsA, BVecType const& regsB, CVecType const& regsC)
108  {
109  ignore(regsA, regsB);
110  return regsC; // No-op, just return C
111  }
112 };
113 
114 } // namespace ck_tile::core::arch::mma
115 
116 // Include the implementations
117 #include "wmma/wmma.hpp"
118 #include "mfma/mfma.hpp"
#define CK_TILE_DEVICE
Definition: config.hpp:45
Definition: amdgcn_mma.hpp:10
int32_t index_t
Definition: integer.hpp:9
constexpr detail::ignore_t ignore
Definition: ignore.hpp:24
typename impl::ext_vector< T, N >::type ext_vector_t
Definition: vector_type.hpp:84
unsigned int uint32_t
Definition: stdint.h:126
Meta-tag to indicate unsupported amdgcn_mma instance.
This is the default MmaOp policy. Instances of this class are to be used as MmaOp policies....
Definition: amdgcn_mma.hpp:82
static constexpr index_t kCNLane
Definition: amdgcn_mma.hpp:101
static constexpr index_t kAMBlock
Definition: amdgcn_mma.hpp:92
ext_vector_t< ADataType, 1 > AVecType
Definition: amdgcn_mma.hpp:87
static constexpr index_t kAMLane
Definition: amdgcn_mma.hpp:95
ext_vector_t< CDataType, 1 > CVecType
Definition: amdgcn_mma.hpp:89
static constexpr index_t kCM1PerLane
Definition: amdgcn_mma.hpp:103
static constexpr index_t kBNBlock
Definition: amdgcn_mma.hpp:93
static constexpr index_t kCM0PerLane
Definition: amdgcn_mma.hpp:102
static CK_TILE_DEVICE CVecType const & exec(AVecType const &regsA, BVecType const &regsB, CVecType const &regsC)
Definition: amdgcn_mma.hpp:107
static constexpr index_t kABKLane
Definition: amdgcn_mma.hpp:97
static constexpr index_t kBNLane
Definition: amdgcn_mma.hpp:96
static constexpr index_t kABKPerLane
Definition: amdgcn_mma.hpp:98
ext_vector_t< BDataType, 1 > BVecType
Definition: amdgcn_mma.hpp:88
static constexpr index_t kCMLane
Definition: amdgcn_mma.hpp:100