mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-07-17 09:08:35 +00:00
[CK TILE] Rename trivial_array to static_array
This commit is contained in:
@@ -39,9 +39,9 @@
|
||||
#include "ck_tile/core/container/multi_index.hpp"
|
||||
#include "ck_tile/core/container/sequence.hpp"
|
||||
#include "ck_tile/core/container/span.hpp"
|
||||
#include "ck_tile/core/container/static_array.hpp"
|
||||
#include "ck_tile/core/container/statically_indexed_array.hpp"
|
||||
#include "ck_tile/core/container/thread_buffer.hpp"
|
||||
#include "ck_tile/core/container/trivial_array.hpp"
|
||||
#include "ck_tile/core/container/tuple.hpp"
|
||||
#include "ck_tile/core/numeric/bfloat16.hpp"
|
||||
#include "ck_tile/core/numeric/e8m0.hpp"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "ck_tile/core/config.hpp"
|
||||
#include "ck_tile/core/container/trivial_array.hpp"
|
||||
#include "ck_tile/core/container/static_array.hpp"
|
||||
#include "ck_tile/core/numeric/integer.hpp"
|
||||
#include "ck_tile/core/numeric/integral_constant.hpp"
|
||||
#include "ck_tile/core/numeric/math.hpp"
|
||||
@@ -353,8 +353,8 @@ struct sequence_inclusive_scan_impl<sequence<Is...>, Reduce, Init, Reverse>
|
||||
else
|
||||
{
|
||||
constexpr auto arr = []() {
|
||||
trivial_array<index_t, size> values = {Is...};
|
||||
trivial_array<index_t, size> result = {0};
|
||||
static_array<index_t, size> values = {Is...};
|
||||
static_array<index_t, size> result = {0};
|
||||
if constexpr(Reverse)
|
||||
{
|
||||
// Reverse scan: right to left
|
||||
|
||||
30
include/ck_tile/core/container/static_array.hpp
Normal file
30
include/ck_tile/core/container/static_array.hpp
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
#include "ck_tile/core/numeric/integer.hpp"
|
||||
|
||||
namespace ck_tile {
|
||||
// Fixed-size array with aggregate initialization
|
||||
//
|
||||
// This is a minimal array type designed for:
|
||||
// - Constexpr/compile-time computation
|
||||
// - GPU kernel code (trivially copyable)
|
||||
// - Template metaprogramming
|
||||
//
|
||||
// Unlike ck_tile::array, this has no custom constructors,
|
||||
// making it a literal type suitable for constexpr contexts.
|
||||
// Use aggregate initialization: static_array<int, 3> arr{1, 2, 3};
|
||||
template <typename T, index_t N>
|
||||
struct static_array
|
||||
{
|
||||
// Public aggregate initialization makes this a literal type
|
||||
T elems[N];
|
||||
|
||||
// Basic constexpr accessors
|
||||
constexpr const T& operator[](index_t i) const { return elems[i]; }
|
||||
constexpr T& operator[](index_t i) { return elems[i]; }
|
||||
|
||||
constexpr static index_t size() { return N; }
|
||||
};
|
||||
} // namespace ck_tile
|
||||
@@ -1,21 +0,0 @@
|
||||
// Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
#include "ck_tile/core/numeric/integer.hpp"
|
||||
|
||||
namespace ck_tile {
|
||||
// trivial_array has no custom constructor, allowing it to be used as a constexpr variable type
|
||||
template <typename T, index_t N>
|
||||
struct trivial_array
|
||||
{
|
||||
// Public aggregate initialization makes this a literal type
|
||||
T data[N];
|
||||
|
||||
// Basic constexpr accessors
|
||||
constexpr const T& operator[](index_t i) const { return data[i]; }
|
||||
constexpr T& operator[](index_t i) { return data[i]; }
|
||||
|
||||
constexpr static index_t size() { return N; }
|
||||
};
|
||||
} // namespace ck_tile
|
||||
Reference in New Issue
Block a user