docs(View): Add missing public type aliases to Kokkos::View API reference#907
Conversation
Co-authored-by: crtrott <9490481+crtrott@users.noreply.github.com>
Co-authored-by: Christian Trott <crtrott@sandia.gov>
Co-authored-by: Christian Trott <crtrott@sandia.gov>
| May be :cpp:`const`-qualified (e.g., :cpp:`const double`) for read-only views. | ||
| Equivalent to :cpp:type:`value_type` for Kokkos views. | ||
|
|
||
| .. versionadded:: 4.4 |
Co-authored-by: Christian Trott <crtrott@sandia.gov>
|
|
||
| .. versionadded:: 5.0 | ||
|
|
||
| .. seealso:: :ref:`Natural mdspans <api-view-natural-mdspans>` |
There was a problem hiding this comment.
Not sure if this is really needed. The link to natrual mdspan page is already provided right above.
That being said, I'm not hugely against this either.
There was a problem hiding this comment.
We could retain this and remove the link above.
| Canonical form of this :cpp:class:`View` with static extents preserved. | ||
| Used by generic Kokkos utilities. |
There was a problem hiding this comment.
This is a very confusing description, I think it needs an example.
Can drop the line about used by generic Kokkos utilities, that's not useful
Co-authored-by: Nicolas Morales <nmmoral@sandia.gov> Co-authored-by: Christian Trott <crtrott@sandia.gov>
| May be :cpp:`const`-qualified (e.g., :cpp:`const double`) for read-only views. | ||
| Equivalent to :cpp:type:`value_type` for Kokkos views. |
There was a problem hiding this comment.
| May be :cpp:`const`-qualified (e.g., :cpp:`const double`) for read-only views. | |
| Equivalent to :cpp:type:`value_type` for Kokkos views. | |
| Can be :cpp:`const`-qualified (e.g., :cpp:`const double`) for read-only Views. | |
| Equivalent to :cpp:type:`value_type` for Kokkos Views. |
| .. cpp:type:: data_handle_type | ||
|
|
||
| The data handle type following the :cpp:`std::mdspan` convention. | ||
| For managed views this is a reference-counted handle; for unmanaged views it is a raw pointer (e.g., :cpp:`double*`). |
There was a problem hiding this comment.
| For managed views this is a reference-counted handle; for unmanaged views it is a raw pointer (e.g., :cpp:`double*`). | |
| For managed Views this is a reference-counted handle; for unmanaged Views it is a raw pointer (e.g., :cpp:`double*`). |
|
|
||
| The :cpp:class:`ViewTraits` specialization for this :cpp:class:`View`. | ||
| Provides access to all compile-time properties such as :cpp:type:`data_type`, :cpp:type:`array_layout`, | ||
| :cpp:type:`memory_space`, and :cpp:type:`memory_traits`. |
There was a problem hiding this comment.
| :cpp:type:`memory_space`, and :cpp:type:`memory_traits`. | |
| :cpp:type:`memory_space` and :cpp:type:`memory_traits`. |
| @@ -202,6 +266,20 @@ Other Types | |||
|
|
|||
| index type associated with the memory space of this :cpp:class:`View`. | |||
There was a problem hiding this comment.
Can we say more about size_type? I see papers online about size_type and index_type of `mdspan. I am still trying to understand what is the current status. Can the description be made more informative?
| .. cpp:type:: rank_type | ||
|
|
||
| Type used to represent the rank of the :cpp:class:`View` (i.e., the type of :cpp:func:`rank` and :cpp:func:`rank_dynamic`). | ||
| It is :cpp:`std::size_t`. |
There was a problem hiding this comment.
Should it be the following?
| It is :cpp:`std::size_t`. | |
| Default is :cpp:`std::size_t`. |
|
|
||
| .. cpp:type:: dimension | ||
|
|
||
| An integer array like type, able to represent the extents of the :cpp:class:`View`. |
There was a problem hiding this comment.
| An integer array like type, able to represent the extents of the :cpp:class:`View`. | |
| An integer array-like type, able to represent the extents of the :cpp:class:`View`. |
|
|
||
| .. versionremoved:: 5.3 | ||
|
|
||
| mdspan Types |
There was a problem hiding this comment.
| mdspan Types | |
| mdspan types |
Smaller case "types" looks better next to "mdspan".
|
|
||
| .. versionadded:: 5.0 | ||
|
|
||
| .. seealso:: :ref:`Natural mdspans <api-view-natural-mdspans>` |
There was a problem hiding this comment.
We could retain this and remove the link above.
| ^^^^^^^^^^^^ | ||
|
|
||
| The following types provide compatibility with :cpp:`std::mdspan` (C++23). | ||
| They describe the :ref:`natural mdspan <api-view-natural-mdspans>` of the :cpp:class:`View`. |
There was a problem hiding this comment.
Can we improve this sentence? Will the following work?
| They describe the :ref:`natural mdspan <api-view-natural-mdspans>` of the :cpp:class:`View`. | |
| They describe the *natural mdspan* that corresponds to a :cpp:class:`View`. |
|
|
||
| The mdspan layout policy type of :cpp:type:`mdspan_type`. | ||
| Note that this is the mdspan layout type (e.g., :cpp:`std::layout_left`) and is | ||
| distinct from :cpp:type:`array_layout` (the Kokkos layout tag, e.g., :cpp:struct:`LayoutLeft`). |
There was a problem hiding this comment.
Yes, layout_type is distinct from LayoutLeft but won't the two constructs mean the same thing and match each other for a given View?
The
Kokkos::ViewAPI page was missing a substantial number of public type aliases, especially those added forstd::mdspaninteroperability.Added type aliases
Scalar Types
element_type— mdspan-convention element type; may beconst-qualified unlikevalue_typeView Types
type— the View's own fully-specified typearray_type— deprecated alias fortypeuniform_type+ 7 variants (_const_,_runtime_,_nomemspace_combinations) — canonical forms used by generic Kokkos utilities (e.g.,create_mirror)Data Handles
data_handle_type— raw pointer for unmanaged views, reference-counted handle for managed views (mdspan convention)Other Types
traits— theViewTraits<DataType, Properties...>specialization; primary introspection point for all template argumentsindex_type— unsigned integral index type (from mdspan, typicallystd::size_t)rank_type— type ofrank()/rank_dynamic()return values (from mdspan)New "mdspan Types" section
mdspan_type— the natural mdspan of the Viewextents_type—std::extents<...>encoding rank and static/dynamic dimensionslayout_type— mdspan layout policy (e.g.,std::layout_left); distinct fromarray_layout(e.g.,Kokkos::LayoutLeft)accessor_type— mdspan accessor policy; carries memory space and access semanticsmapping_type—layout_type::mapping<extents_type>