Skip to content

Commit

Permalink
[mlir] fix wording in transform dialect docs
Browse files Browse the repository at this point in the history
The wording "fails silently" has been sometimes used to indicate that a
silenceable failure was emitted by the operation. The meaning is exactly
the opposite: silenceable failure is _not_ silent unless silenced.
  • Loading branch information
ftynse committed Jan 17, 2024
1 parent 588802a commit baa39b7
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 71 deletions.
65 changes: 34 additions & 31 deletions mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ def DecomposeOp : Op<Transform_Dialect, "structured.decompose",

This operation ignores non-Linalg ops and drops them in the return.
If all the operations referred to by the `target` handle decompose
properly, the transform succeeds. Otherwise the transform silently fails.
The return handle points to only the subset of successfully produced
computational operations, which can be empty.
properly, the transform succeeds. Otherwise the transform produces a
silenceable failure. The return handle points to only the subset of
successfully produced computational operations, which can be empty.
}];

let arguments = (ins TransformHandleTypeInterface:$target);
Expand Down Expand Up @@ -336,11 +336,11 @@ def FuseIntoContainingOp :

#### Return modes

If at least one producer could not be fused, this operation fails silently.
This is the case when tiling fails or when no producer op could be found
among the remaining producers that has at least one use within the
containing op. I.e., "producers" that are not consumed within the containing
op are rejected by this operation.
If at least one producer could not be fused, this operation produces a
silenceable failure. This is the case when tiling fails or when no
producer op could be found among the remaining producers that has at least
one use within the containing op. I.e., "producers" that are not consumed
within the containing op are rejected by this operation.

This operation consumes the producer handle.
This operation only reads the containing op handle.
Expand Down Expand Up @@ -374,10 +374,10 @@ def GeneralizeOp : Op<Transform_Dialect, "structured.generalize",

This operation ignores non-Linalg ops and drops them in the return.
If all the operations referred to by the `target` handle generalize
properly, the transform succeeds. Otherwise the transform silently fails.
The return handle points to only the subset of successfully produced
equivalent generic operations, which can be empty or contain the original
ops if they were already in generic form.
properly, the transform succeeds. Otherwise the transform produces a
silenceable failure. The return handle points to only the subset of
successfully produced equivalent generic operations, which can be empty or
contain the original ops if they were already in generic form.
}];

