spcl / dace

DaCe - Data Centric Parallel Programming
http://dace.is/fast
BSD 3-Clause "New" or "Revised" License
497 stars 129 forks source link

Python frontend: Better support for scalar-ranges and dynamic ranges #650

Open tbennun opened 3 years ago

tbennun commented 3 years ago

The Python frontend has trouble dealing with dynamic map inputs.

@dace.program
def test(A: dace.float64[20], B: dace.float64[20]):
    N = dace.define_local_scalar(dace.int32)
    N = 5
    for i in dace.map[0:N]:
        for j in dace.map[0:N]:
            with dace.tasklet:
                a << A[i]
                b >> B[j]
                b = a + 1
@dace.program
def test(A: dace.float64[20], B: dace.float64[20], N: dace.int32):
    for i, j in dace.map[0:N, 0:N]:
            with dace.tasklet:
                a << A[i]
                b >> B[j]
                b = a + 1
@dace.program
def test(A: dace.float64[20], N: dace.int32):
    A[0:N] = 5
alexnick83 commented 3 years ago

It seems that we have competing designs for handling data-dependent symbols (I am not sure what would be a proper term):

I think that the newer design ultimately makes more sense and is easier to generalize. We should consider re-designing dynamic map inputs and indirection based on the concept of scalar promotion. I will look into making a proposal to discuss.