[CK] Add command option instance_index and param_mask to run partial ck test (#2889)

* [CK] Add command option instance_index and param_mask to run partial ck test

Many CK test are instance test. it will loop all instance in the instance library. It causes test often out-of-time if we run test on simulator/emulator.
This PR add option instance_index and param_mask to reduce the workload of instance test

instance_index: only run test 1 available instance with specified index.
param_mask: filter the embedded parameter with specified mask

* fix CI error

* fix clang format

---------

Co-authored-by: illsilin_amdeng <Illia.Silin@amd.com>

[ROCm/composable_kernel commit: e78a897ec0]
This commit is contained in:
linqunAMD
2025-09-30 23:24:40 +08:00
committed by GitHub
parent 780456f1ce
commit 6c4ff0b062
113 changed files with 2804 additions and 704 deletions

View File

@@ -8,6 +8,9 @@ using F16 = ck::half_t;
using F32 = float;
using ck::index_t;
static ck::index_t length_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestgroupnormBwdData : public ::testing::Test
{
@@ -29,15 +32,20 @@ class TestgroupnormBwdData : public ::testing::Test
{1, 32, 32, 32, 20},
{1, 16, 16, 32, 40}};
for(auto length : lengths)
for(size_t i = 0; i < lengths.size(); i++)
{
if((length_mask & (1 << i)) == 0)
{
continue;
}
auto length = lengths[i];
bool success = ck::profiler::profile_groupnorm_bwd_data_impl<DYDataType,
XDataType,
GammaDataType,
MeanInvStdDataType,
ComputeDataType,
DXDataType>(
true, 2, false, false, length);
true, 2, false, false, length, instance_index);
EXPECT_TRUE(success);
}
}
@@ -49,3 +57,19 @@ using KernelTypes = ::testing::Types<
TYPED_TEST_SUITE(TestgroupnormBwdData, KernelTypes);
TYPED_TEST(TestgroupnormBwdData, Test_FP32) { this->Run(); }
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
if(argc == 1) {}
else if(argc == 3)
{
length_mask = strtol(argv[1], nullptr, 0);
instance_index = atoi(argv[2]);
}
else
{
std::cout << "Usage of " << argv[0] << std::endl;
std::cout << "Arg1,2: length_mask instance_index(-1 means all)" << std::endl;
}
return RUN_ALL_TESTS();
}

View File

@@ -8,6 +8,9 @@ using F16 = ck::half_t;
using F32 = float;
using ck::index_t;
static ck::index_t length_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestLayernorm2dBwdData : public ::testing::Test
{
@@ -25,16 +28,21 @@ class TestLayernorm2dBwdData : public ::testing::Test
std::vector<std::vector<ck::index_t>> lengths = {
{4, 256}, {8, 511}, {9, 1032}, {4, 2048}, {1, 8192}, {4000, 2000}};
for(auto length : lengths)
for(size_t i = 0; i < lengths.size(); i++)
{
bool success =
ck::profiler::profile_layernorm_bwd_data_impl<DYDataType,
XDataType,
GammaDataType,
MeanInvStdDataType,
ComputeDataType,
DXDataType,
2>(true, 2, false, false, length);
if((length_mask & (1 << i)) == 0)
{
continue;
}
auto length = lengths[i];
bool success = ck::profiler::profile_layernorm_bwd_data_impl<DYDataType,
XDataType,
GammaDataType,
MeanInvStdDataType,
ComputeDataType,
DXDataType,
2>(
true, 2, false, false, length, instance_index);
EXPECT_TRUE(success);
}
}
@@ -46,3 +54,20 @@ using KernelTypes = ::testing::Types<
TYPED_TEST_SUITE(TestLayernorm2dBwdData, KernelTypes);
TYPED_TEST(TestLayernorm2dBwdData, Test_FP32) { this->Run(); }
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
if(argc == 1) {}
else if(argc == 3)
{
length_mask = strtol(argv[1], nullptr, 0);
instance_index = atoi(argv[2]);
}
else
{
std::cout << "Usage of " << argv[0] << std::endl;
std::cout << "Arg1,2: length_mask instance_index(-1 means all)" << std::endl;
}
return RUN_ALL_TESTS();
}