Merge commit 'b60af5bde965a2bb007bb582f7836b43ca647b81' into develop

This commit is contained in:
assistant-librarian[bot]
2025-09-30 16:14:10 +00:00
parent 631a25de61
commit ee9718a427
115 changed files with 2849 additions and 756 deletions

View File

@@ -15,6 +15,9 @@ using F32 = float;
using BF16 = ck::bhalf_t;
using F64 = double;
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestBatchNormBwdRank4 : public ::testing::Test
{
@@ -37,33 +40,48 @@ class TestBatchNormBwdRank4 : public ::testing::Test
template <int NumReduceDim>
void Run()
{
for(auto& inOutLengths : list_of_lengths)
for(size_t i = 0; i < list_of_lengths.size(); i++)
{
bool pass = true;
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& inOutLengths = list_of_lengths[i];
bool pass = true;
EXPECT_FALSE(reduceDims.size() != NumReduceDim);
pass = pass && ck::profiler::profile_batchnorm_backward_impl<XDataType,
DxDataType,
DyDataType,
AccDataType,
ScaleDataType,
BiasDataType,
MeanVarDataType,
4,
NumReduceDim>(
true, 3, false, false, inOutLengths, reduceDims, true, epsilon);
pass =
pass &&
ck::profiler::profile_batchnorm_backward_impl<XDataType,
DxDataType,
DyDataType,
AccDataType,
ScaleDataType,
BiasDataType,
MeanVarDataType,
4,
NumReduceDim>(
true, 3, false, false, inOutLengths, reduceDims, true, epsilon, instance_index);
pass = pass && ck::profiler::profile_batchnorm_backward_impl<XDataType,
DxDataType,
DyDataType,
AccDataType,
ScaleDataType,
BiasDataType,
MeanVarDataType,
4,
NumReduceDim>(
true, 3, false, false, inOutLengths, reduceDims, false, epsilon);
pass =
pass && ck::profiler::profile_batchnorm_backward_impl<XDataType,
DxDataType,
DyDataType,
AccDataType,
ScaleDataType,
BiasDataType,
MeanVarDataType,
4,
NumReduceDim>(true,
3,
false,
false,
inOutLengths,
reduceDims,
false,
epsilon,
instance_index);
EXPECT_TRUE(pass);
}
@@ -103,3 +121,19 @@ TYPED_TEST(TestBatchNormBwdRank4, nchw)
this->reduceDims = {0, 2, 3};
this->template Run<3>();
}
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
if(argc == 1) {}
else if(argc == 3)
{
param_mask = strtol(argv[1], nullptr, 0);
instance_index = atoi(argv[2]);
}
else
{
std::cout << "Usage of " << argv[0] << std::endl;
std::cout << "Arg1,2: param_mask instance_index(-1 means all)" << std::endl;
}
return RUN_ALL_TESTS();
}

View File

@@ -16,6 +16,9 @@ using BF16 = ck::bhalf_t;
using I8 = int8_t;
using F64 = double;
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestBatchNormFwdRank4 : public ::testing::Test
{
@@ -38,9 +41,14 @@ class TestBatchNormFwdRank4 : public ::testing::Test
template <int NumReduceDim>
void Run()
{
for(auto& inOutLengths : list_of_lengths)
for(size_t i = 0; i < list_of_lengths.size(); i++)
{
bool pass = true;
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& inOutLengths = list_of_lengths[i];
bool pass = true;
EXPECT_FALSE(reduceDims.size() != NumReduceDim);
@@ -61,7 +69,8 @@ class TestBatchNormFwdRank4 : public ::testing::Test
true,
true,
epsilon,
averageFactor);
averageFactor,
instance_index);
pass =
pass && ck::profiler::profile_batchnorm_forward_impl<XDataType,
@@ -80,7 +89,8 @@ class TestBatchNormFwdRank4 : public ::testing::Test
false,
false,
epsilon,
averageFactor);
averageFactor,
instance_index);
EXPECT_TRUE(pass);
}
@@ -120,3 +130,19 @@ TYPED_TEST(TestBatchNormFwdRank4, nchw)
this->reduceDims = {0, 2, 3};
this->template Run<3>();
}
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
if(argc == 1) {}
else if(argc == 3)
{
param_mask = strtol(argv[1], nullptr, 0);
instance_index = atoi(argv[2]);
}
else
{
std::cout << "Usage of " << argv[0] << std::endl;
std::cout << "Arg1,2: param_mask instance_index(-1 means all)" << std::endl;
}
return RUN_ALL_TESTS();
}

View File

@@ -10,6 +10,9 @@
#include "profiler/profile_batchnorm_infer_impl.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
using F16 = ck::half_t;
using F32 = float;
using BF16 = ck::bhalf_t;
@@ -36,31 +39,38 @@ class TestBatchNormInferRank4 : public ::testing::Test
template <int NumReduceDim>
void Run()
{
for(auto& inOutLengths : list_of_lengths)
for(size_t i = 0; i < list_of_lengths.size(); i++)
{
bool pass = true;
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& inOutLengths = list_of_lengths[i];
bool pass = true;
EXPECT_FALSE(reduceDims.size() != NumReduceDim);
pass = pass && ck::profiler::profile_batchnorm_infer_impl<XDataType,
YDataType,
AccDataType,
ScaleDataType,
BiasDataType,
MeanVarDataType,
4,
NumReduceDim>(
true, 3, false, false, inOutLengths, reduceDims, epsilon);
pass = pass &&
ck::profiler::profile_batchnorm_infer_impl<XDataType,
YDataType,
AccDataType,
ScaleDataType,
BiasDataType,
MeanVarDataType,
4,
NumReduceDim>(
true, 3, false, false, inOutLengths, reduceDims, epsilon, instance_index);
pass = pass && ck::profiler::profile_batchnorm_infer_impl<XDataType,
YDataType,
AccDataType,
ScaleDataType,
BiasDataType,
MeanVarDataType,
4,
NumReduceDim>(
true, 3, false, false, inOutLengths, reduceDims, epsilon);
pass = pass &&
ck::profiler::profile_batchnorm_infer_impl<XDataType,
YDataType,
AccDataType,
ScaleDataType,
BiasDataType,
MeanVarDataType,
4,
NumReduceDim>(
true, 3, false, false, inOutLengths, reduceDims, epsilon, instance_index);
EXPECT_TRUE(pass);
}
@@ -100,3 +110,20 @@ TYPED_TEST(TestBatchNormInferRank4, nchw)
this->reduceDims = {0, 2, 3};
this->template Run<3>();
}
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
if(argc == 1) {}
else if(argc == 3)
{
param_mask = strtol(argv[1], nullptr, 0);
instance_index = atoi(argv[2]);
}
else
{
std::cout << "Usage of " << argv[0] << std::endl;
std::cout << "Arg1,2: param_mask instance_index(-1 means all)" << std::endl;
}
return RUN_ALL_TESTS();
}