@@ -69,6 +69,7 @@ class XeVM_Op<string mnemonic, list<Trait> traits = []>
69
69
}
70
70
71
71
def XeVM_ElemType : AnyTypeOf<[AnyI8, AnyI16, AnyI32, F32, TF32, F16, BF16]>;
72
+ def XeVM_1DBlockElemType : AnyTypeOf<[I8, I16, I32, I64]>;
72
73
73
74
//===----------------------------------------------------------------------===//
74
75
// XeVM Load Cache Control
@@ -187,6 +188,81 @@ def XeVM_StoreCacheControlAttr
187
188
let assemblyFormat = "`<` $value `>`";
188
189
}
189
190
191
+ def XeVM_BlockLoadOp
192
+ : XeVM_Op<"blockload">,
193
+ Results<(
194
+ outs FixedVectorOfRankAndType<[1], [XeVM_1DBlockElemType]>:$res)>,
195
+ Arguments<(ins Arg<LLVM_AnyPointer, "", [MemRead]>:$ptr,
196
+ OptionalAttr<XeVM_LoadCacheControlAttr>:$cache_control)> {
197
+ let summary = "subgroup block load";
198
+ let description = [{
199
+ Reads one or more components of Result data for each invocation
200
+ in the subgroup from the specified `ptr` as a block operation.
201
+ The data is read strided, so the first value read is:
202
+ ```
203
+ ptr[ SubgroupLocalInvocationId ]
204
+ ```
205
+ and the second value read is:
206
+ ```
207
+ ptr[ SubgroupLocalInvocationId + SubgroupMaxSize ]
208
+ ```
209
+ Result type may be a scalar or vector type of scalar element type.
210
+
211
+ The parameters are:
212
+ * `ptr` - the base address to load from. Must be uniform across subgroup.
213
+ * `cache_control` - an enumerator that sets the cache behaviour
214
+
215
+ Example:
216
+ ```mlir
217
+ %loaded_a = xevm.blockload %src,
218
+ <{cache_control=#xevm.load_cache_control<L1uc_L2uc_L3uc>}>
219
+ : (!llvm.ptr<1>) -> vector<4xi16>
220
+ ```
221
+ }];
222
+ let assemblyFormat = [{
223
+ operands prop-dict attr-dict `:` functional-type(operands, results)
224
+ }];
225
+ let hasVerifier = 1;
226
+ }
227
+
228
+ def XeVM_BlockStoreOp
229
+ : XeVM_Op<"blockstore">,
230
+ Arguments<(ins Arg<LLVM_AnyPointer, "", [MemWrite]>:$ptr,
231
+ FixedVectorOfRankAndType<[1], [XeVM_1DBlockElemType]>:$val,
232
+ OptionalAttr<XeVM_StoreCacheControlAttr>:$cache_control)> {
233
+ let summary = "subgroup block store";
234
+ let description = [{
235
+ Writes one or more components of `val` for each invocation
236
+ in the subgroup to the specified `ptr` as a block operation.
237
+ The data is written strided, so the first value is written to:
238
+ ```
239
+ ptr[ SubgroupLocalInvocationId ]
240
+ ```
241
+ and the second value is written to:
242
+ ```
243
+ ptr[ SubgroupLocalInvocationId + SubgroupMaxSize ]
244
+ ```
245
+ `val` type may be a scalar or vector type of scalar element type.
246
+
247
+ The parameters are:
248
+ * `ptr` - the base address to store to. Must be uniform across subgroup.
249
+ * `val` - the value to store
250
+ * `cache_control` - an enumerator that sets the cache behaviour
251
+
252
+ Example:
253
+ ```mlir
254
+ xevm.blockstore %ptr, %val
255
+ <{cache_control=#xevm.store_cache_control<L1uc_L2uc_L3uc>}>
256
+ : (!llvm.ptr<1>, vector<4xi16>)
257
+ ```
258
+ }];
259
+
260
+ let assemblyFormat = [{
261
+ operands prop-dict attr-dict `:` `(` type(operands) `)`
262
+ }];
263
+ let hasVerifier = 1;
264
+ }
265
+
190
266
def XeVM_BlockLoad2dOp
191
267
: XeVM_Op<"blockload2d">,
192
268
Results<(outs FixedVectorOfRankAndType<[1], [XeVM_ElemType]>:$res)>,
0 commit comments