Example #1
0
 def visit_FieldDecl(self, node: gtir.FieldDecl) -> oir.FieldDecl:
     return oir.FieldDecl(
         name=node.name,
         dtype=node.dtype,
         dimensions=node.dimensions,
         data_dims=node.data_dims,
         loc=node.loc,
     )
Example #2
0
def sdfg_arrays_to_oir_decls(
        sdfg: dace.SDFG) -> Tuple[List[oir.Decl], List[oir.Temporary]]:
    params = list()
    decls = list()

    array: dace.data.Data
    for name, array in sdfg.arrays.items():
        dtype = common.typestr_to_data_type(dace_dtype_to_typestr(array.dtype))
        if isinstance(array, dace.data.Array):
            dimensions = array_dimensions(array)
            if not array.transient:
                params.append(
                    oir.FieldDecl(
                        name=name,
                        dtype=dtype,
                        dimensions=dimensions,
                        data_dims=array.shape[sum(dimensions):],
                    ))
            else:
                decls.append(
                    oir.Temporary(
                        name=name,
                        dtype=dtype,
                        dimensions=dimensions,
                        data_dims=array.shape[sum(dimensions):],
                    ))
        else:
            assert isinstance(array, dace.data.Scalar)
            params.append(oir.ScalarDecl(name=name, dtype=dtype))

    reserved_symbols = internal_symbols(sdfg)
    for sym, stype in sdfg.symbols.items():
        if sym not in reserved_symbols:
            params.append(
                oir.ScalarDecl(name=sym,
                               dtype=common.typestr_to_data_type(
                                   stype.as_numpy_dtype().str)))
    return params, decls
Example #3
0
 def visit_FieldDecl(self, node: gtir.FieldDecl, **kwargs: Any) -> oir.FieldDecl:
     return oir.FieldDecl(
         name=node.name, dtype=node.dtype, dimensions=node.dimensions, data_dims=node.data_dims
     )
Example #4
0
 def visit_FieldDecl(self, node: gtir.FieldDecl,
                     **kwargs: Any) -> oir.FieldDecl:
     return oir.FieldDecl(name=node.name, dtype=node.dtype)