let arguments = (ins TransformHandleTypeInterface:$target);
Expand Down Expand Up @@ -450,7 +450,7 @@ def InterchangeOp : Op<Transform_Dialect, "structured.interchange",
This operation fails if the interchange attribute is invalid.
If all the operations referred to by the `target` handle interchange
properly, the transform succeeds.
If any interchange fails, the transform definitely fails.
If any interchange fails, the transform produces a definite failure.
The return handle points to only the subset of successfully produced
interchanged operations, which can be empty.
}];
Expand Down Expand Up @@ -492,7 +492,7 @@ def LowerPackOp : Op<Transform_Dialect, "structured.lower_pack", [
#### Return modes

This operation ignores non-pack ops and drops them in the return.
This operation produces a silenceableFailure if the rewrite fails for any
This operation produces a silenceable failure if the rewrite fails for any
reason.
If all the operations referred to by the `target` are rewritten, the
transform succeeds.
Expand Down Expand Up @@ -532,7 +532,7 @@ def LowerUnPackOp : Op<Transform_Dialect, "structured.lower_unpack", [
#### Return modes

This operation ignores non-unpack ops and drops them in the return.
This operation produces a silenceableFailure if the rewrite fails for any
This operation produces a silenceable failure if the rewrite fails for any
reason.
If all the operations referred to by the `target` are rewritten, the
transform succeeds.
Expand Down Expand Up @@ -770,7 +770,7 @@ def PackOp : Op<Transform_Dialect, "structured.pack", [
#### Return modes

This operation applies to a single Linalg op, otherwise it fails.
This operation may produce a definiteFailure if the packing fails for any
This operation may produce a definite failure if the packing fails for any
reason.

The returned handle point to the packed LinalgOp.
Expand Down Expand Up @@ -997,11 +997,12 @@ def PadOp : Op<Transform_Dialect, "structured.pad",
#### Return modes

This operation ignores non-Linalg ops and drops them in the return.
This operation may produce a definiteFailure if the padding fails for any
This operation may produce a definite failure if the padding fails for any
reason.

If all the operations referred to by the `target` handle pad
properly, the transform succeeds. Otherwise the transform silently fails.
properly, the transform succeeds. Otherwise the transform produces a
silenceable failure.
The return handle points to only the subset of successfully produced
padded operations, which can be empty.
}];
Expand Down Expand Up @@ -1114,7 +1115,7 @@ def HoistPadOp : Op<Transform_Dialect, "structured.hoist_pad",
If any non-tensor.pad is passed, the transform emits a silenceable failure.

If all the operations referred to by the `target` handle padproperly, the
transform succeeds. Otherwise the transform silently fails.
transform succeeds. Otherwise the transform produces a silenceable failure.

The return handle points to only the subset of successfully hoisted
tensor.pad operations, which can be empty.
Expand Down Expand Up @@ -1240,10 +1241,11 @@ def ScalarizeOp : Op<Transform_Dialect, "structured.scalarize",
#### Return modes:

This operation ignores non-Linalg ops and drops them in the return.
This operation produces `definiteFailure` if the scalarization fails for any
This operation produces definite failure if the scalarization fails for any
reason.
If all the operations referred to by the `target` handle scalarize
properly, the transform succeeds. Otherwise the transform silently fails.
properly, the transform succeeds. Otherwise the transform produces a
silenceable failure.

The return handle points to only the subset of successfully produced
tiled-by-1 operations, which can be empty.
Expand Down Expand Up @@ -1351,7 +1353,8 @@ def RewriteInDestinationPassingStyleOp : Op<

This operation ignores non-unsupported ops and drops them from the return.
If all the operations referred to by the `target` handle generalize
properly, the transform succeeds. Otherwise the transform silently fails.
properly, the transform succeeds. Otherwise the transform produces a
silenceable failure.
The return handle points to a subset of successfully produced operations:
- `tensor.pad` case, the returned handle points to the tensor.insert_slice.
- `tensor.generate` case, the returned handle points to the linalg.generic.
Expand Down Expand Up @@ -1444,13 +1447,13 @@ def SplitReductionOp : Op<Transform_Dialect, "structured.split_reduction",
#### Return modes

This operation ignores non-Linalg ops and drops them in the return.
This operation produces `definiteFailure` if the splitting fails for any
This operation produces a definite failure if the splitting fails for any
reason.

If all the operations referred to by the `target` handle split
properly, the transform succeeds. Otherwise the transform silently fails.
The 4 returned handles points to only the subset of successfully produced
computational operations, which can all be empty.
properly, the transform succeeds. Otherwise the transform produces a
silenceable failure. The 4 returned handles points to only the subset of
successfully produced computational operations, which can all be empty.
This 4 returned handles point to:
- the init op (or tensor_alloc op if use_alloc = true),
- the fill op used to initialize the neutral element,
Expand Down Expand Up @@ -1910,7 +1913,7 @@ def TileUsingForallOp :
Tiling is applied by either specifying `num_threads` or `tile_size`. If
`num_threads` is specified, then the tile size for each dimension `i` is
calculated dynamically via `ceilDiv(dimSize[i], num_threads[i])`.
`num_threads` and `tile_size` can be either static index attributes or
`num_threads` and `tile_size` can be either static index attributes or
operation handles (or a mix thereof). Operation handles must be mapped to
exactly one op that has exactly one result of index type.

Expand All @@ -1935,7 +1938,7 @@ def TileUsingForallOp :

If all the operations referred to by the `target` handle tile
successfully, the transform succeeds.
Otherwise the transform silently fails.
Otherwise the transform produces a silenceable failure.

The two returned handles point to only the subset of successfully produced
tiled operations, which can all be empty.
Expand Down Expand Up @@ -2066,7 +2069,7 @@ def VectorizeChildrenAndApplyPatternsOp :

#### Return modes:

This operation produces `definiteFailure` if vectorization fails for any
This operation produces a definite failure if vectorization fails for any
reason.
The operation always returns the handle to the target op that is expected
to be isolated from above.
Expand Down Expand Up @@ -2103,7 +2106,7 @@ def VectorizeOp : Op<Transform_Dialect, "structured.vectorize",
[DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
TransformOpInterface, ReportTrackingListenerFailuresOpTrait]> {
let description = [{
Vectorize the target ops, which must be Linalg ops.
Vectorize the target ops, which must be Linalg ops.

Use the optional vector sizes to specify exactly what configuration the
vectorizer should use. It will then use masked vectors of the specified
Expand Down Expand Up @@ -2133,7 +2136,7 @@ def VectorizeOp : Op<Transform_Dialect, "structured.vectorize",
This operation produces a silenceable failure if at least one target op is
not a Linalg op or fails to vectorize. It produces a definite failure if
the dynamic vector sizes (SSA values) do not satisfy the constraints
mentioned above.
mentioned above.
}];

let arguments = (ins TransformHandleTypeInterface:$target,
Expand Down
14 changes: 7 additions & 7 deletions mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ def LoopPipelineOp : Op<Transform_Dialect, "loop.pipeline",

This operation ignores non-scf::For ops and drops them in the return.
If all the operations referred to by the `target` PDLOperation pipeline
properly, the transform succeeds. Otherwise the transform silently fails.
The return handle points to only the subset of successfully produced
pipelined loops, which can be empty.
properly, the transform succeeds. Otherwise the transform produces a
silenceable failure. The return handle points to only the subset of
successfully produced pipelined loops, which can be empty.
}];

let arguments = (ins Transform_ScfForOp:$target,
Expand Down Expand Up @@ -240,10 +240,10 @@ def LoopUnrollOp : Op<Transform_Dialect, "loop.unroll",

#### Return modes

This operation ignores non-scf::For, non-affine::For ops and drops them in
the return. If all the operations referred to by the `target` PDLOperation
unroll properly, the transform succeeds. Otherwise the transform silently
fails.
This operation ignores non-`scf.for`, non-`affine.for` ops and drops them
in the return. If all the operations referred to by the `target` operand
unroll properly, the transform succeeds. Otherwise the transform produces a
silencebale failure.

Does not return handles as the operation may result in the loop being
removed after a full unrolling.
Expand Down
Loading

0 comments on commit baa39b7

Please sign in to comment.