DaCe comes with a syntax which enables user to define a Map What’s under the Map is the tasklet users defined for computation. As the computation, we can do scalar operations such as integer addition.
However, if we do tensor(matrix) operation inside that tasklet, for example, A@B or A+B, where A and B are two matrices, DaCe will give us an error.
Here is the concrete code snippet which raises the error. You can try and run this example.
@dace.program
def fusion(A: dace.float32[10, 20], B: dace.float32[10, 20],
out: dace.float32[1]):
tmp = dace.define_local([10, 20], dtype=A.dtype)
tmp_2 = dace.define_local([10, 20], dtype=A.dtype)
for i, j in dace.map[0:10, 0:20]:
with dace.tasklet:
a << (A+A)[i, j]
b >> tmp[i, j]
b = a * a
Look at line #16, where there is a matrix addition A+A. I believe this is the cause of the error.
Therefore, I would like to know, is tensor operation allowed in such situation? If it is allowed, can I know the right syntax to write this? If not, I would like to know why this is not supported?