Files
composable_kernel/rocm_ck/tests/unit/unit_fixed_string.cpp
John Shumway 3e110e1718 [rocm-libraries] ROCm/rocm-libraries#7114 (commit ecef372)
[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)
2026-05-15 19:22:44 +00:00

51 lines
1.2 KiB
C++

// Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
// SPDX-License-Identifier: MIT
#include <rocm_ck/fixed_string.hpp>
#include <gtest/gtest.h>
using ::rocm_ck::FixedString;
namespace {
TEST(FixedString, MatchesSingleCharacter)
{
EXPECT_TRUE(FixedString<16>("A") == "A");
EXPECT_FALSE(FixedString<16>("A") == "B");
}
TEST(FixedString, MatchesExactStringOnly)
{
EXPECT_TRUE(FixedString<16>("bias") == "bias");
EXPECT_FALSE(FixedString<16>("bias") == "bia");
EXPECT_FALSE(FixedString<16>("bias") == "biases");
}
TEST(FixedString, AcceptsMaxCapacityMinusOne)
{
EXPECT_TRUE(FixedString<16>("123456789012345") == "123456789012345");
}
TEST(FixedString, SupportsEmptyString)
{
EXPECT_EQ(FixedString<16>("").len, 0);
EXPECT_TRUE(FixedString<16>("") == "");
EXPECT_FALSE(FixedString<16>("") == "A");
}
TEST(FixedString, EqualStringsCompareEqual)
{
EXPECT_EQ(FixedString<16>("A"), FixedString<16>("A"));
EXPECT_NE(FixedString<16>("A"), FixedString<16>("B"));
}
TEST(FixedString, OrderingIsLexicographic)
{
EXPECT_LT(FixedString<16>("A"), FixedString<16>("B"));
EXPECT_LT(FixedString<16>("B"), FixedString<16>("Z"));
EXPECT_GT(FixedString<16>("Z"), FixedString<16>("A"));
}
} // namespace