[Mlir-commits] [mlir] [mlir] NFC: Clarify documentation on InferShapedTypeOpInterface::inferReturnTypeComponents (PR #70350)
Felix Schneider
llvmlistbot at llvm.org
Thu Nov 9 12:58:43 PST 2023
https://github.com/ubfx updated https://github.com/llvm/llvm-project/pull/70350
>From d8d507c4241f1b22ff5162ad3c477b2411e379a0 Mon Sep 17 00:00:00 2001
From: Felix Schneider <fx.schn at gmail.com>
Date: Thu, 26 Oct 2023 18:32:25 +0200
Subject: [PATCH 1/2] [mlir] NFC: Clarify documentation on
InferShapedTypeOpInterface::inferReturnTypeComponents
This patch copies a sentence from the documentation of
`InferTypeOpInterface::inferReturnTypes()` to
`InferShapedTypeOpInterface::inferReturnTypeComponents()`, clarifying
that the method expects valid (verified) input arguments.
---
mlir/include/mlir/Interfaces/InferTypeOpInterface.td | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mlir/include/mlir/Interfaces/InferTypeOpInterface.td b/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
index c5eeeaf58a7b4f8..d32dc16f6f734ae 100644
--- a/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
+++ b/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
@@ -142,6 +142,9 @@ def InferShapedTypeOpInterface : OpInterface<"InferShapedTypeOpInterface"> {
Unknown (e.g., unranked) shape and nullptrs for element type and attribute
may be returned by this function while returning success. E.g., partial
population of components is not error condition.
+
+ Be aware that this method is supposed to be called with valid arguments,
+ e.g., operands are verified, or it may result in an undefined behavior.
}],
/*retTy=*/"::mlir::LogicalResult",
/*methodName=*/"inferReturnTypeComponents",
>From fed5dd756a144d536c3a1c637a4eb73f46e96c14 Mon Sep 17 00:00:00 2001
From: Felix Schneider <fx.schn at gmail.com>
Date: Thu, 9 Nov 2023 21:58:05 +0100
Subject: [PATCH 2/2] document InferReturnTypes
---
mlir/include/mlir/Interfaces/InferTypeOpInterface.td | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/mlir/include/mlir/Interfaces/InferTypeOpInterface.td b/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
index d32dc16f6f734ae..a009e21c61b49b2 100644
--- a/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
+++ b/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
@@ -67,8 +67,10 @@ def InferTypeOpInterface : OpInterface<"InferTypeOpInterface"> {
The return types may be elided or specific elements be null for elements
that should just be returned but not verified.
- Be aware that this method is supposed to be called with valid arguments,
- e.g., operands are verified, or it may result in an undefined behavior.
+ Because this method can be called from within different stages of IR
+ verification, implementations should not assume the arguments to
+ represent fully valid IR and are responsible for checking inputs for
+ validity to the degree necessary to perform the return type inference.
}],
/*retTy=*/"::mlir::LogicalResult",
/*methodName=*/"refineReturnTypes",
@@ -143,8 +145,10 @@ def InferShapedTypeOpInterface : OpInterface<"InferShapedTypeOpInterface"> {
may be returned by this function while returning success. E.g., partial
population of components is not error condition.
- Be aware that this method is supposed to be called with valid arguments,
- e.g., operands are verified, or it may result in an undefined behavior.
+ Because this method can be called from within different stages of IR
+ verification, implementations should not assume the arguments to
+ represent fully valid IR and are responsible for checking inputs for
+ validity to the degree necessary to perform the return type inference.
}],
/*retTy=*/"::mlir::LogicalResult",
/*methodName=*/"inferReturnTypeComponents",
More information about the Mlir-commits
mailing list