[Mlir-commits] [mlir] 08e8dac - [mlir] NFC: Clarify documentation on `Infer(Shaped)TypeOpInterface` (#70350)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Nov 13 10:54:05 PST 2023


Author: Felix Schneider
Date: 2023-11-13T19:54:01+01:00
New Revision: 08e8dacb4ad777ff06b747006c838c0fbab4ff51

URL: https://github.com/llvm/llvm-project/commit/08e8dacb4ad777ff06b747006c838c0fbab4ff51
DIFF: https://github.com/llvm/llvm-project/commit/08e8dacb4ad777ff06b747006c838c0fbab4ff51.diff

LOG: [mlir] NFC: Clarify documentation on `Infer(Shaped)TypeOpInterface`  (#70350)

This patch clarifies the documentation of methods `inferReturnTypeComponents()`
and `inferReturnTypes()` regarding verified/valid arguments.

Added: 
    

Modified: 
    mlir/include/mlir/Interfaces/InferTypeOpInterface.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Interfaces/InferTypeOpInterface.td b/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
index c5eeeaf58a7b4f8..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 
diff erent 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",
@@ -142,6 +144,11 @@ 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.
+
+      Because this method can be called from within 
diff erent 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