You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a Descend array is multi-dimensional, indexing into it will be generated as multiple index operations (multi-dimensional indexing), although the array is only represented as a pointer.
Descend:
array:[[ i32; n]; m]
array[i][j]
CUDA:
int *array;
array[i][j]
The above example shows wrong indexing.
This may sometimes be correct, because a multi-dimensional array is initially generated as a multi-dimensional C-array
array: descend::array<descend::array<int, n>, m>
But this is changed when creating a reference to the array:
&array : * int
Therefore, find a consistent way to represent arrays and generate correct indexing accordingly.
The solution of how we represent arrays and indexing, influences issue #15.
The text was updated successfully, but these errors were encountered:
This problem arises when multidimensional arrays are declared and indexed.
During codegen we see two indices and put them on the indexing path/stack. There are two cases that arise now:
In case the indices used for an array whose multi-dimensionality stems from views, such as group, the indices are correctly adjusted to reflect the length of the inner dimension.
If the multi-dimensionality stems from a multi-dimensional declaration, the indices are not adjusted and we would have to look at the type of the array to determine the width of the inner dimension (which possibly contains even more dimensions).
When generating indices, it is not immediately clear which of the two above cases is relevant.
When a Descend array is multi-dimensional, indexing into it will be generated as multiple index operations (multi-dimensional indexing), although the array is only represented as a pointer.
Descend:
CUDA:
int *array; array[i][j]
The above example shows wrong indexing.
This may sometimes be correct, because a multi-dimensional array is initially generated as a multi-dimensional C-array
array: descend::array<descend::array<int, n>, m>
But this is changed when creating a reference to the array:
&array : * int
Therefore, find a consistent way to represent arrays and generate correct indexing accordingly.
The solution of how we represent arrays and indexing, influences issue #15.
The text was updated successfully, but these errors were encountered: