@@ -19,6 +19,15 @@ def XeVM_Dialect : Dialect {
19
19
let name = "xevm";
20
20
let cppNamespace = "::mlir::xevm";
21
21
let dependentDialects = ["LLVM::LLVMDialect"];
22
+
23
+ let extraClassDeclaration = [{
24
+ /// Get the name for the attribute used to specify cache control
25
+ /// decorations.
26
+ static constexpr ::llvm::StringRef getCacheControlsAttrName() {
27
+ return ::llvm::StringLiteral("xevm.DecorationCacheControl");
28
+ }
29
+ }];
30
+
22
31
let useDefaultAttributePrinterParser = 1;
23
32
}
24
33
@@ -97,6 +106,8 @@ def XeVM_BlockLoad2dOp : XeVM_Op<"blockload2d">,
97
106
$cache_control - an enumerator that sets the L1 and L3 cache behaviour
98
107
99
108
Notes:
109
+ - pitch is the physical stride between the first columns of the current row and the subsequent row,
110
+ this may include (possibly implicit) padding, alignment, or other factors.
100
111
- the $transpose and $vnni_transform parameters are mutual exclusive
101
112
- transposing the tile loaded is typically used for the B matrix operand
102
113
(D = C + A * B), where A has row-major layout in registers and B should have column-major layout.
@@ -148,6 +159,8 @@ def XeVM_BlockStore2dOp : XeVM_Op<"blockstore2d">,
148
159
$stored_val - the tile to store
149
160
150
161
Notes:
162
+ - pitch is the physical stride between the first columns of the current row and the subsequent row,
163
+ this may include (possibly implicit) padding, alignment, or other factors.
151
164
- coordinate is provided in elements, while width and pitch are provided in bytes.
152
165
}];
153
166
@@ -161,6 +174,54 @@ def XeVM_BlockStore2dOp : XeVM_Op<"blockstore2d">,
161
174
let hasVerifier = 1;
162
175
}
163
176
177
+ def XeVM_BlockPrefetch2dOp : XeVM_Op<"blockprefetch2d">,
178
+ Arguments<(ins
179
+ Arg<LLVM_AnyPointer, "", [MemRead]>:$ptr,
180
+ I32:$base_width,
181
+ I32:$base_height,
182
+ I32:$base_pitch,
183
+ I32:$x,
184
+ I32:$y,
185
+ I32Attr:$elem_size_in_bits,
186
+ I32Attr:$tile_width,
187
+ I32Attr:$tile_height,
188
+ I32Attr:$v_blocks,
189
+ DefaultValuedAttr<XeVM_L1LoadCacheControl, "::mlir::xevm::L1LoadCacheControl::DEFAULT">:$l1_cache_control,
190
+ DefaultValuedAttr<XeVM_L3LoadCacheControl, "::mlir::xevm::L3LoadCacheControl::DEFAULT">:$l3_cache_control
191
+ )> {
192
+
193
+ let summary = "2D block prefetch";
194
+
195
+ let description = [{
196
+ The `xevm.blockprefetch2d` operation prefetches a two dimensional tile
197
+ from a larger matrix residing in memory. The parameters are:
198
+ $ptr - the base address of the matrix containing the tile to prefetch
199
+ $base_width, $base_height, $base_pitch - the shape of the matrix
200
+ $x, $y, $tile_width, $tile_height - the starting offsets and shape of tile to prefetch
201
+ $elem_size_in_bits - the size in bits of the matrix element
202
+ - 32 for f32, bf32
203
+ - 16 for f16, int16, bf16
204
+ - 8 for int8, int4, int2
205
+ $v_blocks - number of tiles to prefetch
206
+ $cache_control - an enumerator that sets the L1 and L3 cache behaviour
207
+
208
+ Notes:
209
+ - pitch is the physical stride between the first columns of the current row and the subsequent row,
210
+ this may include (possibly implicit) padding, alignment, or other factors.
211
+ - coordinate is provided in elements, while width and pitch are provided in bytes.
212
+ }];
213
+
214
+ let assemblyFormat = [{
215
+ operands ` ` `{` `elem_size_in_bits` `=` $elem_size_in_bits `,` `tile_width` `=` $tile_width `,`
216
+ `tile_height` `=` $tile_height `,` `v_blocks` `=` $v_blocks `,` `l1_cache_control` `=` $l1_cache_control `,`
217
+ `l3_cache_control` `=` $l3_cache_control `}`
218
+ attr-dict `:` `(` type(operands) `)`
219
+ }];
220
+
221
+ let hasVerifier = 1;
222
+ }
223
+
224
+
164
225
def XeVM_TargetAttr : XeVM_Attr<"XeVMTarget", "target"> {
165
226
let description = [{
166
227
GPU target attribute for controlling compilation of targets. All
0 commit comments