@@ -19,17 +19,36 @@ class XeGPUAttr<string name, string attrMnemonic, list<Trait> traits = [],
19
19
}
20
20
21
21
def XeGPU_TensorDescAttr: XeGPUAttr<"TensorDesc", "tdesc_attr"> {
22
+ let summary = [{a composite attribute for `TensorDescType`}];
23
+ let description = [{`TensorDescAttr` (or `tdesc_attr`) is a composite
24
+ attribute defined for `TensorDescType` for describing following
25
+ properties of a `TensorDesc`.
26
+ 1. `memory_scope`: It describes where the data block described by the
27
+ TensorDesc is located, `Global` device memory or `Shared` local memory.
28
+ It is default to `Global`.
29
+ 2. `array_length`: It describes how many horizontally consecutive blocks
30
+ will be loaded by a hardware load instruction. If the TensorDesc shape
31
+ is 8x16, with array_length = 2. The loaded block shape will be acctually
32
+ 8x32. Its default value is 1.
33
+ 3. `boundary_check`: It is used to indicates the hardware whether to do
34
+ out-of-boundary check. The default value is true.
35
+ 4. `scattered`: It is used to differenciate TensorDescs created from
36
+ `create_nd_tdesc` vs from `create_tdesc`.
37
+ }];
38
+
22
39
let parameters = (ins
23
40
OptionalParameter<"MemoryScopeAttr">: $memory_scope,
24
41
OptionalParameter<"IntegerAttr", "1">: $array_length,
25
- OptionalParameter<"BoolAttr", "true">: $boundary_check
42
+ OptionalParameter<"BoolAttr", "true">: $boundary_check,
43
+ OptionalParameter<"BoolAttr", "false">: $scattered
26
44
);
27
45
28
46
let builders = [
29
47
AttrBuilder<(ins
30
48
CArg<"xegpu::MemoryScope", "xegpu::MemoryScope::Global">:$memory_scope,
31
49
CArg<"int", "1">:$array_length,
32
- CArg<"bool", "true">: $boundary_check
50
+ CArg<"bool", "true">: $boundary_check,
51
+ CArg<"bool", "false">: $scattered
33
52
)>
34
53
];
35
54
@@ -41,15 +60,17 @@ def XeGPU_TensorDescAttr: XeGPUAttr<"TensorDesc", "tdesc_attr"> {
41
60
//===----------------------------------------------------------------------===//
42
61
def XeGPU_MemoryScopeGlobal: I32EnumAttrCase<"Global", 0, "global">;
43
62
def XeGPU_MemoryScopeShared: I32EnumAttrCase<"SLM", 1, "slm">;
44
- def XeGPU_MemoryScope: I32EnumAttr<"MemoryScope",
45
- "The address space of the memory the tensor descritor is created for",
63
+ def XeGPU_MemoryScope: I32EnumAttr<"MemoryScope",
64
+ "The address space of the memory the tensor descritor is created for",
46
65
[XeGPU_MemoryScopeGlobal, XeGPU_MemoryScopeShared]> {
47
66
let genSpecializedAttr = 0;
48
67
let cppNamespace = "::mlir::xegpu";
49
68
}
50
69
51
- def XeGPU_MemoryScopeAttr:
70
+ def XeGPU_MemoryScopeAttr:
52
71
EnumAttr<XeGPU_Dialect, XeGPU_MemoryScope, "memory_scope"> {
72
+ let summary = [{Describe the location of data described by a `TensorDesc`:
73
+ Global device memory (`Global`) or Shared local memory (`SLM`).}];
53
74
let assemblyFormat = "$value";
54
75
}
55
76
@@ -63,19 +84,18 @@ def XeGPU_CachePolicyInvalid: I32EnumAttrCase<"READ_INVALIDATE", 3, "read_
63
84
def XeGPU_CachePolicyWriteBack: I32EnumAttrCase<"WRITE_BACK", 4, "write_back">; // valid for write only
64
85
def XeGPU_CachePolicyWriteThrough: I32EnumAttrCase<"WRITE_THROUGH", 5, "write_through">; // valid for write only
65
86
66
- def XeGPU_CachePolicyEnums : I32EnumAttr<"CachePolicy", "Cache policy",
67
- [XeGPU_CachePolicyCached, XeGPU_CachePolicyUncached,
87
+ def XeGPU_CachePolicyEnums : I32EnumAttr<"CachePolicy", "Cache policy",
88
+ [XeGPU_CachePolicyCached, XeGPU_CachePolicyUncached,
68
89
XeGPU_CachePolicyStreaming, XeGPU_CachePolicyInvalid,
69
90
XeGPU_CachePolicyWriteBack, XeGPU_CachePolicyWriteThrough]> {
70
91
let genSpecializedAttr = 0;
71
92
let cppNamespace = "::mlir::xegpu";
72
93
}
73
94
74
- def XeGPU_CacheHintAttr
95
+ def XeGPU_CacheHintAttr
75
96
: EnumAttr<XeGPU_Dialect, XeGPU_CachePolicyEnums, "cache_hint"> {
97
+ let summary = [{Describe the cache settings for prefetch/load/store operators}];
76
98
let assemblyFormat = "`<` $value `>`";
77
99
}
78
100
79
-
80
-
81
- #endif // MLIR_DIALECT_XEGPU_IR_XEGPUATTRS_TD
101
+ #endif // MLIR_DIALECT_XEGPU_IR_XEGPUATTRS_TD
0 commit comments