50 inline void init(
int x_,
int y_) {
65 uint32_t shape_x_, uint32_t shape_y_, uint32_t row_stride_)
66 : x(shape_x_), y(shape_y_), stride(row_stride_) {}
70 this->stride =
shape.stride;
80 this->stride =
shape.stride;
84 uint32_t shape_x_, uint32_t shape_y_, uint32_t row_stride_) {
87 this->stride = row_stride_;
91template <
typename dtype_, mem_space space_>
93template <
typename dtype_>
100 : base(mem_base.base) {}
108 this->base = mem_base.base;
112 inline void update(
int offset) { base = base + offset; }
114template <
typename dtype_>
133 inline void init(uint32_t base_) { base = base_; }
134 inline void update(
int offset) { init(base + offset *
sizeof(
dtype)); }
138 uint32_t alignment_ = 8,
int dim_ = 2>
147 static constexpr int dim = 2;
148 static constexpr uint32_t alignment = alignment_;
149 static constexpr uint32_t alignment_in_bytes = alignment_ *
sizeof(
dtype);
161 :
shape(shape_), coord(coord_), base(base_) {}
166 :
shape(mem_desc.
shape), coord(mem_desc.coord), base(mem_desc.base) {}
169 this->base = mem_desc.base;
170 this->
shape = mem_desc.shape;
171 this->coord = mem_desc.coord;
186 uint32_t width = is_col_major ?
shape.y :
shape.x;
187 uint32_t height = is_col_major ?
shape.x :
shape.y;
188 uint32_t pitch =
shape.stride;
189 int coord_x = is_col_major ? coord.y : coord.x;
190 int coord_y = is_col_major ? coord.x : coord.y;
191 return xetla_get_tdesc<dtype>(
192 base.base, width, height, pitch, coord_x, coord_y);
xetla_vector< uint32_t, 16 > xetla_tdescriptor
Description of nd tensor descriptor for load and store.
Definition base_types.hpp:155
Definition arch_config.hpp:24
mem_space
Definition common.hpp:77
mem_layout
Definition common.hpp:76
void init(dtype *base_)
Definition memory_descriptor.hpp:111
mem_base_t(const mem_base_t< dtype, mem_space::global > &mem_base)
Definition memory_descriptor.hpp:99
dtype_ dtype
Definition memory_descriptor.hpp:95
void update(int offset)
Definition memory_descriptor.hpp:112
dtype * base
Definition memory_descriptor.hpp:96
mem_base_t< dtype, mem_space::global > & operator=(const mem_base_t< dtype, mem_space::global > &mem_base)
Definition memory_descriptor.hpp:101
mem_base_t(dtype *base_)
Definition memory_descriptor.hpp:98
dtype_ dtype
Definition memory_descriptor.hpp:116
mem_base_t< dtype, mem_space::local > & operator=(const mem_base_t< dtype, mem_space::local > &mem_base)
Definition memory_descriptor.hpp:123
mem_base_t(uint32_t base_)
Definition memory_descriptor.hpp:119
mem_base_t(const mem_base_t< dtype, mem_space::local > &mem_base)
Definition memory_descriptor.hpp:120
void init(uint32_t base_)
Definition memory_descriptor.hpp:133
void update(int offset)
Definition memory_descriptor.hpp:134
uint32_t base
Definition memory_descriptor.hpp:117
Definition memory_descriptor.hpp:92
void init(int x_, int y_)
Definition memory_descriptor.hpp:50
mem_coord_t(const mem_coord_t< 2 > &coord)
Definition memory_descriptor.hpp:35
int y
Definition memory_descriptor.hpp:32
int x
Definition memory_descriptor.hpp:31
mem_coord_t< 2 > & operator=(const mem_coord_t< 2 > &coord)
Definition memory_descriptor.hpp:39
mem_coord_t(int x_, int y_)
Definition memory_descriptor.hpp:33
Definition memory_descriptor.hpp:28
xetla_tdescriptor get_tdesc()
Definition memory_descriptor.hpp:185
void update_coord_x(int offset_x)
Definition memory_descriptor.hpp:183
shape_t shape
Definition memory_descriptor.hpp:195
mem_desc_t(base_t base_, shape_t shape_, coord_t coord_)
Definition memory_descriptor.hpp:160
mem_desc_t(const this_type_t &mem_desc)
Definition memory_descriptor.hpp:165
this_type_t & operator=(const this_type_t &mem_desc)
Definition memory_descriptor.hpp:168
base_t base
Definition memory_descriptor.hpp:197
dtype_ dtype
Definition memory_descriptor.hpp:144
coord_t coord
Definition memory_descriptor.hpp:196
void update_coord(int offset_x, int offset_y)
Definition memory_descriptor.hpp:179
void update_coord_y(int offset_y)
Definition memory_descriptor.hpp:184
void init(base_t base_, shape_t shape_, coord_t coord_)
Definition memory_descriptor.hpp:174
Definition memory_descriptor.hpp:139
void init(uint32_t shape_x_, uint32_t shape_y_, uint32_t row_stride_)
Definition memory_descriptor.hpp:83
mem_shape_t< 2 > & operator=(const mem_shape_t< 2 > &shape)
Definition memory_descriptor.hpp:72
mem_shape_t(uint32_t shape_x_, uint32_t shape_y_, uint32_t row_stride_)
Definition memory_descriptor.hpp:64
uint32_t x
Definition memory_descriptor.hpp:60
uint32_t y
Definition memory_descriptor.hpp:61
uint32_t stride
Definition memory_descriptor.hpp:62
mem_shape_t(const mem_shape_t< 2 > &shape)
Definition memory_descriptor.hpp:67
Definition memory_descriptor.hpp:57