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

RangePolicy construction fails if input bound types are not convertible to the policy's IndexType #7005

Open
ldh4 opened this issue May 9, 2024 · 0 comments
Assignees
Labels
Kokkos-Core Question For Kokkos internal and external contributors and users

Comments

@ldh4
Copy link
Contributor

ldh4 commented May 9, 2024

Reported from ECP-copa/Cabana#753 (comment).
 
Changes made in #6754 expects RangePolicy's input bound types to be convertible to the RangePolicy's IndexType.

However, the conversion safety check in RangePolicy actually requires a full roundtrip convertibility:

// check narrowing
warn |= (static_cast<IndexType>(static_cast<member_type>(bound)) != bound);

and fails if only one way conversion is available.

Few options to mitigate this include:

  • Adding constraints to the RangePolicy constructors (more conditions in enable_if)
  • Making roundtrip convertibility a mandate (with a static_assert)
  • Skipping the value preserving/narrowing check if only convertible one way (output a warning message about skipping the check)
@ldh4 ldh4 self-assigned this May 9, 2024
@ajpowelsnl ajpowelsnl added Kokkos-Core Question For Kokkos internal and external contributors and users labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kokkos-Core Question For Kokkos internal and external contributors and users
Projects
None yet
Development

No branches or pull requests

2 participants