Grid stridedness definition

Issue #6 resolved
Dan Bonachea created an issue

"The logical stride of a grid is the stride of its domain or index set, and the physical stride of a grid is the spacing between each of its elements in physical storage. ... unstrided specifies that the logical and physical strides of a grid must match. That is, if the logical stride in dimension i is si, then the physical stride in that dimension must also be si."

This is a very ambiguous definition for striding. I believe I understand the intent, but the definition needs to be clarified and formalized.

A few observations:

  • The initial definition of stride should probably be defined with reference to a given dimension. The unstrided property of a grid is then a boolean conjunction over all its dimensions.

  • The units of logical stride are positive integers (difference between two point<> components), whereas the units of physical stride seems to be bytes (a spacing in physical storage). These quantities cannot be directly compared (without a sizeof(T) conversion).

  • Even ignoring this issue, the definition as currently worded doesn't seem to work for multi-dimensional unstrided grids. Say we have: ndarray<int, 2, unstrided> A(RD(PT(1, 1), PT(6, 6))); The logical stride in the major dimension is 1, but the physical stride (spacing between each of its elements in physical storage) in that dimension is 6*sizeof(int).

Comments (6)

  1. Cy Chan

    Dan, I think you mean boolean disjunction? I agree with Dan that the units of the physical stride should be in bytes. The units of physical stride could conceivably be in "sizeof(T)-byte chunks", but since it's referring to memory layout, bytes feels more natural to me.

  2. Amir Kamil

    That's a good point. The definition was written in the context of the implementation, which keeps track of two strides per dimension, but since that's not transparent to the user, it's not really a useful definition.

    I'll have to think some more about how to fix this. Any suggestions?

  3. Log in to comment