diff --git a/dace/codegen/targets/cuda.py b/dace/codegen/targets/cuda.py index 8bc51d0418..8c0e7800a4 100644 --- a/dace/codegen/targets/cuda.py +++ b/dace/codegen/targets/cuda.py @@ -1502,8 +1502,8 @@ def generate_scope(self, sdfg: SDFG, cfg: ControlFlowRegion, dfg_scope: StateSub const_params = _get_const_params(dfg_scope) # make dynamic map inputs constant # TODO move this into _get_const_params(dfg_scope) - # Do not add src as const if the size is being red (src_conn is _read_size) - const_params |= set((str(e.src)) for e in dace.sdfg.dynamic_map_inputs(state, scope_entry) if e.src_conn is None or (e.src_conn is not None and e.src_conn == "_read_size")) + # Do not add src as const if the size is being read (src_conn is _read_size) + const_params |= set((str(e.src)) for e in dace.sdfg.dynamic_map_inputs(state, scope_entry) if e.src_conn is None or not (e.src_conn is not None and e.src_conn == "_read_size")) # Store init/exit code streams old_entry_stream = self.scope_entry_stream diff --git a/dace/codegen/targets/framecode.py b/dace/codegen/targets/framecode.py index 416bbe6ed5..baf215d903 100644 --- a/dace/codegen/targets/framecode.py +++ b/dace/codegen/targets/framecode.py @@ -964,7 +964,6 @@ def generate_code(self, # Only allocate arrays that really require deferred allocation (symbol has __dace_defer) # Reshaping these arrays are not allowed size_arrays = sdfg.size_arrays() - callsite_stream.write(f'//Declare size arrays\n', sdfg) for size_desc_name in size_arrays: size_nodedesc = sdfg.arrays[size_desc_name] assert ("__return" not in size_desc_name) @@ -979,7 +978,7 @@ def generate_code(self, assert len(size_nodedesc.shape) == 1 alloc_str = f'{ctypedef} {size_desc_name}[{size_nodedesc.shape[0]}]{{{size_str}}};\n' callsite_stream.write(alloc_str) - self.dispatcher.defined_vars.add(size_desc_name, disp.DefinedType.Pointer, ctypedef) + self.dispatcher.defined_vars.add(size_desc_name, disp.DefinedType.Pointer, ctypedef, allow_shadowing=True) ####################################################################### # Generate actual program body