kokkos / kokkos/mdspan

Comparison typo in index_sequence_scan_impl::get

Open
#452 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
507
Forks
87
Avg merge
15h 27m
Merged PRs (30d)
2

Description

Dear Kokkos developers,

I believe I've found a mistake in the template specialization index_sequence_scan_impl<R, FirstVal> within include/experimental/__p0009_bits/extents.hpp.

In the get member function (lines 162 and 166), the current comparison logic seems wrong and inconsistent with the implementation on line 147.

  • Current: Uses r < R or after the static_cast<int64_t> of each variable
  • Expected: I believe the correct comparison should be R < r.

This can be check by

// currently: FirstVal = 8, the cummulative sum before element r = 2 (which is past FirstVal) should be 8
constexpr size_t r = 2;
static_assert((detail::index_sequence_scan_impl<0, 8>::get(r) == 8)); // Fails

Could you please take a look to see if this is indeed a bug or if I am misinterpreting the intended logic?

Best regards,

Elfego

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 in include/experimental/__p0009_bits/extents.hpp at the index_sequence_scan_impl<R, FirstVal>::get member function and compare the logic on lines 162 and 166 with line 147. Reproduce the provided constexpr static_assert, then verify the comparison behavior for the stated values. Done means the expected result is produced and regression coverage passes.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.