Add documentation for ck_tile::array<T,N> (#2078)

* addded documentation for ck_tile::array<T,N>

* clang format fix

* spelling errros

Co-authored-by: Adam Osewski <19374865+aosewski@users.noreply.github.com>

* spelling errros

Co-authored-by: Adam Osewski <19374865+aosewski@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: spolifroni-amd <Sandra.Polifroni@amd.com>

* Revert "spelling errros"

This reverts commit 4179e7d193.

* Revert "spelling errros"

This reverts commit 3f90733dbe.

---------

Co-authored-by: Adam Osewski <19374865+aosewski@users.noreply.github.com>
Co-authored-by: spolifroni-amd <Sandra.Polifroni@amd.com>
Co-authored-by: John Afaganis <john.afaganis@amd.com>
This commit is contained in:
Aviral Goel
2025-04-30 18:43:36 -05:00
committed by GitHub
parent cfae863431
commit 1d8ef40760

View File

@@ -19,6 +19,25 @@ namespace ck_tile {
// array<index_t, 4> buf {3, 2}; => {3, 2, 2, 2} (not {3,2,0,0})
// use make_array_with({...}) to construct an array with compatible behavior as old ck
// TODO: manually added constructor same as old ck
/**
* @brief A fixed-size array container similar to std::array with additional utilities.
*
* This template class provides a lightweight fixed-size array with value semantics,
* supporting both host and device functionality for GPU programming. It includes
* specialized initialization methods and type punning capabilities.
*
* @tparam T_ The type of elements in the array
* @tparam N_ The fixed number of elements in the array
*
* @note This implementation provides additional features beyond std::array:
* - GPU compatibility via CK_TILE_HOST_DEVICE macros
* - Type punning via get_as() and set_as() methods
* - Various specialized access methods
* - Specialized initialization behaviors
*
* The initializer_list constructor fills remaining elements with the last value
* provided if the list size is smaller than N, which is different than std::array.
*/
template <typename T_, index_t N_>
struct array
{
@@ -142,6 +161,14 @@ struct array
// empty Array
/// @brief Specialization of array container for zero elements.
///
/// This is a specialization of the array container template for the case where the number of
/// elements is 0. It provides the same interface as the general array template, but with operations
/// appropriate for an empty array.
///
/// @tparam T The type of elements stored in the array (not used in this specialization but
/// maintained for API consistency).
template <typename T>
struct array<T, 0>
{