Skip to content

Commit ddc42c2

Browse files
committed
update description
1 parent 7eaf0a6 commit ddc42c2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

mlir/include/mlir/Dialect/XeGPU/IR/XeGPUAttrs.td

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def LayoutTrait: AttrInterface<"LayoutTrait"> {
187187
"getEffectiveSgLayout">,
188188
InterfaceMethod<"Get the effective sg data",
189189
"std::optional<llvm::SmallVector<int>>",
190-
"getEffectiveSgData">,
190+
"getEffectiveSgData">
191191
];
192192
}
193193

@@ -375,6 +375,16 @@ def XeGPU_SliceAttr : XeGPUAttr<"Slice", "slice", [LayoutTrait]> {
375375
specified dimensions share the data, provided that the remaining ranks match the data
376376
rank. SliceAttr is commonly used by operations such as vector.multi_reduction and
377377
vector.broadcast.
378+
379+
Example:
380+
```
381+
#l = #xegpu.layout<sg_layout = [8, 4], sg_data = [32, 32]>
382+
#r = #xegpu.slice<#l, dim = 0>
383+
384+
%exp = math.exp %input {layout_result_0 = #l}: vector<256x128xf32>
385+
%red = vector.multi_reduction<add>, %exp, %acc [0] {layout_result_0 = #r}: vector<256x128xf32> to vector<128xf32>
386+
%bcast = vector.broadcast %red {layout_result_0 = #l} : vector<128xf32> to vector<256x128xf32>
387+
```
378388
}];
379389

380390
let parameters = (ins

0 commit comments

Comments
 (0)