mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-21 05:19:20 +00:00
[CK] Add rocm_ck foundation types: DataType, Layout, Args, Ops (#7114) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Add the vocabulary types that all rocm_ck schema headers build on - 9 new headers under `include/rocm_ck/`, 6 unit test files - Pure C++20, host-only — no CK Tile dependencies **Headers:** | Header | Purpose | |--------|---------| | `index_t.hpp` | `index_t`, `long_index_t` (matches ck_tile) | | `gpu_target.hpp` | `GpuTarget` enum (ISA targets) | | `datatype.hpp` | `DataType` enum (17 variants) | | `layout.hpp` | `Layout` enum (Row, Col, Auto) + stride helpers | | `fixed_string.hpp` | `FixedString<N>` — structural string for NTTPs | | `args.hpp` | Generic kernel argument buffer (ABI) | | `ops.hpp` | Operator structs (`GemmOp`, `AddOp`, ...) + `Op` variant | | `physical_tensor.hpp` | `PhysicalTensor` — maps names to Args slots | | `resolved_tensor.hpp` | `ResolvedTensor` — output of `Signature::resolve()` | **Stack**: This is PR 1 of 3 porting the rocm_ck constexpr schema from experimental to production, #7143. 1. **This PR** — Foundation types (vocabulary) 2. Schema engine — `Signature`, `resolve()`, `ArchProperties` 3. Spec factories — `GemmSpec`, `ElementwiseSpec`, `makeSpec()` ## Test plan - [ ] `ninja build-smoke-rocm-ck` builds all tests - [ ] `ctest -L ROCM_CK_SMOKE --output-on-failure` — 6 unit tests pass (86 test cases) - [ ] Default CK build (`CK_ENABLE_ROCM_CK=OFF`) unaffected 🤖 Generated with [Claude Code](https://claude.com/claude-code)
36 lines
932 B
C++
36 lines
932 B
C++
// Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#include <rocm_ck/physical_tensor.hpp>
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
using ::rocm_ck::DataType;
|
|
using ::rocm_ck::FixedString;
|
|
using ::rocm_ck::kMaxPhysicalTensors;
|
|
using ::rocm_ck::Layout;
|
|
using ::rocm_ck::PhysicalTensor;
|
|
|
|
namespace {
|
|
|
|
TEST(PhysicalTensor, InitializesWithFP32RowAndSlotZero)
|
|
{
|
|
constexpr PhysicalTensor pt{};
|
|
EXPECT_EQ(pt.dtype, DataType::FP32);
|
|
EXPECT_EQ(pt.layout, Layout::Row);
|
|
EXPECT_EQ(pt.args_slot, 0);
|
|
}
|
|
|
|
TEST(PhysicalTensor, StoresAllFieldsFromConstruction)
|
|
{
|
|
constexpr PhysicalTensor pt{FixedString<16>("bias"), DataType::FP16, Layout::Col, 3};
|
|
EXPECT_TRUE(pt.name == "bias");
|
|
EXPECT_EQ(pt.dtype, DataType::FP16);
|
|
EXPECT_EQ(pt.layout, Layout::Col);
|
|
EXPECT_EQ(pt.args_slot, 3);
|
|
}
|
|
|
|
TEST(PhysicalTensor, LimitsCapacityTo8) { EXPECT_EQ(kMaxPhysicalTensors, 8); }
|
|
|
|
} // namespace
|