kokkos-kernels: constexpr declaration of OrdinalTraits::invalid() #11079
Labels
MARKED_FOR_CLOSURE
Issue or PR is marked for auto-closure by the GitHub Actions bot.
pkg: KokkosKernels
type: enhancement
Issue is an enhancement, not a bug
Enhancement
@trilinos/kokkos-kernels
What feature/addition is needed? How does this differ from what we currently have?
Templated on the ordinal type, the traits class
KokkosSparse::OrdinalTraits
provides a member functioninvalid()
that allows to retrieve a specific value of this ordinal type that is considered "invalid". This invalid value is used in various ways in kokkos-kernels, tpetra, and other packages, e.g. in map objects as a return value when the ordinal is not included in the map. In kokkos-kernels, this member function is currently declaredstatic KOKKOS_INLINE_FUNCTION
.If this "invalid" value is used multiple times throughout a code, it can be convenient to store it in a constant variable at namespace scope. However, if the "invalid" value is used in device code, storing it in a constant variable at namespace scope is subject to some restrictions, as described for the cuda case in Sec. I.4.13 "Const-qualiffied variables" in the cuda manual (https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html). In particular, this reference suggest that cuda wants such a constant variable at namespace scope to be initialised by a constant expression.
In this context, this feature request is whether you would be open to declare the member function
invalid()
as astatic constexpr KOKKOS_INLINE_FUNCTION
. If you should be open to do this, I can submit a PR.Many thanks in advance for considering this small feature request!
The text was updated successfully, but these errors were encountered: