mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-03 13:11:25 +00:00
[CK_BUILDER] Debug utilities (#3528)
* ck-builder: make toString to_string We are using snake case for CK-Builder * ck-builder: add debug.hpp with tensor descriptor printing function This adds some initial functionality to debug.hpp, a header which will be used to house some debug utilities. * ck-builder: abstract nd-iteration Abstracting this makes it easier to test, clearer, and allows us to use it elsewhere (such as in debug.hpp soon) * ck-builder: tensor printing * ck-builder: rename INT32 to I32 This makes it more in line with the other data type definitions.
This commit is contained in:
@@ -6,11 +6,13 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
#include <array>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
namespace ckb = ck_tile::builder;
|
||||
namespace ckt = ck_tile::builder::test;
|
||||
|
||||
using ck_tile::test::StringEqWithDiff;
|
||||
using ::testing::ElementsAreArray;
|
||||
using ::testing::Eq;
|
||||
using ::testing::Throws;
|
||||
@@ -76,7 +78,7 @@ TEST(TensorDescriptor, MakeDescriptor)
|
||||
|
||||
// Note: automatic inference of RANK.
|
||||
const auto desc =
|
||||
ckt::make_descriptor<ckb::DataType::INT32>(lengths, ckt::PackedRightLayout{});
|
||||
ckt::make_descriptor<ckb::DataType::I32>(lengths, ckt::PackedRightLayout{});
|
||||
|
||||
EXPECT_THAT(desc.get_lengths(), ElementsAreArray(lengths));
|
||||
EXPECT_THAT(desc.get_strides(),
|
||||
@@ -173,7 +175,7 @@ TEST(TensorDescriptor, ExtentFromVector)
|
||||
|
||||
TEST(TensorDescriptor, IsPacked)
|
||||
{
|
||||
constexpr auto dt = ckb::DataType::INT32; // Irrelevant for this test
|
||||
constexpr auto dt = ckb::DataType::I32; // Irrelevant for this test
|
||||
EXPECT_TRUE(
|
||||
ckt::make_descriptor<dt>(ckt::Extent{101, 43, 25, 662, 654}, ckt::PackedLeftLayout{})
|
||||
.is_packed());
|
||||
@@ -189,3 +191,20 @@ TEST(TensorDescriptor, IsPacked)
|
||||
EXPECT_FALSE(
|
||||
ckt::make_descriptor<dt>(ckt::Extent{30, 20, 10}, ckt::Extent{1, 1, 1}).is_packed());
|
||||
}
|
||||
|
||||
TEST(TensorDescriptor, PrintExtent)
|
||||
{
|
||||
{
|
||||
const ckt::Extent extent{6233, 55, 1235, 52, 203};
|
||||
std::stringstream ss;
|
||||
ss << extent;
|
||||
EXPECT_THAT(ss.str(), StringEqWithDiff("[6233, 55, 1235, 52, 203]"));
|
||||
}
|
||||
|
||||
{
|
||||
const ckt::Extent extent{};
|
||||
std::stringstream ss;
|
||||
ss << extent;
|
||||
EXPECT_THAT(ss.str(), StringEqWithDiff("[]"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user