CUTLASS
CUDA Templates for Linear Algebra Subroutines and Solvers
simt_policy.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  **************************************************************************************************/
31 #pragma once
32 
33 #include "cutlass/matrix_shape.h"
34 #include "cutlass/layout/matrix.h"
35 
37 
38 namespace cutlass {
39 namespace epilogue {
40 namespace warp {
41 
43 
44 template <
45  typename WarpShape,
46  typename Operator,
47  typename Layout,
48  typename MmaSimtPolicy
49 >
50 struct SimtPolicy;
51 
53 
55 template <
56  typename WarpShape_,
57  typename Operator_,
58  typename MmaSimtPolicy_
59 >
60 struct SimtPolicy<WarpShape_, Operator_, layout::RowMajor, MmaSimtPolicy_> {
61 
62  using WarpShape = WarpShape_;
63  using Operator = Operator_;
64  using MmaSimtPolicy = MmaSimtPolicy_;
65 
66  static_assert(!(WarpShape::kM % MmaSimtPolicy::WarpShape::kRow), "Divisibility");
67  static_assert(!(WarpShape::kN % MmaSimtPolicy::WarpShape::kColumn), "Divisibility");
68 
70  static int const kIterations = WarpShape::kM / MmaSimtPolicy::WarpShape::kRow;
71 
73  static int const kElementsPerIteration =
74  (WarpShape::kN / MmaSimtPolicy::WarpShape::kColumn);
75 
77  static int const kAccumulatorElementCount = kElementsPerIteration * kIterations;
78 
80  static int const kElementsPerAccess = MmaSimtPolicy::LaneMmaShape::kN;
81 
83  static int const kRowsPerIteration = MmaSimtPolicy::WarpShape::kRow;
84 
86  static int const kAccessesPerIteration = kElementsPerIteration / kElementsPerAccess;
87 };
88 
90 
91 } // namespace warp
92 } // namespace epilogue
93 } // namespace cutlass
94 
Definition: aligned_buffer.h:35
Definition: simt_policy.h:50
Defines a Shape template for matrix tiles.
#define static_assert(__e, __m)
Definition: platform.h:153
Defines layout functions used by TensorRef and derived classes.