-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[InlineTrans] TypeError: The stop value of a Range must be a sub-class of Node but got: Extent (similar to #2776) #2735
Labels
Comments
A patch to solve this issue: >> cat 0001-InlineTrans-Fix-2735.patch
From b3c54743fe930787bef936f6b0564ff1b4d4e9de Mon Sep 17 00:00:00 2001
From: Hugo Brunie <hugo.brunie@univ-grenoble-alpes.fr>
Date: Thu, 3 Oct 2024 17:34:48 +0200
Subject: [PATCH] [InlineTrans] Fix 2735
---
.gitignore | 2 ++
.../psyir/transformations/inline_trans.py | 18 ++++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index a5562a65a..af820da8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,5 @@ src/*.egg-info
.idea
.rtx.toml
.venv
+venv
+.vscode
\ No newline at end of file
diff --git a/src/psyclone/psyir/transformations/inline_trans.py b/src/psyclone/psyir/transformations/inline_trans.py
index 1b8c8927f..a3941ce20 100644
--- a/src/psyclone/psyir/transformations/inline_trans.py
+++ b/src/psyclone/psyir/transformations/inline_trans.py
@@ -466,8 +466,22 @@ class InlineTrans(Transformation):
# less than that supplied. In general we're not going to know
# that so we have to be conservative.
if local_shape:
- new = Range.create(local_shape.lower.copy(),
- local_shape.upper.copy())
+ symbol = local_ref.symbol
+ if isinstance(local_shape.upper, Reference):
+ upper_bound =local_shape.upper.copy()
+ else:
+ upper_bound = IntrinsicCall.create(
+ IntrinsicCall.Intrinsic.UBOUND,
+ [Reference(symbol), ("dim", Literal(str(local_idx_posn+1), INTEGER_TYPE))])
+ if isinstance(local_shape.lower, Reference):
+ lower_bound =local_shape.lower.copy()
+ else:
+ lower_bound = IntrinsicCall.create(
+ IntrinsicCall.Intrinsic.LBOUND,
+ [Reference(symbol), ("dim", Literal(str(local_idx_posn+1), INTEGER_TYPE))])
+
+ new = Range.create(lower_bound,
+ upper_bound)
new_indices[pos] = self._create_inlined_idx(
call_node, formal_args,
new, local_decln_start, actual_start)
--
2.34.1 |
With the last version of psyclone, commit The error is now: ../../psyclone/psyclone/src/psyclone/psyir/transformations/inline_trans.py:185: in apply
self._replace_formal_arg(ref, node, formal_args)
../../psyclone/psyclone/src/psyclone/psyir/transformations/inline_trans.py:300: in _replace_formal_arg
new_ref = self._replace_formal_struc_arg(actual_arg, ref, call_node,
../../psyclone/psyclone/src/psyclone/psyir/transformations/inline_trans.py:523: in _replace_formal_struc_arg
new_indices = self._update_actual_indices(
../../psyclone/psyclone/src/psyclone/psyir/transformations/inline_trans.py:444: in _update_actual_indices
new = Range.create(local_shape.lower.copy(),
../../psyclone/psyclone/src/psyclone/psyir/nodes/ranges.py:130: in create
erange.stop = stop
../../psyclone/psyclone/src/psyclone/psyir/nodes/ranges.py:222: in stop
self._check_valid_input(value, "stop")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value = <Extent.ATTRIBUTE: 2>, name = 'stop'
@staticmethod
def _check_valid_input(value, name):
'''
Perform checks that the supplied value is valid as a child of a
Range node.
:param object value: entity to check.
:param str name: the name of the quantity for which this value has \
been supplied.
:raises TypeError: if the supplied value is not a sub-class of Node.
:raises TypeError: if the supplied value is a Literal but is not of \
INTEGER type.
'''
if not isinstance(value, Node):
> raise TypeError(
f"The {name} value of a Range must be a sub-class of "
f"Node but got: {type(value).__name__}")
E TypeError: The stop value of a Range must be a sub-class of Node but got: Extent
../../psyclone/psyclone/src/psyclone/psyir/nodes/ranges.py:153: TypeError |
hbrunie
changed the title
Exception has occurred: AttributeError 'Extent' object has no attribute 'copy'
[Ref2ArrayTrans] TypeError: The stop value of a Range must be a sub-class of Node but got: Extent
Oct 7, 2024
hbrunie
changed the title
[Ref2ArrayTrans] TypeError: The stop value of a Range must be a sub-class of Node but got: Extent
[InlineTrans] TypeError: The stop value of a Range must be a sub-class of Node but got: Extent
Oct 7, 2024
hbrunie
changed the title
[InlineTrans] TypeError: The stop value of a Range must be a sub-class of Node but got: Extent
[InlineTrans] TypeError: The stop value of a Range must be a sub-class of Node but got: Extent (similar to #2776)
Oct 7, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Executing this code snippet:
I got an error during the Inline transformation
It looks like the InlineTransformation tries to copy a bound that is not possible to copy (Enum).
The inlined code should look like
The text was updated successfully, but these errors were encountered: