From c59171a463bd180f2706b5bbf7052e2302dc3100 Mon Sep 17 00:00:00 2001 From: Yuanqiang Liu Date: Fri, 26 Apr 2024 22:30:34 +0800 Subject: [PATCH 1/2] fix ArgAnnotation with boolean flag which instructs value semantics --- projects/pt1/python/torch_mlir_e2e_test/annotations.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/pt1/python/torch_mlir_e2e_test/annotations.py b/projects/pt1/python/torch_mlir_e2e_test/annotations.py index 5a07b306eb2d..0e0a97e6649a 100644 --- a/projects/pt1/python/torch_mlir_e2e_test/annotations.py +++ b/projects/pt1/python/torch_mlir_e2e_test/annotations.py @@ -44,7 +44,7 @@ def export(fn): return fn -ArgAnnotation = Tuple[List[int], torch.dtype] +ArgAnnotation = Tuple[List[int], torch.dtype, bool] # TODO: Replace with py3 extended argument annotations when available. @@ -55,9 +55,9 @@ def annotate_args(annotations: List[Optional[ArgAnnotation]]): The `annotations` should be a list of the same length as the number of argument to the method (including `self`). Each list entry is either: - None, corresponding to providing the compiler with no information. - - A 2-tuple consisting of a shape and a dtype, such as - `([2, 3, 4], torch.float32)`. A dimension with an unknown size can be - indicated by using `-1` as the size. This provides the compiler a + - A 3-tuple consisting of a shape, a dtype and a flag about value semantics, + such as `([2, 3, 4], torch.float32, True)`. A dimension with an unknown size + can be indicated by using `-1` as the size. This provides the compiler a guarantee that the argument will always dynamically have the described shape and dtype. """ From 186d91251976cd91947565e11633ba0a60099da6 Mon Sep 17 00:00:00 2001 From: Yuanqiang Liu Date: Fri, 26 Apr 2024 23:45:32 +0800 Subject: [PATCH 2/2] update --- projects/pt1/python/torch_mlir_e2e_test/annotations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/pt1/python/torch_mlir_e2e_test/annotations.py b/projects/pt1/python/torch_mlir_e2e_test/annotations.py index 0e0a97e6649a..e34b0f85d5e5 100644 --- a/projects/pt1/python/torch_mlir_e2e_test/annotations.py +++ b/projects/pt1/python/torch_mlir_e2e_test/annotations.py @@ -55,7 +55,7 @@ def annotate_args(annotations: List[Optional[ArgAnnotation]]): The `annotations` should be a list of the same length as the number of argument to the method (including `self`). Each list entry is either: - None, corresponding to providing the compiler with no information. - - A 3-tuple consisting of a shape, a dtype and a flag about value semantics, + - A 3-tuple consisting of a shape, a dtype and a flag of value semantics, such as `([2, 3, 4], torch.float32, True)`. A dimension with an unknown size can be indicated by using `-1` as the size. This provides the compiler a guarantee that the argument will always dynamically have the described