XeTLA v0.3.6
IntelĀ® Xe Templates for Linear Algebra - API Definition Document
 
Loading...
Searching...
No Matches
api.hpp
Go to the documentation of this file.
1/*******************************************************************************
2* Copyright (c) 2022-2023 Intel Corporation
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*******************************************************************************/
16
19
20#pragma once
21
23
24namespace gpu::xetla::subgroup {
25
33template <typename matAcc_dst_t, typename matAcc_src_t, typename matB_t,
34 typename matA_t, mma_engine engine, gpu_arch arch_tag,
35 typename enable = void>
36struct tile_mma_t {};
37
42template <typename mem_desc, typename tile_desc, msg_type message_type,
43 gpu_arch arch_tag, typename enable = void>
44struct mem_payload_t {};
45
51template <typename mem_desc_, typename tile_desc_, uint32_t cooperative_num_,
52 gpu_arch arch_tag, typename enable = void>
54
62template <uint32_t tile_size_x_, uint32_t tile_size_y_, uint32_t block_size_x_,
63 uint32_t block_size_y_, reg_layout reg_layout_ = reg_layout::tiled>
65 static constexpr uint32_t tile_size_x = tile_size_x_;
66 static constexpr uint32_t tile_size_y = tile_size_y_;
67
68 static constexpr uint32_t block_size_x = block_size_x_;
69 static constexpr uint32_t block_size_y = block_size_y_;
70 static constexpr uint32_t remained_size_y = tile_size_y % block_size_y;
71
72 static constexpr reg_layout register_layout = reg_layout_;
73 static constexpr bool reg_transpose
74 = reg_layout_ == reg_layout::transpose_tiled;
75
76 static_assert(
77 tile_size_x >= block_size_x, "tile_size_x should >= block_size_x ");
78 static_assert(
79 tile_size_y >= block_size_y, "tile_size_y should >= block_size_y ");
80 static_assert(
81 (tile_size_y == 1) || ((block_size_x & (block_size_x - 1)) == 0),
82 "if tile_size_y > 1, block_size_x should be power of 2 ");
83 static_assert(tile_size_x % (block_size_x) == 0,
84 "Tile_size_x should be a multiple of block_size_x ");
85
86 static constexpr uint32_t num_block_x = tile_size_x / block_size_x;
87 static constexpr uint32_t num_block_y = tile_size_y / block_size_y;
88 static constexpr uint32_t num_block
89 = num_block_x * (num_block_y + (remained_size_y > 0 ? 1 : 0));
90
91 static constexpr uint32_t block_elems = block_size_x * block_size_y;
92 static constexpr uint32_t tile_elems = tile_size_x * tile_size_y;
93};
94
98template <typename dtype_, typename tile_desc_>
99struct tile_t : public tile_desc_ {
100 using dtype = dtype_;
101 using tile_desc = tile_desc_;
103
104 // Cannot init value by constructor
106 static_assert(!is_internal_type<dtype>::value,
107 "compiler currently does NOT support using plained BF16 data "
108 "to initialize a BF16 data");
109 this->reg = val;
110 }
111
112 inline tile_t() = default;
113 __XETLA_API void init(native_type_t<dtype> val) { this->reg = val; }
114};
115
116} // namespace gpu::xetla::subgroup
#define __XETLA_API
Definition common.hpp:43
typename native_type< T >::type native_type_t
Return the native data type of T.
Definition base_types.hpp:106
__ESIMD_NS::simd< native_type_t< Ty >, N > xetla_vector
wrapper for xetla_vector.
Definition base_types.hpp:149
Definition limitation.hpp:457
reg_layout
tile layout in register linear: linear layout with one tile tiled: 2d block stacked in raster order v...
Definition common.hpp:209
mma_engine
Definition common.hpp:225
gpu_arch
Definition common.hpp:73
msg_type
Definition common.hpp:78
Used to check if the type is xetla internal data type.
Definition base_types.hpp:67
Is to illustrate the memory information.
Definition api.hpp:44
Is to illustrate the memory information to prefetch data to cache.
Definition api.hpp:53
Is to illustrate the tile information about a sub matrix.
Definition api.hpp:64
static constexpr uint32_t block_elems
Definition api.hpp:91
static constexpr uint32_t tile_size_y
Definition api.hpp:66
static constexpr uint32_t block_size_x
Definition api.hpp:68
static constexpr uint32_t tile_size_x
Definition api.hpp:65
static constexpr reg_layout register_layout
Definition api.hpp:72
static constexpr uint32_t num_block
Definition api.hpp:89
static constexpr uint32_t block_size_y
Definition api.hpp:69
static constexpr uint32_t remained_size_y
Definition api.hpp:70
static constexpr uint32_t tile_elems
Definition api.hpp:92
static constexpr bool reg_transpose
Definition api.hpp:74
static constexpr uint32_t num_block_y
Definition api.hpp:87
static constexpr uint32_t num_block_x
Definition api.hpp:86
Is the xetla tile mma operation definition API.
Definition api.hpp:36
Is a struct contains some register file.
Definition api.hpp:99
tile_desc_ tile_desc
Definition api.hpp:101
dtype_ dtype
Definition api.hpp:100
xetla_vector< dtype, tile_desc::tile_elems > reg
Definition api.hpp:102
tile_t(native_type_t< dtype > val)
Definition api.hpp:105
__XETLA_API void init(native_type_t< dtype > val)
Definition api.hpp:113
C++ API.