Skip to content

Commit

Permalink
Add correct typecast
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrudPrimrose committed Nov 9, 2024
1 parent adbffd8 commit df8e891
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dace/codegen/targets/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def allocate_array(self, sdfg: SDFG, cfg: ControlFlowRegion, dfg: StateSubgraphV
if not declared:
declaration_stream.write(f'{nodedesc.dtype.ctype} *{name};\n', cfg, state_id, node)
allocation_stream.write(
"%s = std::aligned_alloc(64, %s * sizeof(%s));\n" % (alloc_name, cpp.sym2cpp(arrsize), nodedesc.dtype.ctype), cfg,
"%s = static_cast<{nodedesc.dtype.ctype}*>(std::aligned_alloc(64, %s * sizeof(%s)));\n" % (alloc_name, cpp.sym2cpp(arrsize), nodedesc.dtype.ctype), cfg,
state_id, node)
define_var(name, DefinedType.Pointer, ctypedef)

Expand Down Expand Up @@ -544,7 +544,7 @@ def allocate_array(self, sdfg: SDFG, cfg: ControlFlowRegion, dfg: StateSubgraphV
"""
#pragma omp parallel
{{
{name} = ({ctype}*)std::aligned_alloc(64, {arrsize} * sizeof({ctype}));""".format(ctype=nodedesc.dtype.ctype,
{name} = static_cast<{ctype}*>(std::aligned_alloc(64, {arrsize} * sizeof({ctype})));""".format(ctype=nodedesc.dtype.ctype,
name=alloc_name,
arrsize=cpp.sym2cpp(arrsize)),
cfg,
Expand Down

0 comments on commit df8e891

Please sign in to comment.