kokkos / kokkos/mdspan

mdspan: Add optional bounds checking

Open
#181 1 comment 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

Both default_accessor and layout_{left, right, stride}::mapping::operator() have in-bounds access as a precondition. This permits implementations to add bounds checking, using whatever mechanism they like (as precondition violations are undefined behavior).

  • Add a configure-time option to turn on bounds checking.
  • Use macros to protect bounds checking and error reporting code, including header file includes like <iostream>. (The test and branch have a nonzero run-time cost. Also, code for printing error messages can costs compilation time and possibly also performance (e.g., extra registers in device code).)
  • Add a test that only runs if bounds checking is turned on. Consider adding a build for that case.

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 by tracing default_accessor and layout_{left, right, stride}::mapping::operator() to understand their in-bounds preconditions. Define the configure-time switch and macro boundaries, including error-reporting includes, then add a test that runs only when bounds checking is enabled. Done means the option, guarded checks, and conditional test are integrated into the build.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.