Back to Cutlass

CUTLASS: default_epilogue_simt.h Source File

docs/default__epilogue__simt_8h_source.html

4.4.218.5 KB
Original Source

| | CUTLASS

CUDA Templates for Linear Algebra Subroutines and Solvers |

default_epilogue_simt.h

[Go to the documentation of this file.](default epilogue simt_8h.html)

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

41 #include "cutlass/epilogue/thread/linear_combination.h"

42 #include "cutlass/epilogue/thread/conversion_op.h"

43 #include "cutlass/epilogue/thread/reduction_op.h"

44

45 #include "[cutlass/transform/threadblock/regular_tile_iterator_pitch_linear.h](regular tile iterator pitch linear_8h.html)"

46

47 #include "[cutlass/epilogue/warp/fragment_iterator_simt.h](fragment iterator simt_8h.html)"

48 #include "[cutlass/epilogue/warp/tile_iterator_simt.h](tile iterator simt_8h.html)"

49 #include "[cutlass/epilogue/threadblock/default_thread_map_simt.h](default thread map__simt_8h.html)"

50

51 #include "[cutlass/epilogue/threadblock/predicated_tile_iterator.h](epilogue_2threadblock_2predicated tile iterator_8h.html)"

52 #include "[cutlass/epilogue/threadblock/shared_load_iterator.h](shared load iterator_8h.html)"

53 #include "cutlass/epilogue/threadblock/epilogue.h"

54

56

57 namespace cutlass {

58 namespace epilogue {

59 namespace threadblock {

60

62

64 template <

65typename Shape_,

66typename WarpMmaSimt_,

67typename OutputOp_,

68int ElementsPerAccess

69 >

70 struct DefaultEpilogueSimt {

71

72using Shape = Shape_;

73using WarpMmaSimt = WarpMmaSimt_;

74using OutputOp = OutputOp_;

75static int const kElementsPerAccess = ElementsPerAccess;

76static const int kPartitionsK = Shape::kK / WarpMmaSimt::Shape::kK;

77

78using ElementOutput = typename OutputOp::ElementOutput;

79using LayoutC = typename WarpMmaSimt::LayoutC;

80using ElementAccumulator = typename WarpMmaSimt::ElementC;

81

82//

83// Thread map

84//

85

86using OutputTileThreadMap = typename cutlass::epilogue::threadblock::DefaultThreadMapSimt<

87Shape,

88typename WarpMmaSimt::Shape,

89typename WarpMmaSimt::Policy,

90kPartitionsK,

91ElementOutput,

92 kElementsPerAccess

93 >::Type;

94

95using OutputTileIterator = cutlass::epilogue::threadblock::PredicatedTileIterator<

96OutputTileThreadMap,

97 ElementOutput

98 >;

99

100using AccumulatorFragmentIterator = cutlass::epilogue::warp::FragmentIteratorSimt<

101typename WarpMmaSimt::Shape,

102typename WarpMmaSimt::ThreadMma,

103layout::RowMajor,

104typename WarpMmaSimt::Policy

105 >;

106

107using WarpTileIterator = cutlass::epilogue::warp::TileIteratorSimt<

108typename WarpMmaSimt::Shape,

109typename WarpMmaSimt::ThreadMma,

110ElementAccumulator,

111 layout::RowMajor,

112typename WarpMmaSimt::Policy

113 >;

114

115using SharedLoadIterator = cutlass::epilogue::threadblock::SharedLoadIterator<

116typename OutputTileThreadMap::CompactedThreadMap,

117 ElementAccumulator

118 >;

119

121using Padding = typename WarpTileIterator::Padding;

122

123//

124// Define the epilogue

125//

126using Epilogue = cutlass::epilogue::threadblock::Epilogue<

127Shape,

128WarpMmaSimt,

129kPartitionsK,

130OutputTileIterator,

131AccumulatorFragmentIterator,

132WarpTileIterator,

133SharedLoadIterator,

134OutputOp,

135Padding

136 >;

137 };

138

140

141 } // namespace threadblock

142 } // namespace epilogue

143 } // namespace cutlass

144

[regular_tile_iterator_pitch_linear.h](regular tile iterator pitch linear_8h.html)

Templates implementing loading of tiles from pitch-linear rank=2 tensors.

cutlass

Definition: aligned_buffer.h:35

[tile_iterator_simt.h](tile iterator simt_8h.html)

cutlass::epilogue::threadblock::DefaultEpilogueSimt

Defines sensible defaults for epilogues for SimtOps.

Definition: default_epilogue_simt.h:70

cutlass::epilogue::threadblock::DefaultEpilogueSimt::kElementsPerAccess

static int const kElementsPerAccess

Definition: default_epilogue_simt.h:75

[predicated_tile_iterator.h](epilogue_2threadblock_2predicated tile iterator_8h.html)

Epilogue for threadblock scoped GEMMs using Tensor Ops.

cutlass::epilogue::threadblock::DefaultEpilogueSimt::kPartitionsK

static const int kPartitionsK

