From 7cedc337038dbfd41bb62e0b1fb00ce255389997 Mon Sep 17 00:00:00 2001 From: Aviral Goel Date: Wed, 30 Apr 2025 18:43:36 -0500 Subject: [PATCH] Add documentation for ck_tile::array (#2078) * addded documentation for ck_tile::array * 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 * Revert "spelling errros" This reverts commit 4179e7d193e27b0b0b500ad50a87ae9f8dba8334. * Revert "spelling errros" This reverts commit 3f90733dbe27dffb9cb113a007059cf149cafb48. --------- Co-authored-by: Adam Osewski <19374865+aosewski@users.noreply.github.com> Co-authored-by: spolifroni-amd Co-authored-by: John Afaganis [ROCm/composable_kernel commit: 1d8ef407604882b03857ba75d71be29ccd0ed592] --- include/ck_tile/core/container/array.hpp | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/include/ck_tile/core/container/array.hpp b/include/ck_tile/core/container/array.hpp index fa63597db4..94aa40e278 100644 --- a/include/ck_tile/core/container/array.hpp +++ b/include/ck_tile/core/container/array.hpp @@ -19,6 +19,25 @@ namespace ck_tile { // array 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 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 struct array {