spcl / spcl/dace

Scalars in shape definition

Open
#1,147 1 comment 0 reactions 0 assignees View on GitHub
bug frontend
Dominant language
Python
Stars
593
Forks
163
Avg merge
2d 23h
Merged PRs (30d)
60

Description

**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:

```Python
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.