Define submdspan_mapping for layout_transpose
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 29
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
Define submdspan_mapping for layout_transpose
Problem
transposed of a custom layout CustomLayout (currently, a layout that is not layout_left, layout_right, or layout_stride) results in layout_transpose<CustomLayout>. layout_transpose<CustomLayout> does not define submdspan_mapping. As a result, users won't be able to take submdspan of the result of transposed for their custom mapping, even if it would make sense to do so.
Relevance
- Users may want to treat
transposedas a general facility in their own algorithms. - P1673 implementers may find it useful to implement some algorithms generically. For example, it should be possible to write a "cache-oblivious" recursive version of
matrix_productfor custom layouts, as long as they are unique layouts. However, users would find it surprising for (say) thetransposed(A)case to fall back to a slower implementation, just becausesubmdspandoesn't work ontransposed(A).
Suggested fix
Add submdspan_mapping overload for A with layout_transpose<CustomLayout>, constrained on submdspan_mapping(mdspan{A.data_handle(), A.mapping().nested_mapping(), A.accessor()) being well-formed. Define the overload so that submdspan_mapping(transposed(A), slice_r, slice_c) is submdspan_mapping(A, slice_c, slice_r).
We don't need to account for numbers of slice specifiers other than 2, because layout_transpose currently requires rank() == 2. LWG didn't so much like P1673 to have the analogous "generality hooks" left behind for later adoption of the batched proposal.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the definitions of layout_transpose, transposed, and existing submdspan_mapping overloads. Review how the nested mapping and slice arguments are handled, then verify that the requested custom-layout case is constrained appropriately and that transposed slices use the reversed slice order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100