Skip to content

Scalars in shape definition #1147

@TizianoDeMatteis

Description

@TizianoDeMatteis

Describe the bug

If a container shape is defined by using scalars, the produced SDFG will not generate proper code

To Reproduce

Consider the following example:

import dace
import numpy as np

A, B, C, D, E = (dace.symbol(s, dace.int32) for s in ('A', 'B', 'C', 'D', 'E'))


@dace.program
def init_array():
    output_height = ((A - C) + 1)
    output_width = ((B - D) + 1)
    # This does not work
    container = np.zeros((A * B, output_height * output_width * E))
    # This works
    # container = np.zeros((A * B, ((A - C) + 1) * ((B - D) + 1) * E))
    return container


A = 32
B = 32
C = 4
D = 4
E = 2
sdfg = init_array.to_sdfg()
container = sdfg(A=A, B=B, C=C, D=D, E=E)

In the generated SDFG, the variable __tmp3 is not defined anywhere.
The definition that just uses symbols works.

Expected behavior
Functional generated code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfrontend

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions