Skip to content

Commit 94f26c9

Browse files
qedawkinshanhanW
andauthored
[Docs] Make op/attr/type summary styles consistent (#20726)
We have been publishing dialect docs for some time and the summary fields across our dialects were inconsistently styled. This changes all summaries to read more like a sentence (capitalized w/ punctuation) and cleans up a few summaries/descriptions. Switches to use braces everywhere as they make multi-line descriptions easier. - flow.reshape/bitcast descriptions are improved - iree_codegen.query_tile_sizes description is improved - util.global.load description and summary are slightly less redundant There is still a lot of room for improvement on the contents of the docs, but this is a good first step. --------- Co-authored-by: Han-Chung Wang <[email protected]>
1 parent 613f499 commit 94f26c9

File tree

33 files changed

+751
-733
lines changed

33 files changed

+751
-733
lines changed

compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensionsOps.td

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def CopyTensorOperandOp : Op<Transform_Dialect, "iree.copy_tensor_operand",
179179
TransformEachOpTrait,
180180
TransformOpInterface,
181181
ReportTrackingListenerFailuresOpTrait]> {
182-
let summary = "Hoist static allocations";
182+
let summary = [{Create a linalg copy of a specified value.}];
183183
let description = [{
184184
Inserts a copy of the specified operand of the target operation.
185185

@@ -214,7 +214,7 @@ def GpuDistributeSharedMemoryCopyOp :
214214
Op<Transform_Dialect, "iree.gpu_distribute_shared_memory_copy",
215215
[DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
216216
TransformOpInterface, TransformEachOpTrait]> {
217-
let summary = "Distribute shared memory copies";
217+
let summary = [{Distribute shared memory copies.}];
218218
let description = [{
219219
Find copies to/from shared memory and distribute the copies based on the
220220
workgroup size.
@@ -244,7 +244,7 @@ def HoistStaticAllocOp : Op<Transform_Dialect, "iree.hoist_static_alloc",
244244
TransformEachOpTrait,
245245
TransformOpInterface,
246246
ReportTrackingListenerFailuresOpTrait]> {
247-
let summary = "Hoist static allocations";
247+
let summary = [{Hoist static allocations.}];
248248
let description = [{
249249
Find static allocations and hoist them to the top level.
250250

@@ -470,8 +470,9 @@ def MatchHasNoLoweringConfigOp : Op<Transform_Dialect, "iree.match.has_no_loweri
470470
[MatchOpInterface,
471471
SingleOpMatcher,
472472
MemoryEffectsOpInterface]> {
473-
let summary =
474-
"Checks that the payload op does not carry a lowering config or compilation info";
473+
let summary = [{
474+
Checks that the payload op does not carry a lowering config or compilation info.
475+
}];
475476
let description = [{
476477
Verifies that the payload does not have a "compilation_info" or
477478
"lowering_config" attribute. This is a very common check needed for external
@@ -530,7 +531,7 @@ def ReduceSharedMemoryBankConflictsOp : Op<Transform_Dialect, "iree.reduce_shar
530531
TransformEachOpTrait,
531532
TransformOpInterface,
532533
ReportTrackingListenerFailuresOpTrait]> {
533-
let summary = "Add padding to 'memref.alloc' ops reduce shared memory bank conflicts";
534+
let summary = [{Add padding to 'memref.alloc' ops reduce shared memory bank conflicts.}];
534535
let description = [{
535536
The `paddingSizeBits` argument should be picked based on the target
536537
architecture, striking balance between minimizing bank conflicts and keeping

compiler/src/iree/compiler/Codegen/Dialect/CPU/IR/IREECPUAttrs.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ include "mlir/IR/AttrTypeBase.td"
1818
def IREECPU_CPUEncodingLayoutAttr :
1919
AttrDef<IREECPU_Dialect, "CPUEncodingLayout"> {
2020
let mnemonic = "cpu_encoding_layout";
21-
let summary = "The encoding layout attribute for CPU backends.";
21+
let summary = [{The encoding layout attribute for CPU backends.}];
2222
let description = [{
2323
This attribute can implement any layout interface methods for data-tiling,
2424
e.g., Codegen::LayoutAttrInterface, etc. They are implemented through
@@ -37,7 +37,7 @@ def IREECPU_CPUEncodingLayoutAttr :
3737
def IREECPU_VMVXEncodingLayoutAttr :
3838
AttrDef<IREECPU_Dialect, "VMVXEncodingLayout"> {
3939
let mnemonic = "vmvx_encoding_layout";
40-
let summary = "The encoding layout attribute for VMVX backend.";
40+
let summary = [{The encoding layout attribute for VMVX backend.}];
4141
let description = [{
4242
This attribute can implement any layout interface methods for data-tiling,
4343
e.g., Codegen::LayoutAttrInterface, etc. They are implemented through

compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenAttrs.td

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def WorkgroupMappingAttr :
204204
def IREECodegen_TranslationInfoAttr :
205205
AttrDef<IREECodegen_Dialect, "TranslationInfo", []> {
206206
let mnemonic = "translation_info";
207-
let summary = [{drive dispatch entry point lowering}];
207+
let summary = [{Drive dispatch entry point lowering.}];
208208
let description = [{
209209
Specifies the information that is used to drive the translation of
210210
an entry point function using Linalg based structured-op
@@ -294,7 +294,7 @@ def IREECodegen_LoweringConfigAttr :
294294
]>
295295
]> {
296296
let mnemonic = "lowering_config";
297-
let summary = [{drive lowering of an operation within dispatch region}];
297+
let summary = [{Drive lowering of an operation within dispatch region.}];
298298
let description = [{
299299
Default implementation of a lowering configuration attribute. It includes
300300
only tiling and optionally vectorization information. The interpretation of
@@ -364,7 +364,7 @@ def IREECodegen_LoweringConfigAttr :
364364
def IREECodegen_CompilationInfoAttr :
365365
AttrDef<IREECodegen_Dialect, "CompilationInfo", []> {
366366
let mnemonic = "compilation_info";
367-
let summary = [{drive lowering of an operation from input dialect}];
367+
let summary = [{Drive lowering of an operation from input dialect.}];
368368
let description = [{
369369
Specifies the information that allows controlling the compilation
370370
of operations like `linalg.matmul`/`linalg.*conv` within
@@ -398,7 +398,7 @@ def IREECodegen_CompilationInfoAttr :
398398

399399
def IREECodegen_ExportConfig : AttrDef<IREECodegen_Dialect, "ExportConfig", []> {
400400
let mnemonic = "export_config";
401-
let summary = "User defined workgroup size specification";
401+
let summary = [{User defined workgroup size specification.}];
402402
let description = [{
403403
Allows setting workgroup size for pre-formed dispatches.
404404
}];
@@ -426,7 +426,7 @@ def IREECodegen_EncodingNopLayoutAttr :
426426
]>
427427
]> {
428428
let mnemonic = "encoding_nop_layout";
429-
let summary = "An attribute with implementation that treats encoding as nop.";
429+
let summary = [{An attribute with implementation that treats encoding as nop.}];
430430
let description = [{
431431
An attribute that implements the interface methods that discards the
432432
encodings. It can be a default attribute when a backend does not implement
@@ -446,7 +446,7 @@ def IREECodegen_RotateRowsAttr :
446446
]>
447447
]> {
448448
let mnemonic = "rotate_rows";
449-
let summary = "An attribute that describes a swizzling pattern for rotating rows.";
449+
let summary = [{An attribute that describes a swizzling pattern for rotating rows.}];
450450
let description = [{
451451
This attribute rotates accesses of |access_width| within rows of size
452452
|row_width|. For any given access into logical memref of shape

compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenOps.td

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ def TensorTypeAttr : TypeAttrBase<"TensorType", "Tensor type attribute">;
2020

2121
def IREECodegen_QueryTileSizesOp :
2222
Op<IREECodegen_Dialect, "query_tile_sizes", [Pure]> {
23-
let summary = "Query tile sizes";
23+
let summary = [{Yields tile sizes for the specified tensor type.}];
2424

2525
let description = [{
26-
Query tile sizes
26+
For targets where tile sizes can't be resolved at compile time, this
27+
operation allows querying the sizes at runtime. Today this only applies
28+
to VMVX.
2729
}];
2830

2931
let arguments = (ins TensorTypeAttr:$tensor_type);
@@ -43,7 +45,7 @@ def IREECodegen_ExtractStridedMetadataOp : Op<IREECodegen_Dialect, "extract_stri
4345
SameVariadicResultSize,
4446
ViewLikeOpInterface,
4547
InferTypeOpAdaptor]> {
46-
let summary = "Extracts a buffer base with offset and strides";
48+
let summary = [{Extracts a buffer base with offset and strides.}];
4749
let description = [{
4850
This op is implemented similarly to the upstream MemRef::ExtractStridedMetadataOp
4951
with the following differences.
@@ -109,7 +111,7 @@ def IREECodegen_ExtractStridedMetadataOp : Op<IREECodegen_Dialect, "extract_stri
109111

110112
def IREECodegen_SwizzleHintOp : Op<IREECodegen_Dialect, "swizzle_hint", [
111113
SameOperandsAndResultType, Pure]> {
112-
let summary = "Hint to swizzle accesses according to an access pattern";
114+
let summary = [{Hint to swizzle accesses according to an access pattern.}];
113115
let description = [{
114116
Optimization hint to swizzle all accesses to the memref this takes a view
115117
of. This only affects reads/writes immediately consuming this operation and
@@ -163,7 +165,7 @@ def IREECodegen_SwizzleHintOp : Op<IREECodegen_Dialect, "swizzle_hint", [
163165

164166
def IREECodegen_NullPointerOp :
165167
Op<IREECodegen_Dialect, "null_pointer", [Pure]> {
166-
let summary = "Returns a null_pointer value.";
168+
let summary = [{Returns a null_pointer value.}];
167169
let description = [{
168170
This is meant to be used only as arguments to microkernels.
169171
}];
@@ -177,7 +179,7 @@ def IREECodegen_NullPointerOp :
177179

178180
def IREECodegen_LoadFromMemrefOp : Op<IREECodegen_Dialect, "load_from_memref",
179181
[DeclareOpInterfaceMethods<MemoryEffectsOpInterface>]> {
180-
let summary = [{loads a tensor from a memref}];
182+
let summary = [{Loads a tensor from a memref.}];
181183
let description = [{
182184
Loads a tensor from a memref with a compatible shape and the same element
183185
type.
@@ -199,7 +201,7 @@ def IREECodegen_LoadFromMemrefOp : Op<IREECodegen_Dialect, "load_from_memref",
199201

200202
def IREECodegen_StoreToMemrefOp : Op<IREECodegen_Dialect, "store_to_memref",
201203
[DeclareOpInterfaceMethods<MemoryEffectsOpInterface>]> {
202-
let summary = [{stores a tensor into a memref}];
204+
let summary = [{Stores a tensor into a memref.}];
203205
let description = [{
204206
Stores a tensor into a memref with a compatible shape and the same element
205207
type.

compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenTypes.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ include "iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenDialect.td"
1111

1212
def NullPointer
1313
: TypeDef<IREECodegen_Dialect, "NullPointer", []> {
14-
let summary = "Pseudo null-pointer type. Lowers to a null pointer.";
14+
let summary = [{Pseudo null-pointer type. Lowers to a null pointer.}];
1515
let description = [{
1616
This is meant to be used only as arguments to microkernels.
1717
}];

compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/UKernelOps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class IREECodegen_UKernelOp<string mnemonic, list<Trait> traits = []> :
2222
def IREECodegen_UKernelGenericOp :
2323
IREECodegen_UKernelOp<"ukernel.generic", [
2424
AttrSizedOperandSegments]> {
25-
let summary = "Generic Microkernel operator";
25+
let summary = [{Generic Microkernel operator.}];
2626

2727
let description = [{
2828
Operation to wrap a computation forwarded to a microkernel.

compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUAttrs.td

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def IREEGPU_LoweringConfigAttr :
4444
]>
4545
]> {
4646
let mnemonic = "lowering_config";
47-
let summary = "drive lowering of an operation for gpu compilation.";
47+
let summary = [{Drive lowering of an operation for gpu compilation.}];
4848
let description = [{
4949
GPU specific implementation of a lowering config. This carries just a
5050
dictionary attribute to store any relevant fields. This is the simplest
@@ -69,7 +69,7 @@ def IREEGPU_DerivedThreadConfig :
6969
]> {
7070
let mnemonic = "derived_thread_config";
7171
let summary = [{
72-
drive lowering of an operation by deriving thread distribution when needed.
72+
Drive lowering of an operation by deriving thread distribution when needed.
7373
}];
7474
let description = [{
7575
Lowering config for a single thread tiling level that is inferred after
@@ -295,7 +295,7 @@ def IREEGPU_MmaScheduleAttr : AttrDef<IREEGPU_Dialect, "MMASchedule"> {
295295
def IREEGPU_GPUEncodingLayoutAttr :
296296
AttrDef<IREEGPU_Dialect, "GPUEncodingLayout"> {
297297
let mnemonic = "gpu_encoding_layout";
298-
let summary = "The encoding layout attribute for GPU backend";
298+
let summary = [{The encoding layout attribute for GPU backend.}];
299299
let description = [{
300300
This attribute can implement any layout interface methods for data-tiling,
301301
e.g., Codegen::LayoutAttrInterface, etc. They should be implemented
@@ -319,7 +319,7 @@ def IREEGPU_GPUEncodingLayoutAttr :
319319

320320
def IREEGPU_GPUPadLayoutAttr : AttrDef<IREEGPU_Dialect, "GPUPadLayout"> {
321321
let mnemonic = "gpu_pad_layout";
322-
let summary = "The padded encoding layout attribute for GPU targets.";
322+
let summary = [{The padded encoding layout attribute for GPU targets.}];
323323
let assemblyFormat = "`<` struct(params) `>`";
324324

325325
let description = [{
@@ -345,7 +345,7 @@ def IREEGPU_GPUPadLayoutAttr : AttrDef<IREEGPU_Dialect, "GPUPadLayout"> {
345345
//===----------------------------------------------------------------------===//
346346

347347
def IREEGPU_TargetWgpAttr : AttrDef<IREEGPU_Dialect, "TargetWgp"> {
348-
let summary = "Workgroup processor level target description";
348+
let summary = [{Workgroup processor level target description.}];
349349
let description = [{
350350
This attribute contains hardware features/limits at a single GPU workgroup
351351
processor (WGP) level. Here a GPU workgroup processor means the basic
@@ -403,7 +403,7 @@ def IREEGPU_TargetWgpAttr : AttrDef<IREEGPU_Dialect, "TargetWgp"> {
403403
// AMD compute units or NVIDIA streaming multiprocessors; it's the final SKU.
404404

405405
def IREEGPU_TargetChipAttr : AttrDef<IREEGPU_Dialect, "TargetChip"> {
406-
let summary = "Chip level target description";
406+
let summary = [{Chip level target description.}];
407407
let description = [{
408408
This attribute contains hardware features/limits at a single GPU chip level.
409409
Here a GPU chip means the hardware functionality scope where the whole
@@ -433,7 +433,7 @@ def IREEGPU_TargetChipAttr : AttrDef<IREEGPU_Dialect, "TargetChip"> {
433433
//===----------------------------------------------------------------------===//
434434

435435
def IREEGPU_TargetAttr : AttrDef<IREEGPU_Dialect, "Target"> {
436-
let summary = "Full GPU target attribute";
436+
let summary = [{Full GPU target attribute.}];
437437
let description = [{
438438
This attributes describes a full GPU target. It contains a few fields:
439439
* The canonical target architecture for compilation, e.g., sm_80 for
@@ -530,7 +530,7 @@ def IREEGPU_LaneIdAttr : AttrDef<IREEGPU_Dialect, "LaneId", [
530530
def IREEGPU_UKernelConfigAttr :
531531
AttrDef<IREEGPU_Dialect, "UKernelConfig", []> {
532532
let mnemonic = "ukernel_config";
533-
let summary = "An attribute specifying a ukernel that an op can lower to.";
533+
let summary = [{An attribute specifying a ukernel that an op can lower to.}];
534534
let description = [{
535535
An attribute that can be applied to any operation to specify that it has
536536
been matched with a ukernel that is a legal lowering for it.
@@ -554,7 +554,7 @@ def IREEGPU_ReorderWorkgroupsStrategyAttr :
554554
}
555555

556556
def IREEGPU_GPUPipelineOptionsAttr : AttrDef<IREEGPU_Dialect, "GPUPipelineOptions"> {
557-
let summary = "GPU pipeline options attribute.";
557+
let summary = [{Options attribute for linalg + tensors -> vector + memref GPU pipelines.}];
558558
let description = [{
559559
This attributes describes lowering pipeline specific configuration options:
560560
* prefetch_shared_memory: Boolean option indicating whether or not to run

compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUOps.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def IREEGPU_BarrierRegionOp : Op<IREEGPU_Dialect, "barrier_region", [
2626
Pure,
2727
SingleBlockImplicitTerminator<"mlir::iree_compiler::IREE::GPU::YieldOp">
2828
]> {
29-
let summary = "Synchronizes uses of a shared tensor.";
29+
let summary = [{Synchronizes workers on a region of shared code.}];
3030
let description = [{
3131
This op is designed to represent synchronization of workers on the operands
3232
and results of the given region. This operation naturally arises when combining
@@ -125,7 +125,7 @@ def IREEGPU_MultiMmaOp : Op<IREEGPU_Dialect, "multi_mma", [
125125
"getTiledImplementation",
126126
"getResultTilePosition"]>
127127
]> {
128-
let summary = "Models a contraction of multiple mma operations";
128+
let summary = [{Models a contraction of multiple mma operations.}];
129129
let description = [{
130130
Computes the sum of inner MMA operations along a set of outer dimensions.
131131
Logically matches closely with a `vector.contraction` operation, however
@@ -391,7 +391,7 @@ def IREEGPU_MultiMmaOp : Op<IREEGPU_Dialect, "multi_mma", [
391391
def IREEGPU_ValueBarrierOp : Op<IREEGPU_Dialect, "value_barrier", [
392392
Pure,
393393
AllTypesMatch<["inputs", "results"]>]> {
394-
let summary = "Synchronizes workers on a value semantic tensor or vector.";
394+
let summary = [{Synchronizes workers on a value semantic tensor or vector.}];
395395
let description = [{
396396
This operation acts as a barrier on a value semantic SSA values (tensor or
397397
vector). It takes multiple operands and produces a value equivalent to each
@@ -444,7 +444,7 @@ def IREEGPU_ValueBarrierOp : Op<IREEGPU_Dialect, "value_barrier", [
444444
def IREEGPU_YieldOp : Op<IREEGPU_Dialect, "yield", [
445445
Pure, ReturnLike, Terminator,
446446
HasParent<"::mlir::iree_compiler::IREE::GPU::BarrierRegionOp">]> {
447-
let summary = "Yield values from a region";
447+
let summary = [{Yield values from a iree_gpu region.}];
448448
let description = [{
449449
This operation is used to yield values from a within a region.
450450
}];
@@ -469,7 +469,7 @@ def IREEGPU_YieldOp : Op<IREEGPU_Dialect, "yield", [
469469
def IREEGPU_BufferResourceCastOp : Op<IREEGPU_Dialect, "buffer_resource_cast", [
470470
Pure,
471471
AllTypesMatch<["input", "result"]>]> {
472-
let summary = "Represents a cast to addr_space<7> (buffer resource) before bufferization";
472+
let summary = [{Represents a cast to addr_space<7> (buffer resource) before bufferization.}];
473473
let description = [{
474474
Nominal cast of a tensor to AMDGPU buffer resource memory space before
475475
bufferization. This op takes the parameters with which to perform the cast

compiler/src/iree/compiler/Codegen/Dialect/VectorExt/IR/VectorExtAttrs.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ include "iree/compiler/Codegen/Dialect/VectorExt/IR/VectorExtBase.td"
1616
def NestedLayoutAttr : IREEVectorExt_Attr<"NestedLayout",
1717
[ DeclareAttrInterfaceMethods<VectorLayoutInterface> ]> {
1818
let mnemonic = "nested_layout";
19-
let summary = [{A layout representing a mapping from GPU thread hierarchy to a shape}];
19+
let summary = [{A layout representing a mapping from GPU thread hierarchy to a shape.}];
2020
let description = [{
2121
This layout explicitly defines how the shape of the associated vector
2222
is mapped to a compute hierarchy.

compiler/src/iree/compiler/Codegen/Dialect/VectorExt/IR/VectorExtOps.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def IREEVectorExt_ToLayoutOp : IREEVectorExt_PureOp<"to_layout", [
3030
Pure,
3131
AllTypesMatch<["input", "output"]>
3232
]> {
33-
let summary = "Layout conversion operator";
33+
let summary = [{Layout conversion operator.}];
3434
let description = [{
3535
The layout conversion operator takes a shaped value and a layout and
3636
transforms the value to have that layout.
@@ -78,7 +78,7 @@ def IREEVectorExt_ToLayoutOp : IREEVectorExt_PureOp<"to_layout", [
7878

7979
def IREEVectorExt_ToSIMDOp : IREEVectorExt_PureOp<"to_simd",
8080
[SameOperandsAndResultElementType, Pure]> {
81-
let summary = "SIMT to SIMD conversion operation";
81+
let summary = [{SIMT to SIMD conversion operation.}];
8282
let description = [{
8383
This operation is a temporary operation useful for source/target
8484
materializations when doing type conversions between distributed and not
@@ -97,7 +97,7 @@ def IREEVectorExt_ToSIMDOp : IREEVectorExt_PureOp<"to_simd",
9797

9898
def IREEVectorExt_ToSIMTOp : IREEVectorExt_PureOp<"to_simt",
9999
[SameOperandsAndResultElementType, Pure]> {
100-
let summary = "SIMD to SIMT conversion operation";
100+
let summary = [{SIMD to SIMT conversion operation.}];
101101
let description = [{
102102
This operation is a temporary operation useful for source/target
103103
materializations when doing type conversions between distributed and not
@@ -131,7 +131,7 @@ def IREEVectorExt_TransferGatherOp : IREEVectorExt_PureOp<"transfer_gather", [
131131
BoolArrayAttr:$in_bounds);
132132
let results = (outs AnyVectorOfAnyRank:$vector);
133133

134-
let summary = "Gathers a supervector from memory into an SSA vector value.";
134+
let summary = [{Gathers a supervector from memory into an SSA vector value.}];
135135

136136
let description = [{
137137
The iree_vector_ext.transfer_gather operation provides a structured

0 commit comments

Comments
 (0)