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

Aligned ISO/C++ standardization proposal #5

Open
hcedwar opened this issue Jun 22, 2018 · 4 comments
Open

Aligned ISO/C++ standardization proposal #5

hcedwar opened this issue Jun 22, 2018 · 4 comments

Comments

@hcedwar
Copy link

hcedwar commented Jun 22, 2018

There is an ISO/C++ standard proposal in progress which is well-aligned with this effort.
https://github.com/ORNL/cpp-proposals-pub/tree/master/P0009

@devinamatthews
Copy link
Collaborator

Thanks for the link, looks like a huge step forward for C++ tensor interfaces. One question: I couldn't find the justification for the wording in the table in mdspan.layout.reqs: "Returns: one plus the maximum value of m(i...)." which goes along with "Requires: 0 <= m(i...)" just above.

  1. This seems to require positive strides in all cases.
  2. Even then, it also tacitly assumes that m(i...) == 0 for some i....

@evaleev evaleev mentioned this issue Jun 24, 2018
36 tasks
@evaleev
Copy link
Collaborator

evaleev commented Jun 25, 2018

@devinamatthews my reading is that layout maps index pack (or multi-index) to the (scalar) position/address in the underlying (1-d) span. No assumption is made about the mapping method, it does not need to be stride-based at all (e.g. addressing a lower triangle of a matrix). There is no need to assume that all element in span are in the domain of layout, some may not be addressable. So I do not see where m(i...) == 0 is assumed.

@devinamatthews
Copy link
Collaborator

The phrasing for m.required_span_size() that I quoted above is the problem. If this is to be the exact number of elements in the required span then the m(i...) == 0 assumption kicks in. I suppose it could be taken as an upper bound, though. If one had a strided layout with negative strides then m(i...) < 0 would be possible and the required_span_size() calculation would be too small.

My preferred wording for that concept is something like "The difference between the maximum and minimum values of m(i...), plus one."

@evaleev
Copy link
Collaborator

evaleev commented Jun 25, 2018 via email

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

3 participants