Definition: default_epilogue_simt.h:76

gemm.h

Defines common types used for all GEMM-like operators.

conversion_op.h

Functor performing conversion operations used by epilogues.

cutlass::epilogue::threadblock::DefaultEpilogueSimt::SharedLoadIterator

cutlass::epilogue::threadblock::SharedLoadIterator< typename OutputTileThreadMap::CompactedThreadMap, ElementAccumulator > SharedLoadIterator

Definition: default_epilogue_simt.h:118

cutlass::epilogue::threadblock::DefaultEpilogueSimt::WarpMmaSimt

WarpMmaSimt_ WarpMmaSimt

Definition: default_epilogue_simt.h:73

cutlass::epilogue::threadblock::DefaultThreadMapSimt

Defines the optimal thread map for SIMT accumulator layouts.

Definition: default_thread_map_simt.h:52

array.h

Statically sized array of elements that accommodates all CUTLASS-supported numeric types and is safe ...

cutlass::epilogue::threadblock::DefaultEpilogueSimt::OutputOp

OutputOp_ OutputOp

Definition: default_epilogue_simt.h:74

linear_combination.h

Functor performing linear combination operations used by epilogues.

cutlass::epilogue::threadblock::DefaultEpilogueSimt::AccumulatorFragmentIterator

cutlass::epilogue::warp::FragmentIteratorSimt< typename WarpMmaSimt::Shape, typename WarpMmaSimt::ThreadMma, layout::RowMajor, typename WarpMmaSimt::Policy > AccumulatorFragmentIterator

Definition: default_epilogue_simt.h:105

cutlass::epilogue::threadblock::DefaultEpilogueSimt::LayoutC

typename WarpMmaSimt::LayoutC LayoutC

Definition: default_epilogue_simt.h:79

cutlass::epilogue::warp::FragmentIteratorSimt

Fragment iterator for SIMT accumulator arrangements.

Definition: fragment_iterator_simt.h:60

cutlass::epilogue::threadblock::DefaultEpilogueSimt::ElementAccumulator

typename WarpMmaSimt::ElementC ElementAccumulator

Definition: default_epilogue_simt.h:80

[default_thread_map_simt.h](default thread map__simt_8h.html)

numeric_types.h

Top-level include for all CUTLASS numeric types.

[fragment_iterator_simt.h](fragment iterator simt_8h.html)

This defines a "fragment" iterator for visiting the fragments of an accumulator tile that participate...

[shared_load_iterator.h](shared load iterator_8h.html)

Epilogue for threadblock scoped GEMMs using Tensor Ops.

cutlass::epilogue::threadblock::DefaultEpilogueSimt::Padding

typename WarpTileIterator::Padding Padding

Hard-coded padding elements added.

Definition: default_epilogue_simt.h:121

cutlass::epilogue::threadblock::DefaultEpilogueSimt::Shape

Shape_ Shape

Definition: default_epilogue_simt.h:72

cutlass::layout::RowMajor

Mapping function for row-major matrices.

Definition: layout/matrix.h:50

cutlass::epilogue::threadblock::Epilogue

Epilogue operator without splitk.

Definition: epilogue.h:74

epilogue.h

Epilogue for threadblock scoped GEMMs using Tensor Ops.

cutlass::epilogue::threadblock::PredicatedTileIterator

Definition: epilogue/threadblock/predicated_tile_iterator.h:65

cutlass::epilogue::threadblock::DefaultEpilogueSimt::ElementOutput

typename OutputOp::ElementOutput ElementOutput

Definition: default_epilogue_simt.h:78

cutlass::epilogue::threadblock::DefaultEpilogueSimt::WarpTileIterator

cutlass::epilogue::warp::TileIteratorSimt< typename WarpMmaSimt::Shape, typename WarpMmaSimt::ThreadMma, ElementAccumulator, layout::RowMajor, typename WarpMmaSimt::Policy > WarpTileIterator

Definition: default_epilogue_simt.h:113

cutlass::epilogue::threadblock::SharedLoadIterator

Definition: shared_load_iterator.h:61

cutlass::epilogue::threadblock::DefaultEpilogueSimt::OutputTileIterator

cutlass::epilogue::threadblock::PredicatedTileIterator< OutputTileThreadMap, ElementOutput > OutputTileIterator

Definition: default_epilogue_simt.h:98

reduction_op.h

Functor performing reduction operations used by epilogues.

cutlass.h

Basic include for CUTLASS.

cutlass::epilogue::warp::TileIteratorSimt

Template for reading and writing tiles of accumulators to shared memory.

Definition: tile_iterator_simt.h:55

cutlass::epilogue::threadblock::DefaultEpilogueSimt::OutputTileThreadMap

typename cutlass::epilogue::threadblock::DefaultThreadMapSimt< Shape, typename WarpMmaSimt::Shape, typename WarpMmaSimt::Policy, kPartitionsK, ElementOutput, kElementsPerAccess >::Type OutputTileThreadMap

Definition: default_epilogue_simt.h:93


Generated by 1.8.11