Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choose dimensions or sizes + strides for user-facing operations #1922

Open
hunhoffe opened this issue Nov 15, 2024 · 1 comment
Open

Choose dimensions or sizes + strides for user-facing operations #1922

hunhoffe opened this issue Nov 15, 2024 · 1 comment

Comments

@hunhoffe
Copy link
Collaborator

Right now, some operations take dimensions and some operations take sizes and strides.

For clarity, but also some implementation considerations, I think it would make sense to change to sizes/strides.

Some pros for moving to sizes/strides are:

  • dimensions requires (at least at the python level) both sizes/strides to be default or both not default. It would be nice for a user to take advantage of default values more easily. If a python wrapper function takes these values separately, then python needs to have hard-coded defaults in order to produced valid dimensions, which is not ideal.
  • For dma_bds using the task/chain syntax, each dma_db should have at max 3 sizes and at max 4 strides; this is a condition that is not easy to express clearly when using dimensions
  • Personally, I find it easier to read when they are specified separately (but maybe that's just me)

This came to my attention through comments of @fifield and @andrej in #1919

As this would be a change that touches many things, I'm recording outside of the PR for discussion and so it does not become a blocker to that PR.

@andrej
Copy link
Collaborator

andrej commented Nov 15, 2024

For dma_bds using the task/chain syntax, each dma_db should have at max 3 sizes and at max 4 strides; this is a condition that is not easy to express clearly when using dimensions

Why only max 3 sizes but 4 strides?

Copying my examples from the review of #1919 on why repeat_count and the higest-dimension size/wrap aren't the same:

Examples These examples assume a highest-dimension stride of 2.

If the highest-dimension size/wrap is 3, the higest-dimension stride (=iteration step) is 2, and the repeat count is 6, the highest dimension offset added will be

Task repetition:             0   1   2   3   4   5  (repeat count = 6)
Highest-dim offset added:    0   2   4   0   2   4
                                         ^
                                      wrap (=3)

If the highest-dimension wrap matches the repeat count of the task, the iteration step will be added each repetition:

Task repetition:             0   1   2   3   4   5  (repeat count = 6)
Highest-dim offset added:    0   2   4   6   8   10 
                                                     ^
                                                 wrap (=6)

In the other extreme, if the wrap is 1, the iteration step never gets added (BD repeated with no offset).

Task repetition:             0   1   2   3   4   5  (repeat count = 6)
Highest-dim offset added:    0   0   0   0   0   0
                             ^   ^   ^   ^   ^   ^
                             w.  w.  w.  w.  w.  wrap(=1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants