Skip to content

Commit 08e8dac

Browse files
authored
[mlir] NFC: Clarify documentation on Infer(Shaped)TypeOpInterface (#70350)
This patch clarifies the documentation of methods `inferReturnTypeComponents()` and `inferReturnTypes()` regarding verified/valid arguments.
1 parent d8576e4 commit 08e8dac

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

mlir/include/mlir/Interfaces/InferTypeOpInterface.td

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ def InferTypeOpInterface : OpInterface<"InferTypeOpInterface"> {
6767
The return types may be elided or specific elements be null for elements
6868
that should just be returned but not verified.
6969

70-
Be aware that this method is supposed to be called with valid arguments,
71-
e.g., operands are verified, or it may result in an undefined behavior.
70+
Because this method can be called from within different stages of IR
71+
verification, implementations should not assume the arguments to
72+
represent fully valid IR and are responsible for checking inputs for
73+
validity to the degree necessary to perform the return type inference.
7274
}],
7375
/*retTy=*/"::mlir::LogicalResult",
7476
/*methodName=*/"refineReturnTypes",
@@ -142,6 +144,11 @@ def InferShapedTypeOpInterface : OpInterface<"InferShapedTypeOpInterface"> {
142144
Unknown (e.g., unranked) shape and nullptrs for element type and attribute
143145
may be returned by this function while returning success. E.g., partial
144146
population of components is not error condition.
147+
148+
Because this method can be called from within different stages of IR
149+
verification, implementations should not assume the arguments to
150+
represent fully valid IR and are responsible for checking inputs for
151+
validity to the degree necessary to perform the return type inference.
145152
}],
146153
/*retTy=*/"::mlir::LogicalResult",
147154
/*methodName=*/"inferReturnTypeComponents",

0 commit comments

Comments
 (0)