CUTLASS: default_thread_map_wmma_tensor_op.h Source File

| CUTLASS CUDA Templates for Linear Algebra Subroutines and Solvers

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
32 #include "predicated_tile_iterator.h"
33 #include "cutlass/gemm/gemm.h"
34 #include "cutlass/layout/pitch_linear.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 >
53 struct DefaultThreadMapWmmaTensorOp {
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
72 static_assert(
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
92 using Type = OutputTileOptimalThreadMap <
93 OutputTileShape<ThreadblockShape::kN, Detail::kTensorOpRows, Detail::WarpCount::kM, 1, 1>,
94 OutputTileShape<1, WarpShape::kM / Detail::kTensorOpRows, 1, 1, WarpShape::kM / Detail::kTensorOpRows>,
95 Detail::kThreads,
96 kElementsPerAccess,
97 sizeof_bits<Element>::value
98 >;
99 };
100
102
103 } // namespace threadblock
104 } // namespace epilogue
105 } // namespace cutlass
106
cutlass::epilogue::threadblock::OutputTileOptimalThreadMap
Definition: output_tile_thread_map.h:228
cutlass
Definition: aligned_buffer.h:35
cutlass::epilogue::threadblock::OutputTileShape
Tuple defining point in output tile.
Definition: output_tile_thread_map.h:57
cutlass::epilogue::threadblock::DefaultThreadMapWmmaTensorOp::Detail
Definition: default_thread_map_wmma_tensor_op.h:66
predicated_tile_iterator.h
Epilogue for threadblock scoped GEMMs using Tensor Ops.
cutlass::epilogue::threadblock::DefaultThreadMapWmmaTensorOp::Element
Element_ Element
Definition: default_thread_map_wmma_tensor_op.h:59
gemm.h
Defines common types used for all GEMM-like operators.
cutlass::gemm::GemmShape::kCount
static int const kCount
Definition: include/cutlass/gemm/gemm.h:67
cutlass::epilogue::threadblock::DefaultThreadMapWmmaTensorOp::Detail::kThreads
static int const kThreads
Number of participating threads.
Definition: default_thread_map_wmma_tensor_op.h:84
cutlass::epilogue::threadblock::DefaultThreadMapWmmaTensorOp::kPartitionsK
static int const kPartitionsK
Definition: default_thread_map_wmma_tensor_op.h:58
cutlass::sizeof_bits
Defines the size of an element in bits.
Definition: numeric_types.h:42
cutlass::epilogue::threadblock::DefaultThreadMapWmmaTensorOp::InstructionShape
InstructionShape_ InstructionShape
Definition: default_thread_map_wmma_tensor_op.h:57
cutlass::epilogue::threadblock::DefaultThreadMapWmmaTensorOp::kElementsPerAccess
static int const kElementsPerAccess
Definition: default_thread_map_wmma_tensor_op.h:60
cutlass::gemm::GemmShape
Shape of a matrix multiply-add operation.
Definition: include/cutlass/gemm/gemm.h:57
static_assert
#define static_assert(__e, __m)
Definition: platform.h:153
cutlass::epilogue::threadblock::DefaultThreadMapWmmaTensorOp::ThreadblockShape
ThreadblockShape_ ThreadblockShape
Definition: default_thread_map_wmma_tensor_op.h:55
cutlass::epilogue::threadblock::DefaultThreadMapWmmaTensorOp
Defines the optimal thread map for Wmma TensorOp accumulator layouts.
Definition: default_thread_map_wmma_tensor_op.h:53
cutlass::epilogue::threadblock::DefaultThreadMapWmmaTensorOp::WarpShape
WarpShape_ WarpShape
Definition: default_thread_map_wmma_tensor_op.h:56
cutlass::epilogue::threadblock::DefaultThreadMapWmmaTensorOp::Detail::kWarpSize
static int const kWarpSize
Definition: default_thread_map_wmma_tensor_op.h:70
pitch_linear.h
Defines layout functions used by TensorRef and derived classes for pitch-linear memory.
cutlass::epilogue::threadblock::DefaultThreadMapWmmaTensorOp::Detail::kTensorOpRows
static int const kTensorOpRows
Wmma Tensor Operations fundamentally perform operations on InstructionShape::kM rows.
Definition: default_thread_map_wmma_tensor_op.h:69