Skip to content
Snippets Groups Projects
Commit 45e9c3e7 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Allow names, exprs, and lp.auto for array offsets

parent 255ad96e
No related branches found
No related tags found
No related merge requests found
...@@ -1036,7 +1036,9 @@ class ArrayBase(ImmutableRecord): ...@@ -1036,7 +1036,9 @@ class ArrayBase(ImmutableRecord):
is_written=is_written) is_written=is_written)
if self.offset: import loopy as lp
if self.offset is lp.auto:
offset_name = full_name+"_offset" offset_name = full_name+"_offset"
yield ImplementedDataInfo( yield ImplementedDataInfo(
target=target, target=target,
...@@ -1202,12 +1204,17 @@ def get_access_info(target, ary, index, eval_expr, vectorization_info): ...@@ -1202,12 +1204,17 @@ def get_access_info(target, ary, index, eval_expr, vectorization_info):
return result return result
def apply_offset(sub): def apply_offset(sub):
import loopy as lp
if ary.offset: if ary.offset:
offset_name = ary.offset if ary.offset is lp.auto:
if offset_name is lp.auto:
offset_name = array_name+"_offset" offset_name = array_name+"_offset"
elif isinstance(ary.offset, str):
return var(offset_name) + sub offset_name = ary.offset
return var(offset_name) + sub
else:
# assume it's an expression
return ary.offset + sub
else: else:
return sub return sub
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment