Skip to content

Commit

Permalink
Adjust offsets in Array2Loop only when it has offset different than d…
Browse files Browse the repository at this point in the history
…efault's 1
  • Loading branch information
mcopik committed Sep 8, 2023
1 parent 2436051 commit ec77693
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions dace/frontend/fortran/ast_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,12 +771,11 @@ def add_offset(original, offset: int):
if i.type == "ALL":

lower_boundary = None
if offsets[idx] != 0:
if offsets[idx] != 1:
lower_boundary = ast_internal_classes.Int_Literal_Node(value=str(offsets[idx]))
else:
lower_boundary = ast_internal_classes.Int_Literal_Node(value="1"),
lower_boundary = ast_internal_classes.Int_Literal_Node(value="1")

upper_boundary = None
upper_boundary = ast_internal_classes.Name_Range_Node(name="f2dace_MAX",
type="INTEGER",
arrname=node.name,
Expand All @@ -785,7 +784,7 @@ def add_offset(original, offset: int):
When there's an offset, we add MAX_RANGE + offset.
But since the generated loop has `<=` condition, we need to subtract 1.
"""
if offsets[idx] != 0:
if offsets[idx] != 1:
upper_boundary = ast_internal_classes.BinOp_Node(
lval=upper_boundary,
op="+",
Expand Down

0 comments on commit ec77693

Please sign in to comment.