CUTLASS
CUDA Templates for Linear Algebra Subroutines and Solvers
default_thread_map_wmma_tensor_op.h
Go to the documentation of this file.
1 /***************************************************************************************************
2  * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification, are permitted
5  * provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright notice, this list of
7  * conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright notice, this list of
9  * conditions and the following disclaimer in the documentation and/or other materials
10  * provided with the distribution.
11  * * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
12  * to endorse or promote products derived from this software without specific prior written
13  * permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21  * STRICT LIABILITY, OR TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  **************************************************************************************************/
30 #pragma once
31 
33 #include "cutlass/gemm/gemm.h"
35 
37 
38 namespace cutlass {
39 namespace epilogue {
40 namespace threadblock {
41 
43 
45 template <
46  typename ThreadblockShape_,
47  typename WarpShape_,
48  typename InstructionShape_,
49  int PartitionsK,
50  typename Element_,
51  int ElementsPerAccess
52 >
54 
55  using ThreadblockShape = ThreadblockShape_;
56  using WarpShape = WarpShape_;
57  using InstructionShape = InstructionShape_;
58  static int const kPartitionsK = PartitionsK;
59  using Element = Element_;
60  static int const kElementsPerAccess = ElementsPerAccess;
61 
62  //
63  // Definitions
64  //
65 
66  struct Detail {
67 
69  static int const kTensorOpRows = InstructionShape::kM;
70  static int const kWarpSize = 32;
71 
73  !(ThreadblockShape::kM % WarpShape::kM) &&
74  !(ThreadblockShape::kM % WarpShape::kM), "Divisibility");
75 
77  using WarpCount = gemm::GemmShape<
78  ThreadblockShape::kM / WarpShape::kM,
79  ThreadblockShape::kN / WarpShape::kN,
80  kPartitionsK
81  >;
82 
84  static int const kThreads = WarpCount::kCount * kWarpSize;
85  };
86 
87  //
88  // ThreadMap
89  //
90 
94  OutputTileShape<1, WarpShape::kM / Detail::kTensorOpRows, 1, 1, WarpShape::kM / Detail::kTensorOpRows>,
98  >;
99 };
100 
102 
103 } // namespace threadblock
104 } // namespace epilogue
105 } // namespace cutlass
106 
Definition: output_tile_thread_map.h:228
Definition: aligned_buffer.h:35
Tuple defining point in output tile.
Definition: output_tile_thread_map.h:57
Definition: default_thread_map_wmma_tensor_op.h:66
Epilogue for threadblock scoped GEMMs using Tensor Ops.
Element_ Element
Definition: default_thread_map_wmma_tensor_op.h:59
Defines common types used for all GEMM-like operators.
static int const kCount
Definition: include/cutlass/gemm/gemm.h:67
static int const kThreads
Number of participating threads.
Definition: default_thread_map_wmma_tensor_op.h:84
static int const kPartitionsK
Definition: default_thread_map_wmma_tensor_op.h:58
Defines the size of an element in bits.
Definition: numeric_types.h:42
InstructionShape_ InstructionShape
Definition: default_thread_map_wmma_tensor_op.h:57
static int const kElementsPerAccess
Definition: default_thread_map_wmma_tensor_op.h:60
Shape of a matrix multiply-add operation.
Definition: include/cutlass/gemm/gemm.h:57
#define static_assert(__e, __m)
Definition: platform.h:153
ThreadblockShape_ ThreadblockShape
Definition: default_thread_map_wmma_tensor_op.h:55
Defines the optimal thread map for Wmma TensorOp accumulator layouts.
Definition: default_thread_map_wmma_tensor_op.h:53
WarpShape_ WarpShape
Definition: default_thread_map_wmma_tensor_op.h:56
static int const kWarpSize
Definition: default_thread_map_wmma_tensor_op.h:70
Defines layout functions used by TensorRef and derived classes for pitch-linear memory.
static int const kTensorOpRows
Wmma Tensor Operations fundamentally perform operations on InstructionShape::kM rows.
Definition: default_thread_map_wmma_tensor_op.h:69