Bad dependency resolution in nested map
luigifusco opened this issue · comments
The simple program
@dace.program
def bug(mat: dace.int32[N,N]):
buff = np.zeros_like(mat)
for i in dace.map[0:N]:
for j in dace.map[0:N]:
buff[i, j] = mat[i, j] * 2
for j in dace.map[0:N-1]:
mat[i, j] = buff[i, j]
will result in the following wrong simplified sdfg:
where the assign tasklet is a simple assignment operator, copying buff to mat
The issue does not happen if the two ranges of the internal maps (the ones with variable j) iterate over the same range. In the unsimplified nested sdfg representing the scope of the outer map (variable i) both buff and mat have two different names -> the state fusion fails to detect the data dependency, and ultimately one of the two maps is discarded.