From 1d8a693ef9a76af21b53e3a97c18cbf66b7ad92b Mon Sep 17 00:00:00 2001 From: Christos Kotsalos Date: Wed, 30 Oct 2024 06:31:02 +0100 Subject: [PATCH] infer_symbols_from_datadescriptor : modification to infer offset (#1525) Small modification to infer offset on top of shape and strides from the data descriptor (needed in gt4py) --- dace/frontend/python/parser.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dace/frontend/python/parser.py b/dace/frontend/python/parser.py index d99be1265d..d03759fa8e 100644 --- a/dace/frontend/python/parser.py +++ b/dace/frontend/python/parser.py @@ -92,14 +92,15 @@ def infer_symbols_from_datadescriptor(sdfg: SDFG, desc = sdfg.arrays[arg_name] if not hasattr(desc, 'shape') or not hasattr(arg_val, 'shape'): continue - symbolic_values = list(desc.shape) + list(getattr(desc, 'strides', [])) + symbolic_values = list(desc.shape) + list(getattr(desc, 'strides', [])) + list(getattr(desc, 'offset', [])) given_values = list(arg_val.shape) given_strides = [] if hasattr(arg_val, 'strides'): # NumPy arrays use bytes in strides factor = getattr(arg_val, 'itemsize', 1) given_strides = [s // factor for s in arg_val.strides] - given_values += given_strides + given_offset = [o for o in arg_val.offset] if hasattr(arg_val, 'offset') else [] + given_values += given_strides + given_offset for sym_dim, real_dim in zip(symbolic_values, given_values): repldict = {}