Skip to content

docs(View): Add missing public type aliases to Kokkos::View API reference - #907

Open
crtrott with Copilot wants to merge 5 commits into
mainfrom
copilot/add-missing-view-typedefs-docs
Open

docs(View): Add missing public type aliases to Kokkos::View API reference#907
crtrott with Copilot wants to merge 5 commits into
mainfrom
copilot/add-missing-view-typedefs-docs

Conversation

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown

The Kokkos::View API page was missing a substantial number of public type aliases, especially those added for std::mdspan interoperability.

Added type aliases

Scalar Types

  • element_type — mdspan-convention element type; may be const-qualified unlike value_type

View Types

  • type — the View's own fully-specified type
  • array_type — deprecated alias for type
  • uniform_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 — the ViewTraits<DataType, Properties...> specialization; primary introspection point for all template arguments
  • index_type — unsigned integral index type (from mdspan, typically std::size_t)
  • rank_type — type of rank()/rank_dynamic() return values (from mdspan)

New "mdspan Types" section

  • mdspan_type — the natural mdspan of the View
  • extents_typestd::extents<...> encoding rank and static/dynamic dimensions
  • layout_type — mdspan layout policy (e.g., std::layout_left); distinct from array_layout (e.g., Kokkos::LayoutLeft)
  • accessor_type — mdspan accessor policy; carries memory space and access semantics
  • mapping_typelayout_type::mapping<extents_type>

Co-authored-by: crtrott <9490481+crtrott@users.noreply.github.com>
Copilot AI changed the title Add missing typedefs to Kokkos::View API documentation docs(View): Add missing public type aliases to Kokkos::View API reference Aug 18, 2026
Copilot AI requested a review from crtrott August 18, 2026 23:58
Comment thread docs/source/API/core/view/view.rst Outdated
Comment thread docs/source/API/core/view/view.rst Outdated
Comment thread docs/source/API/core/view/view.rst Outdated
Co-authored-by: Christian Trott <crtrott@sandia.gov>
Co-authored-by: Christian Trott <crtrott@sandia.gov>
@crtrott
crtrott marked this pull request as ready for review August 19, 2026 00:05
Comment thread docs/source/API/core/view/view.rst Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks more like 4.5

Comment thread docs/source/API/core/view/view.rst Outdated
Comment thread docs/source/API/core/view/view.rst Outdated
Comment thread docs/source/API/core/view/view.rst Outdated
Comment thread docs/source/API/core/view/view.rst Outdated
Comment thread docs/source/API/core/view/view.rst Outdated
Comment thread docs/source/API/core/view/view.rst Outdated
Comment thread docs/source/API/core/view/view.rst Outdated
Comment thread docs/source/API/core/view/view.rst Outdated
Comment thread docs/source/API/core/view/view.rst Outdated
Co-authored-by: Christian Trott <crtrott@sandia.gov>

.. versionadded:: 5.0

.. seealso:: :ref:`Natural mdspans <api-view-natural-mdspans>`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could retain this and remove the link above.

Comment thread docs/source/API/core/view/view.rst Outdated
Comment on lines +197 to +198
Canonical form of this :cpp:class:`View` with static extents preserved.
Used by generic Kokkos utilities.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread docs/source/API/core/view/view.rst Outdated
Comment thread docs/source/API/core/view/view.rst Outdated
Co-authored-by: Nicolas Morales <nmmoral@sandia.gov>
Co-authored-by: Christian Trott <crtrott@sandia.gov>
Comment on lines +128 to +129
May be :cpp:`const`-qualified (e.g., :cpp:`const double`) for read-only views.
Equivalent to :cpp:type:`value_type` for Kokkos views.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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*`).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
: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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be the following?

Suggested change
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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
mdspan Types
mdspan types

Smaller case "types" looks better next to "mdspan".


.. versionadded:: 5.0

.. seealso:: :ref:`Natural mdspans <api-view-natural-mdspans>`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we improve this sentence? Will the following work?

Suggested change
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`).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@yasahi-hpc yasahi-hpc mentioned this pull request Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants