ORNL / ORNL/cpp-proposals-pub

is_strided in layout_stride::mapping fails with extent 1 along a rank

Open
#92 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
29
Forks
26
PR merge metrics
No merged PRs in 30d

Description

Replicating layout_right as in test_layouts.cpp with layout_strided by setting
(extents 5,4,3,2,1, strides 24,6,2,1,1) is expected to generate a contiguous layout.

However, is_strided returns erroneously "false".

The issue arises because the sorting of strides with a permutation vector is now ambiguous at
https://github.com/ORNL/cpp-proposals-pub/blob/f8bf21b653d2424d40b9411ee532641f8c1c2e28/P0009/reference-implementation/include/experimental/bits/layouts.hpp#L272

In the following

https://github.com/ORNL/cpp-proposals-pub/blob/f8bf21b653d2424d40b9411ee532641f8c1c2e28/P0009/reference-implementation/include/experimental/bits/layouts.hpp#L285

This leads to the return of "false" because the wrong extent is used for comparison.

This only arises if one extent is 1, because only then, two strides would be the same.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with test_layouts.cpp and the layout_strided implementation in include/experimental/bits/layouts.hpp, especially the stride sorting around lines 272 and 285. Reproduce the extents and strides from the issue, then verify that is_strided reports the layout as contiguous when an extent is 1. Done means the regression case passes without changing behavior for other layouts.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.