CUTLASS
CUDA Templates for Linear Algebra Subroutines and Solvers
default_epilogue_volta_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  **************************************************************************************************/
33 #pragma once
34 
35 #include "cutlass/cutlass.h"
36 #include "cutlass/numeric_types.h"
37 #include "cutlass/array.h"
38 
39 #include "cutlass/gemm/gemm.h"
40 
44 
48 
52 
54 
56 
57 namespace cutlass {
58 namespace epilogue {
59 namespace threadblock {
60 
62 
64 template <
65  typename Shape_,
66  typename WarpMmaTensorOp_,
67  int PartitionsK,
68  typename OutputOp_,
69  int ElementsPerAccess
70 >
72 
73  using Shape = Shape_;
74  using WarpMmaTensorOp = WarpMmaTensorOp_;
75  static int const kPartitionsK = PartitionsK;
76  using OutputOp = OutputOp_;
77  static int const kElementsPerAccess = ElementsPerAccess;
78 
79  using ElementOutput = typename OutputOp::ElementOutput;
80  using LayoutC = typename WarpMmaTensorOp::LayoutC;
81  using ElementAccumulator = typename WarpMmaTensorOp::ElementC;
82 
83  //
84  // Thread map
85  //
86 
88  Shape,
89  typename WarpMmaTensorOp::Shape,
94  >::Type;
95 
98  ElementOutput
99  >;
100 
102  typename WarpMmaTensorOp::Shape,
105  LayoutC
106  >;
107 
109  typename WarpMmaTensorOp::Shape,
110  gemm::GemmShape<32, 32, 4>,
112  LayoutC
113  >;
114 
115  static int const kSharedMemAlignment = sizeof_bits<ElementAccumulator>::value * WarpTileIterator::kElementsPerAccess / 8;
116 
117  static_assert(kSharedMemAlignment == 8, "Shared memory alignment must be 8B");
118 
120  typename OutputTileThreadMap::CompactedThreadMap,
122  kSharedMemAlignment
123  >;
124 
126  using Padding = typename WarpTileIterator::Padding;
127 
128  //
129  // Define the epilogue
130  //
132  Shape,
134  kPartitionsK,
139  OutputOp,
140  Padding
141  >;
142 };
143 
145 
146 } // namespace threadblock
147 } // namespace epilogue
148 } // namespace cutlass
149 
Templates implementing loading of tiles from pitch-linear rank=2 tensors.
WarpMmaTensorOp_ WarpMmaTensorOp
Definition: default_epilogue_volta_tensor_op.h:74
Definition: aligned_buffer.h:35
static int const kPartitionsK
Definition: default_epilogue_volta_tensor_op.h:75
Epilogue for threadblock scoped GEMMs using Tensor Ops.
This defines a "fragment" iterator for visiting the fragments of an accumulator tile that participate...
Defines common types used for all GEMM-like operators.
static int const kElementsPerAccess
Definition: default_epilogue_volta_tensor_op.h:77
Functor performing conversion operations used by epilogues.
typename WarpMmaTensorOp::LayoutC LayoutC
Definition: default_epilogue_volta_tensor_op.h:80
Shape_ Shape
Definition: default_epilogue_volta_tensor_op.h:73
Statically sized array of elements that accommodates all CUTLASS-supported numeric types and is safe ...
cutlass::epilogue::threadblock::SharedLoadIterator< typename OutputTileThreadMap::CompactedThreadMap, ElementAccumulator, kSharedMemAlignment > SharedLoadIterator
Definition: default_epilogue_volta_tensor_op.h:123
Functor performing linear combination operations used by epilogues.
Defines the size of an element in bits.
Definition: numeric_types.h:42
Template for reading and writing tiles of accumulators to shared memory.
Definition: tile_iterator_volta_tensor_op.h:52
cutlass::epilogue::warp::FragmentIteratorVoltaTensorOp< typename WarpMmaTensorOp::Shape, gemm::GemmShape< 32, 32, 4 >, ElementAccumulator, LayoutC > AccumulatorFragmentIterator
Definition: default_epilogue_volta_tensor_op.h:106
static int const kSharedMemAlignment
Definition: default_epilogue_volta_tensor_op.h:115
cutlass::epilogue::warp::TileIteratorVoltaTensorOp< typename WarpMmaTensorOp::Shape, gemm::GemmShape< 32, 32, 4 >, ElementAccumulator, LayoutC > WarpTileIterator
Definition: default_epilogue_volta_tensor_op.h:113
Top-level include for all CUTLASS numeric types.
Definition: fragment_iterator_volta_tensor_op.h:61
Shape of a matrix multiply-add operation.
Definition: include/cutlass/gemm/gemm.h:57
#define static_assert(__e, __m)
Definition: platform.h:153
Epilogue for threadblock scoped GEMMs using Tensor Ops.
Defines sensible defaults for epilogues for TensorOps.
Definition: default_epilogue_volta_tensor_op.h:71
Epilogue operator without splitk.
Definition: epilogue.h:74
Epilogue for threadblock scoped GEMMs using Tensor Ops.
Definition: epilogue/threadblock/predicated_tile_iterator.h:65
cutlass::epilogue::threadblock::PredicatedTileIterator< OutputTileThreadMap, ElementOutput > OutputTileIterator
Definition: default_epilogue_volta_tensor_op.h:99
typename WarpMmaTensorOp::ElementC ElementAccumulator
Definition: default_epilogue_volta_tensor_op.h:81
Defines the optimal thread map for TensorOp accumulator layouts.
Definition: default_thread_map_volta_tensor_op.h:52
typename WarpTileIterator::Padding Padding
Hard-coded padding elements added.
Definition: default_epilogue_volta_tensor_op.h:126
typename cutlass::epilogue::threadblock::DefaultThreadMapVoltaTensorOp< Shape, typename WarpMmaTensorOp::Shape, kPartitionsK, ElementOutput, kElementsPerAccess, ElementAccumulator >::Type OutputTileThreadMap
Definition: default_epilogue_volta_tensor_op.h:94
Definition: shared_load_iterator.h:61
typename OutputOp::ElementOutput ElementOutput
Definition: default_epilogue_volta_tensor_op.h:79
Functor performing reduction operations used by epilogues.
Basic include for CUTLASS.
OutputOp_ OutputOp
Definition: default_epilogue_volta_tensor_op.h:76