From ee8a70857d5e9f294272bd8a17881486a8d42d88 Mon Sep 17 00:00:00 2001 From: Yakup Budanaz Date: Fri, 6 Dec 2024 15:24:44 +0100 Subject: [PATCH] Various fixes --- dace/codegen/targets/framecode.py | 1 + dace/sdfg/sdfg.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dace/codegen/targets/framecode.py b/dace/codegen/targets/framecode.py index ad4fc524d4..b74867a5f8 100644 --- a/dace/codegen/targets/framecode.py +++ b/dace/codegen/targets/framecode.py @@ -971,6 +971,7 @@ def generate_code(self, array = [v for v in sdfg.arrays.values() if v.size_desc_name is not None and v.size_desc_name == size_desc_name] assert (len(array) == 1) array = array[0] + print("AA", array, array.shape, sdfg.arrays) size_str = ",".join(["0" if cpp.sym2cpp(dim).startswith("__dace_defer") else cpp.sym2cpp(dim) for dim in array.shape]) alloc_str = f'{ctypedef} {size_desc_name}[{size_nodedesc.shape[0]}]{{{size_str}}};\n' callsite_stream.write(alloc_str) diff --git a/dace/sdfg/sdfg.py b/dace/sdfg/sdfg.py index 0015e56458..febc4a2885 100644 --- a/dace/sdfg/sdfg.py +++ b/dace/sdfg/sdfg.py @@ -779,13 +779,13 @@ def replace_dict(self, arr = self.arrays[arr_name] if arr_name in self.arrays else None if arr is not None: size_desc_name_before = arr.size_desc_name - if arr.transient and isinstance(arr, dt.Array): + if arr.transient and type(arr) == dt.Array: arr.size_desc_name = size_desc_name if "__return" not in new_name else None else: arr.size_desc_name = None if arr.size_desc_name is None and size_desc_name_before is not None: size_ararys_to_rm.add(size_desc_name_before) - for size_arr_name in size_ararys_to_rm: + for size_arr_name in size_ararys_to_rm and size_arr_name in self.arrays: del self.arrays[size_arr_name] # Replace inside data descriptors @@ -2109,7 +2109,7 @@ def add_datadesc(self, name: str, datadesc: dt.Data, find_new_name=False) -> str self._add_symbols(datadesc) if ( datadesc.transient is True and - isinstance(datadesc, dt.Array) and + type(datadesc) == dt.Array and "__return" not in name and datadesc.lifetime is not dtypes.AllocationLifetime.External and datadesc.lifetime is not dtypes.AllocationLifetime.Persistent