[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

@@ -12,7 +12,8 @@
#include "profiler/profile_batched_gemm_impl.hpp"
#include "ck/library/tensor_operation_instance/gpu/batched_gemm.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
struct GemmParams
{
ck::index_t M;
@@ -37,96 +38,153 @@ class TestBatchedGemm : public ::testing::Test
using namespace ck::tensor_operation::device;
bool pass = true;
for(auto& param : params)
for(size_t i = 0; i < params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = params[i];
const auto M = param.M;
const auto N = param.N;
const auto K = param.K;
const auto BatchCount = param.BatchCount;
pass =
pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Row,
Row,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Row,
Row,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true, 1, false, 1, M, N, K, K, N, N, M * K, K * N, M * N, BatchCount);
pass = pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Row,
Row,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Row,
Row,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true,
1,
false,
1,
M,
N,
K,
K,
N,
N,
M * K,
K * N,
M * N,
BatchCount,
instance_index);
pass =
pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Row,
Col,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Row,
Col,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true, 1, false, 1, M, N, K, K, K, N, M * K, K * N, M * N, BatchCount);
pass = pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Row,
Col,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Row,
Col,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true,
1,
false,
1,
M,
N,
K,
K,
K,
N,
M * K,
K * N,
M * N,
BatchCount,
instance_index);
pass =
pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Col,
Row,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Col,
Row,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true, 1, false, 1, M, N, K, M, N, N, M * K, K * N, M * N, BatchCount);
pass = pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Col,
Row,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Col,
Row,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true,
1,
false,
1,
M,
N,
K,
M,
N,
N,
M * K,
K * N,
M * N,
BatchCount,
instance_index);
pass =
pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Col,
Col,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Col,
Col,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true, 1, false, 1, M, N, K, M, K, N, M * K, K * N, M * N, BatchCount);
pass = pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Col,
Col,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Col,
Col,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true,
1,
false,
1,
M,
N,
K,
M,
K,
N,
M * K,
K * N,
M * N,
BatchCount,
instance_index);
}
EXPECT_TRUE(pass);
}
@@ -191,3 +249,20 @@ TEST_F(TestBatchedGemm, fp16)
// this->template Run<float>();
// }
// #endif
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

@@ -13,6 +13,9 @@
#include "ck/library/tensor_operation_instance/gpu/batched_gemm.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
struct GemmParams
{
ck::index_t M;
@@ -37,96 +40,153 @@ class TestBatchedGemm : public ::testing::Test
using namespace ck::tensor_operation::device;
bool pass = true;
for(auto& param : params)
for(size_t i = 0; i < params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = params[i];
const auto M = param.M;
const auto N = param.N;
const auto K = param.K;
const auto BatchCount = param.BatchCount;
pass =
pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Row,
Row,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Row,
Row,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true, 1, false, 1, M, N, K, K, N, N, M * K, K * N, M * N, BatchCount);
pass = pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Row,
Row,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Row,
Row,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true,
1,
false,
1,
M,
N,
K,
K,
N,
N,
M * K,
K * N,
M * N,
BatchCount,
instance_index);
pass =
pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Row,
Col,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Row,
Col,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true, 1, false, 1, M, N, K, K, K, N, M * K, K * N, M * N, BatchCount);
pass = pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Row,
Col,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Row,
Col,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true,
1,
false,
1,
M,
N,
K,
K,
K,
N,
M * K,
K * N,
M * N,
BatchCount,
instance_index);
pass =
pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Col,
Row,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Col,
Row,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true, 1, false, 1, M, N, K, M, N, N, M * K, K * N, M * N, BatchCount);
pass = pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Col,
Row,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Col,
Row,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true,
1,
false,
1,
M,
N,
K,
M,
N,
N,
M * K,
K * N,
M * N,
BatchCount,
instance_index);
pass =
pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Col,
Col,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Col,
Col,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true, 1, false, 1, M, N, K, M, K, N, M * K, K * N, M * N, BatchCount);
pass = pass && ck::profiler::profile_batched_gemm_impl<DataType,
DataType,
DataType,
Col,
Col,
Row,
PassThrough,
PassThrough,
PassThrough,
DeviceBatchedGemm<Col,
Col,
Row,
DataType,
DataType,
DataType,
PassThrough,
PassThrough,
PassThrough>>(
true,
1,
false,
1,
M,
N,
K,
M,
K,
N,
M * K,
K * N,
M * N,
BatchCount,
instance_index);
}
EXPECT_TRUE(pass);
}
@@ -183,3 +243,20 @@ TEST_F(TestBatchedGemm, fp32)
this->template Run<float>();
}
#endif
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

@@ -7,6 +7,8 @@
#include "profiler/profile_batched_gemm_impl.hpp"
#include "ck/library/tensor_operation_instance/gpu/batched_gemm_multi_d.hpp"
static ck::index_t instance_index = -1;
namespace {
using F16 = ck::half_t;
@@ -70,7 +72,8 @@ class TestBatchedGemmMultiD : public ::testing::Test
M * K,
K * N,
M * N,
BatchCount);
BatchCount,
instance_index);
EXPECT_TRUE(pass);
}
};
@@ -88,3 +91,18 @@ TYPED_TEST(TestBatchedGemmMultiD, f16) { this->template Run<F16>(); }
#ifdef CK_ENABLE_INT8
TYPED_TEST(TestBatchedGemmMultiD, int8) { this->template Run<int8_t>(); }
#endif
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
if(argc == 1) {}
else if(argc == 2)
{
instance_index = atoi(argv[1]);
}
else
{
std::cout << "Usage of " << argv[0] << std::endl;
std::cout << "Arg1: instance_index(-1 means all)" << std::endl;
}
return RUN_ALL_TESTS();
}

View File

@@ -4,6 +4,9 @@
#include "gtest/gtest.h"
#include "test_batched_gemm_softmax_gemm_util.hpp"
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
template <typename Tuple>
class TestBatchedGemmSoftmaxGemmFP16 : public TestBatchedGemmSoftmaxGemm<Tuple>
{
@@ -174,3 +177,20 @@ TYPED_TEST(TestBatchedGemmSoftmaxGemmFP16, AdhocTest)
};
this->Run();
}
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

@@ -9,6 +9,9 @@
#include "profiler/profile_batched_gemm_softmax_gemm_impl.hpp"
using ck::tensor_operation::device::GemmSpecialization;
extern ck::index_t param_mask;
extern ck::index_t instance_index;
template <ck::index_t N>
using I = ck::Number<N>;
@@ -57,15 +60,38 @@ struct TestBatchedGemmSoftmaxGemm : public ::testing::Test
B1Layout,
CLayout,
MaskingType::value>(
verify_, 1, false, bench_, M, N, K, O, BatchCount);
verify_,
1,
false,
bench_,
M,
N,
K,
O,
BatchCount,
-1, // StrideA
-1, // StrideB0
-1, // StrideB1
-1, // StrideC
-1, // BatchStrideA
-1, // BatchStrideB0
-1, // BatchStrideB1
-1, // BatchStrideC
-1, // alpha
instance_index);
EXPECT_TRUE(pass);
}
void Run()
{
for(auto lengths : this->lengths_)
for(size_t i = 0; i < this->lengths_.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& lengths = this->lengths_[i];
int M = lengths[0];
int N = lengths[1];
int K = lengths[2];

View File

@@ -4,6 +4,8 @@
#include "gtest/gtest.h"
#include "test_batched_gemm_bias_softmax_gemm_permute_util.hpp"
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
template <typename Tuple>
class TestBatchedGemmMaskingScaleSoftmaxGemmPermuteBF16
: public TestBatchedGemmMaskingScaleSoftmaxGemmPermute<Tuple>
@@ -180,3 +182,20 @@ TYPED_TEST(TestBatchedGemmMaskingScaleSoftmaxGemmPermuteBF16, AdhocTest)
};
this->Run();
}
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

@@ -4,6 +4,8 @@
#include "gtest/gtest.h"
#include "test_batched_gemm_softmax_gemm_permute_util.hpp"
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
template <typename Tuple>
class TestBatchedGemmMaskingScaleSoftmaxGemmPermuteFP16
: public TestBatchedGemmMaskingScaleSoftmaxGemmPermute<Tuple>
@@ -180,3 +182,20 @@ TYPED_TEST(TestBatchedGemmMaskingScaleSoftmaxGemmPermuteFP16, AdhocTest)
};
this->Run();
}
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,7 +10,8 @@
#include "profiler/profile_batched_gemm_bias_softmax_gemm_permute_impl.hpp"
#include <hip/hip_runtime.h>
extern ck::index_t param_mask;
extern ck::index_t instance_index;
using ck::tensor_operation::device::GemmSpecialization;
using ck::tensor_operation::device::MaskingSpecialization;
using ck::tensor_operation::device::TensorSpecialization;
@@ -66,21 +67,26 @@ struct TestBatchedGemmMaskingScaleSoftmaxGemmPermute : public ::testing::Test
Acc0BiasDataType,
Acc1BiasDataType,
MaskingType::value>(
verify_, 2, false, bench_, M, N, K, O, G0, G1);
verify_, 2, false, bench_, M, N, K, O, G0, G1, -1, instance_index);
EXPECT_TRUE(pass);
}
void Run()
{
for(auto lengths : this->lengths_)
for(size_t i = 0; i < this->lengths_.size(); i++)
{
int M = lengths[0];
int N = lengths[1];
int K = lengths[2];
int O = lengths[3];
int G0 = lengths[4];
int G1 = lengths[5];
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& lengths = this->lengths_[i];
int M = lengths[0];
int N = lengths[1];
int K = lengths[2];
int O = lengths[3];
int G0 = lengths[4];
int G1 = lengths[5];
this->RunSingle(M, N, K, O, G0, G1);
}

View File

@@ -5,6 +5,8 @@
#include "test_batched_gemm_softmax_gemm_permute_util.hpp"
#include "test_batched_gemm_device_utils.hpp"
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
template <typename Tuple>
class TestBatchedGemmMaskingScaleSoftmaxGemmPermuteBF16
: public TestBatchedGemmMaskingScaleSoftmaxGemmPermute<Tuple>
@@ -228,3 +230,20 @@ TYPED_TEST(TestBatchedGemmMaskingScaleSoftmaxGemmPermuteBF16, AdhocTest)
};
this->Run();
}
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

@@ -5,6 +5,9 @@
#include "test_batched_gemm_softmax_gemm_permute_util.hpp"
#include "test_batched_gemm_device_utils.hpp"
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
template <typename Tuple>
class TestBatchedGemmMaskingScaleSoftmaxGemmPermuteFP16
: public TestBatchedGemmMaskingScaleSoftmaxGemmPermute<Tuple>
@@ -191,3 +194,20 @@ TYPED_TEST(TestBatchedGemmMaskingScaleSoftmaxGemmPermuteFP16, AdhocTest)
};
this->Run();
}
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

@@ -9,6 +9,8 @@
#include "ck/tensor_operation/gpu/device/impl/device_batched_gemm_softmax_gemm_permute_xdl_cshuffle.hpp"
#include "profiler/profile_batched_gemm_softmax_gemm_permute_impl.hpp"
extern ck::index_t param_mask;
extern ck::index_t instance_index;
using ck::tensor_operation::device::GemmSpecialization;
using ck::tensor_operation::device::MaskingSpecialization;
using ck::tensor_operation::device::TensorSpecialization;
@@ -64,21 +66,26 @@ struct TestBatchedGemmMaskingScaleSoftmaxGemmPermute : public ::testing::Test
ck::Tuple<>,
ck::Tuple<>,
MaskingType::value>(
verify_, 2, false, bench_, M, N, K, O, G0, G1);
verify_, 2, false, bench_, M, N, K, O, G0, G1, -1, instance_index);
EXPECT_TRUE(pass);
}
void Run()
{
for(auto lengths : this->lengths_)
for(size_t i = 0; i < this->lengths_.size(); i++)
{
int M = lengths[0];
int N = lengths[1];
int K = lengths[2];
int O = lengths[3];
int G0 = lengths[4];
int G1 = lengths[5];
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& lengths = this->lengths_[i];
int M = lengths[0];
int N = lengths[1];
int K = lengths[2];
int O = lengths[3];
int G0 = lengths[4];
int G1 = lengths[5];
this->RunSingle(M, N, K, O, G0, G1);
}

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();
}

View File

@@ -12,10 +12,11 @@
#include "profiler/profile_contraction_impl.hpp"
#include "profiler/profile_contraction_utils.hpp"
using F16 = ck::half_t;
using BF16 = ck::bhalf_t;
using F32 = float;
using F64 = double;
static ck::index_t instance_index = -1;
using F16 = ck::half_t;
using BF16 = ck::bhalf_t;
using F32 = float;
using F64 = double;
using Row = ck::tensor_layout::gemm::RowMajor;
using Col = ck::tensor_layout::gemm::ColumnMajor;
@@ -95,7 +96,8 @@ class TestContraction : public ::testing::Test
StridesA,
StridesB,
StridesC,
StridesD);
StridesD,
instance_index);
EXPECT_TRUE(pass);
}
}
@@ -219,3 +221,18 @@ TYPED_TEST(TestContractionScaleMixedPrecision, scale)
this->template Run<2>({{8, 16}, {1, 1}, {8, 16}});
this->template Run<2>({{1, 1}, {1, 1}, {1, 1}});
}
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
if(argc == 1) {}
else if(argc == 2)
{
instance_index = atoi(argv[1]);
}
else
{
std::cout << "Usage of " << argv[0] << std::endl;
std::cout << "Arg1: instance_index(-1 means all)" << std::endl;
}
return RUN_ALL_TESTS();
}

View File

@@ -11,6 +11,9 @@
#include "profiler/profile_conv_tensor_rearrange_impl.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestConvTensorRearrange : public ::testing::Test
{
@@ -25,18 +28,24 @@ class TestConvTensorRearrange : public ::testing::Test
{
EXPECT_FALSE(conv_params.empty());
bool pass = true;
for(auto& param : conv_params)
for(size_t i = 0; i < conv_params.size(); i++)
{
pass = pass && ck::profiler::profile_conv_tensor_rearrange_impl<NDimSpatial,
ImLayout,
InDataType,
OutDataType,
ConvTensorRearrangeOp>(
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = conv_params[i];
pass = pass && ck::profiler::profile_conv_tensor_rearrange_impl<NDimSpatial,
ImLayout,
InDataType,
OutDataType,
ConvTensorRearrangeOp>(
true, // do_verification
1, // init_method: integer value
false, // do_log
false, // time_kernel
param);
param,
instance_index);
}
EXPECT_TRUE(pass);
}
@@ -157,3 +166,19 @@ TYPED_TEST(TestConvTensorRearrange3d, Test3D)
this->template Run<3, int8_t, int8_t>();
#endif
}
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

@@ -9,7 +9,8 @@
#include <gtest/gtest.h>
#include "profiler/profile_conv_bwd_data_impl.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestConvndBwdData : public ::testing::Test
{
@@ -20,10 +21,15 @@ class TestConvndBwdData : public ::testing::Test
template <ck::index_t NDimSpatial>
void Run()
{
for(auto& param : conv_params)
EXPECT_FALSE(conv_params.empty());
for(size_t i = 0; i < conv_params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = conv_params[i];
bool pass;
EXPECT_FALSE(conv_params.empty());
pass = ck::profiler::profile_conv_bwd_data_impl<
NDimSpatial,
ck::tuple_element_t<NDimSpatial - 1,
@@ -44,7 +50,8 @@ class TestConvndBwdData : public ::testing::Test
1, // init_method integer value
false, // do_log
false, // time_kernel
param);
param,
instance_index);
EXPECT_TRUE(pass);
}
}
@@ -91,3 +98,19 @@ TYPED_TEST(TestConvndBwdData, Conv3dBwdData)
{3, 1, 128, 128, 256, {1, 1, 1}, {3, 3, 3}, {1, 1, 1}, {1, 1, 1}, {0, 0, 0}, {0, 0, 0}});
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,8 @@
#include "profiler/profile_conv_fwd_impl.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestConvndFwd : public ::testing::Test
{
@@ -20,10 +22,15 @@ class TestConvndFwd : public ::testing::Test
template <ck::index_t NDimSpatial>
void Run()
{
for(auto& param : conv_params)
EXPECT_FALSE(conv_params.empty());
for(size_t i = 0; i < conv_params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = conv_params[i];
bool pass;
EXPECT_FALSE(conv_params.empty());
pass = ck::profiler::profile_conv_fwd_impl<
NDimSpatial,
ck::tuple_element_t<NDimSpatial - 1,
@@ -44,7 +51,8 @@ class TestConvndFwd : public ::testing::Test
1, // init_method integer value
false, // do_log
false, // time_kernel
param);
param,
instance_index);
EXPECT_TRUE(pass);
}
}
@@ -90,3 +98,19 @@ TYPED_TEST(TestConvndFwd, Conv3dFwd)
{3, 1, 128, 128, 256, {1, 1, 1}, {3, 3, 3}, {1, 1, 1}, {1, 1, 1}, {0, 0, 0}, {0, 0, 0}});
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

@@ -8,6 +8,9 @@ using F16 = ck::half_t;
using F32 = float;
using ck::index_t;
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestElementwiseLayernorm : public ::testing::Test
{
@@ -25,15 +28,20 @@ class TestElementwiseLayernorm : public ::testing::Test
std::vector<std::vector<ck::index_t>> lengths = {
{1, 1}, {25, 16}, {39, 777}, {100, 200}, {1024, 1024}, {48 * 256, 2048}, {4096, 8192}};
for(auto length : lengths)
for(size_t i = 0; i < lengths.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& length = lengths[i];
bool success = ck::profiler::profile_elementwise_layernorm_impl<ADataType,
BDataType,
GammaDataType,
BetaDataType,
AccDataType,
YDataType>(
true, 2, false, false, length);
true, 2, false, false, length, instance_index);
EXPECT_TRUE(success);
}
}
@@ -45,3 +53,19 @@ using KernelTypes = ::testing::Types<
TYPED_TEST_SUITE(TestElementwiseLayernorm, KernelTypes);
TYPED_TEST(TestElementwiseLayernorm, Test_FP16) { this->Run(); }
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

@@ -31,4 +31,4 @@ using AccDataType = float;
#include "run_gemm_test.inc"
int main() { return run_gemm_test(); }
int main(int argc, char* argv[]) { return run_gemm_test(argc, argv); }

View File

@@ -31,4 +31,4 @@ using AccDataType = float;
#include "run_gemm_test.inc"
int main() { return run_gemm_test(); }
int main(int argc, char* argv[]) { return run_gemm_test(argc, argv); }

View File

@@ -31,4 +31,4 @@ using AccDataType = float;
#include "run_gemm_test.inc"
int main() { return run_gemm_test(); }
int main(int argc, char* argv[]) { return run_gemm_test(argc, argv); }

View File

@@ -31,4 +31,4 @@ using AccDataType = double;
#include "run_gemm_test.inc"
int main() { return run_gemm_test(); }
int main(int argc, char* argv[]) { return run_gemm_test(argc, argv); }

View File

@@ -31,4 +31,4 @@ using AccDataType = int32_t;
#include "run_gemm_test.inc"
int main() { return run_gemm_test(); }
int main(int argc, char* argv[]) { return run_gemm_test(argc, argv); }

View File

@@ -105,6 +105,7 @@ int main(int argc, char* argv[])
bool do_verification = true;
bool time_kernel = true;
int problem_index = -1;
if(argc == 1)
{
@@ -115,16 +116,28 @@ int main(int argc, char* argv[])
do_verification = std::stoi(argv[1]);
time_kernel = std::stoi(argv[2]);
}
else if(argc == 4)
{
do_verification = std::stoi(argv[1]);
time_kernel = std::stoi(argv[2]);
problem_index = std::stoi(argv[3]);
}
else
{
std::cerr << "arg1: verification (0=no, 1=yes)" << std::endl
<< "arg2: time kernel (0=no, 1=yes)" << std::endl;
<< "arg2: time kernel (0=no, 1=yes)" << std::endl
<< "arg3: problem index (0-35, -1 means all)" << std::endl;
return 0;
}
bool pass = true;
for(auto& p : problems)
for(size_t i = 0; i < problems.size(); i++)
{
if(problem_index != -1 && problem_index != static_cast<ck::index_t>(i))
{
continue;
}
auto& p = problems[i];
GemmParams& problem_size = std::get<0>(p);
const LayoutConfig& layout_config = std::get<1>(p);
const auto& factory = std::get<2>(p);

View File

@@ -261,6 +261,44 @@ struct TestGemm
return true;
}
}
template <template <class...> class DeviceGemmPtr_,
typename ALayout,
typename BLayout,
typename CLayout,
typename ADataType,
typename BDataType,
typename CDataType,
typename AElementwiseOperation,
typename BElementwiseOperation,
typename CElementwiseOperation>
bool IsSupportedArgument(DeviceGemmPtr_<ALayout,
BLayout,
CLayout,
ADataType,
BDataType,
CDataType,
AElementwiseOperation,
BElementwiseOperation,
CElementwiseOperation>* gemmPtr,
const GemmParams& params = GemmParams{})
{
auto invoker_ptr = gemmPtr->MakeInvokerPointer();
auto argument_ptr = gemmPtr->MakeArgumentPointer(static_cast<ADataType*>(nullptr),
static_cast<BDataType*>(nullptr),
static_cast<CDataType*>(nullptr),
params.M,
params.N,
params.K,
params.StrideA,
params.StrideB,
params.StrideC,
AElementwiseOperation{},
BElementwiseOperation{},
CElementwiseOperation{});
return gemmPtr->IsSupportedArgument(argument_ptr.get());
}
};
} // namespace gemm_util

View File

@@ -1,13 +1,39 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
int run_gemm_test()
int run_gemm_test(int argc, char* argv[])
{
using Row = ck::tensor_layout::gemm::RowMajor;
using Col = ck::tensor_layout::gemm::ColumnMajor;
using PassThrough = ck::tensor_operation::element_wise::PassThrough;
ck::gemm_util::GemmParams params;
ck::index_t instance_index = -1;
if(argc == 1)
{
// use default params
}
else if(argc == 4 || argc == 5)
{
params.M = atoi(argv[1]);
params.N = atoi(argv[2]);
params.K = atoi(argv[3]);
params.StrideA = params.M;
params.StrideB = params.N;
params.StrideC = params.K;
if(argc == 5)
{
instance_index = atoi(argv[4]);
}
}
else
{
std::cout << "Usage of " << argv[0] << std::endl;
std::cout << "Arg1-4: M N K instance_index(-1 means all)" << std::endl;
}
std::cout << "Params (M, N, K, index) " << params.M << " " << params.N << " " << params.K << " "
<< instance_index << std::endl;
auto test = [&](auto a_layout, auto b_layout, auto c_layout) {
bool pass = true;
@@ -24,10 +50,31 @@ int run_gemm_test()
const auto gemmPtrs =
ck::tensor_operation::device::instance::DeviceOperationInstanceFactory<
DeviceOp>::GetInstances();
ck::index_t num_instance = 0;
for(auto& gemmPtr : gemmPtrs)
{
pass &= ck::gemm_util::TestGemm<AccDataType>{}(gemmPtr.get());
if(instance_index == -1)
{
pass &= ck::gemm_util::TestGemm<AccDataType>{}(gemmPtr.get(), params);
}
else
{
auto test_gemm = ck::gemm_util::TestGemm<AccDataType>{};
if(test_gemm.IsSupportedArgument(gemmPtr.get(), params))
{
if(num_instance == instance_index)
{
pass &= test_gemm(gemmPtr.get(), params);
}
num_instance++;
}
}
}
if(instance_index != -1)
{
std::cout << "TestGemm_instance (" << instance_index << "/" << num_instance
<< "): " << (pass ? "Passed" : "Failed") << std::endl;
}
return pass;

View File

@@ -4,9 +4,20 @@
#include <iostream>
#include "profiler/profile_gemm_reduce_impl.hpp"
int main()
static ck::index_t instance_index = -1;
int main(int argc, char** argv)
{
if(argc == 1) {}
else if(argc == 2)
{
instance_index = atoi(argv[1]);
}
else
{
std::cout << "Usage of " << argv[0] << std::endl;
std::cout << "Arg1: instance_index(-1 means all)" << std::endl;
}
using Row = ck::tensor_layout::gemm::RowMajor;
using Col = ck::tensor_layout::gemm::ColumnMajor;
@@ -19,22 +30,22 @@ int main()
pass = pass &&
ck::profiler::
profile_gemm_reduce_impl<ck::half_t, ck::half_t, ck::half_t, float, Row, Row, Row>(
true, 1, false, false, M, N, K, K, N, N);
true, 1, false, false, M, N, K, K, N, N, instance_index);
pass = pass &&
ck::profiler::
profile_gemm_reduce_impl<ck::half_t, ck::half_t, ck::half_t, float, Row, Col, Row>(
true, 1, false, false, M, N, K, K, K, N);
true, 1, false, false, M, N, K, K, K, N, instance_index);
pass = pass &&
ck::profiler::
profile_gemm_reduce_impl<ck::half_t, ck::half_t, ck::half_t, float, Col, Row, Row>(
true, 1, false, false, M, N, K, M, N, N);
true, 1, false, false, M, N, K, M, N, N, instance_index);
pass = pass &&
ck::profiler::
profile_gemm_reduce_impl<ck::half_t, ck::half_t, ck::half_t, float, Col, Col, Row>(
true, 1, false, false, M, N, K, M, K, N);
true, 1, false, false, M, N, K, M, K, N, instance_index);
if(pass)
{

View File

@@ -15,6 +15,8 @@
#include "include/ck/utility/data_type.hpp"
#include "profiler/profile_gemm_splitk_impl.hpp"
extern ck::index_t param_mask;
extern ck::index_t instance_index;
namespace ck {
namespace test {
@@ -48,8 +50,13 @@ class TestGemmSplitK : public testing::Test
const int StrideB,
const int StrideC)
{
for(auto kb : k_batches_)
for(size_t i = 0; i < k_batches_.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto kb = k_batches_[i];
RunSingle(M, N, K, StrideA, StrideB, StrideC, kb);
}
}
@@ -82,7 +89,8 @@ class TestGemmSplitK : public testing::Test
StrideC,
kbatch,
n_warmup,
n_iter);
n_iter,
instance_index);
EXPECT_TRUE(pass);
}
};

View File

@@ -7,6 +7,9 @@
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "test_gemm_splitk_util.hpp"
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
using F16 = ck::half_t;
using F32 = float;
@@ -64,3 +67,20 @@ TYPED_TEST_SUITE(TestGemmSplitK_KM_KN, KernelTypes);
TYPED_TEST_SUITE(TestGemmSplitK_KM_NK, KernelTypes);
#include "test_gemm_splitk_ut_cases.inc"
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

@@ -14,7 +14,8 @@
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "include/ck/utility/data_type.hpp"
#include "profiler/profile_gemm_universal_impl.hpp"
extern ck::index_t param_mask;
extern ck::index_t instance_index;
namespace ck {
namespace test {
@@ -49,8 +50,13 @@ class TestGemmUniversal : public testing::Test
const int StrideB,
const int StrideC)
{
for(auto kb : k_batches_)
for(size_t i = 0; i < k_batches_.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto kb = k_batches_[i];
RunSingle(M, N, K, StrideA, StrideB, StrideC, kb);
}
}
@@ -84,7 +90,8 @@ class TestGemmUniversal : public testing::Test
StrideC,
kbatch,
n_warmup,
n_iter);
n_iter,
instance_index);
EXPECT_TRUE(pass);
}
};

View File

@@ -6,10 +6,11 @@
#include "gtest/gtest.h"
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "test_gemm_universal_util.hpp"
using I4 = ck::pk_i4_t;
using BF16 = ck::bhalf_t;
using F32 = float;
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
using I4 = ck::pk_i4_t;
using BF16 = ck::bhalf_t;
using F32 = float;
using Row = ck::tensor_layout::gemm::RowMajor;
using Col = ck::tensor_layout::gemm::ColumnMajor;
@@ -85,3 +86,19 @@ TYPED_TEST_SUITE(TestGemmUniversal_BF16_KM_KN, KernelTypes_KM_KN);
TYPED_TEST_SUITE(TestGemmUniversal_BF16_KM_NK, KernelTypes_KM_NK);
#include "test_gemm_universal_ut_cases_bf16.inc"
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

@@ -6,10 +6,11 @@
#include "gtest/gtest.h"
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "test_gemm_universal_util.hpp"
using I4 = ck::pk_i4_t;
using F8 = ck::f8_t;
using F16 = ck::half_t;
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
using I4 = ck::pk_i4_t;
using F8 = ck::f8_t;
using F16 = ck::half_t;
using F32 = float;
@@ -99,3 +100,19 @@ TYPED_TEST_SUITE(TestGemmUniversal_FP16_KM_NK, KernelTypes_KM_NK);
TYPED_TEST_SUITE(TestGemmUniversal_FP16_KM_KN, KernelTypes_KM_KN);
#include "test_gemm_universal_ut_cases_fp16.inc"
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

@@ -6,7 +6,8 @@
#include "gtest/gtest.h"
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "test_gemm_universal_util.hpp"
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
#if defined(CK_USE_WMMA_FP8)
using F8 = ck::f8_t;
@@ -59,3 +60,19 @@ TYPED_TEST_SUITE(TestGemmUniversal_FP8_MK_NK, KernelTypes_MK_NK);
#include "test_gemm_universal_ut_cases_fp8.inc"
#endif // CK_USE_WMMA_FP8
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

@@ -6,9 +6,10 @@
#include "gtest/gtest.h"
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "test_gemm_universal_util.hpp"
using BF16 = ck::bhalf_t;
using F32 = float;
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
using BF16 = ck::bhalf_t;
using F32 = float;
using Row = ck::tensor_layout::gemm::RowMajor;
using Col = ck::tensor_layout::gemm::ColumnMajor;
@@ -80,3 +81,19 @@ TYPED_TEST_SUITE(TestGemmUniversal_BF16_KM_KN, KernelTypes_KM_KN);
TYPED_TEST_SUITE(TestGemmUniversal_BF16_KM_NK, KernelTypes_KM_NK);
#include "test_gemm_universal_ut_cases_bf16.inc"
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

@@ -6,9 +6,10 @@
#include "gtest/gtest.h"
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "test_gemm_universal_util.hpp"
using F8 = ck::f8_t;
using F16 = ck::half_t;
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
using F8 = ck::f8_t;
using F16 = ck::half_t;
using F32 = float;
@@ -92,3 +93,19 @@ TYPED_TEST_SUITE(TestGemmUniversal_FP16_KM_NK, KernelTypes_KM_NK);
TYPED_TEST_SUITE(TestGemmUniversal_FP16_KM_KN, KernelTypes_KM_KN);
#include "test_gemm_universal_ut_cases_fp16.inc"
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

@@ -6,11 +6,12 @@
#include "gtest/gtest.h"
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "test_gemm_universal_util.hpp"
using F8 = ck::f8_t;
using F16 = ck::half_t;
using BF16 = ck::bhalf_t;
using F32 = float;
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
using F8 = ck::f8_t;
using F16 = ck::half_t;
using BF16 = ck::bhalf_t;
using F32 = float;
using Row = ck::tensor_layout::gemm::RowMajor;
using Col = ck::tensor_layout::gemm::ColumnMajor;
@@ -69,3 +70,19 @@ TYPED_TEST_SUITE(TestGemmUniversal_FP8_MK_NK, KernelTypes_MK_NK);
#include "test_gemm_universal_ut_cases_fp8.inc"
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

@@ -15,6 +15,9 @@
#include "include/ck/utility/data_type.hpp"
#include "profiler/profile_gemm_universal_streamk_impl.hpp"
extern ck::index_t param_mask;
extern ck::index_t instance_index;
namespace ck {
namespace test {
@@ -56,8 +59,13 @@ class TestGemmUniversal_Streamk : public testing::Test
const int StrideB,
const int StrideC)
{
for(auto streamk_sel : streamk_sel_list)
for(size_t i = 0; i < streamk_sel_list.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto streamk_sel = streamk_sel_list[i];
RunSingle(M, N, K, StrideA, StrideB, StrideC, streamk_sel, -1);
}
}
@@ -93,7 +101,8 @@ class TestGemmUniversal_Streamk : public testing::Test
streamk_sel,
Grid_size,
n_warmup,
n_iter);
n_iter,
instance_index);
EXPECT_TRUE(pass);
}
};

View File

@@ -7,6 +7,9 @@
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "test_gemm_universal_streamk_util.hpp"
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
using BF16 = ck::bhalf_t;
using F32 = float;
@@ -83,3 +86,19 @@ TYPED_TEST_SUITE(TestGemmUniversal_Streamk_BF16_KM_KN, KernelTypes_KM_KN);
TYPED_TEST_SUITE(TestGemmUniversal_Streamk_BF16_KM_NK, KernelTypes_KM_NK);
#include "test_gemm_universal_streamk_ut_cases_bf16.inc"
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

@@ -7,6 +7,9 @@
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "test_gemm_universal_streamk_util.hpp"
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
using F8 = ck::f8_t;
using F16 = ck::half_t;
@@ -82,3 +85,20 @@ TYPED_TEST_SUITE(TestGemmUniversal_Streamk_FP16_MK_KN, KernelTypes_MK_KN);
TYPED_TEST_SUITE(TestGemmUniversal_Streamk_FP16_MK_NK, KernelTypes_MK_NK);
#include "test_gemm_universal_streamk_ut_cases_fp16.inc"
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

@@ -7,6 +7,9 @@
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "test_gemm_universal_streamk_util.hpp"
ck::index_t param_mask = 0xffff;
ck::index_t instance_index = -1;
using F8 = ck::f8_t;
using F16 = ck::half_t;
using BF16 = ck::bhalf_t;
@@ -72,3 +75,19 @@ TYPED_TEST_SUITE(TestGemmUniversal_Streamk_FP8_MK_KN, KernelTypes_MK_KN);
TYPED_TEST_SUITE(TestGemmUniversal_Streamk_FP8_MK_NK, KernelTypes_MK_NK);
#include "test_gemm_universal_streamk_ut_cases_fp8.inc"
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

@@ -11,6 +11,9 @@
#include "profiler/profile_grouped_conv_bwd_data_impl.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestGroupedConvndBwdDataWmma : public ::testing::Test
{
@@ -27,20 +30,27 @@ class TestGroupedConvndBwdDataWmma : public ::testing::Test
{
EXPECT_FALSE(conv_params.empty());
bool pass = true;
for(auto& param : conv_params)
for(size_t i = 0; i < conv_params.size(); i++)
{
pass = pass && ck::profiler::profile_grouped_conv_bwd_data_impl<NDimSpatial,
OutLayout,
WeiLayout,
InLayout,
DataType,
DataType,
DataType>(
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = conv_params[i];
pass = pass && ck::profiler::profile_grouped_conv_bwd_data_impl<NDimSpatial,
OutLayout,
WeiLayout,
InLayout,
DataType,
DataType,
DataType>(
true, // do_verification
1, // init_method: integer value
false, // do_log
false, // time_kernel
param);
param,
1, // splitK
instance_index);
}
EXPECT_TRUE(pass);
}
@@ -106,3 +116,20 @@ TYPED_TEST(TestGroupedConvndBwdDataWmma3d, Test3D)
{3, 1, 1, 1, 1, {3, 3, 3}, {32, 32, 32}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}});
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

@@ -11,6 +11,9 @@
#include "profiler/profile_grouped_conv_bwd_data_impl.hpp"
static ck::index_t param_mask = 0xffffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestGroupedConvndBwdDataXdl : public ::testing::Test
{
@@ -30,21 +33,27 @@ class TestGroupedConvndBwdDataXdl : public ::testing::Test
bool pass = true;
for(auto split_k : split_ks)
{
for(auto& param : conv_params)
for(size_t i = 0; i < conv_params.size(); i++)
{
pass = pass && ck::profiler::profile_grouped_conv_bwd_data_impl<NDimSpatial,
OutLayout,
WeiLayout,
InLayout,
DataType,
DataType,
DataType>(
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = conv_params[i];
pass = pass && ck::profiler::profile_grouped_conv_bwd_data_impl<NDimSpatial,
OutLayout,
WeiLayout,
InLayout,
DataType,
DataType,
DataType>(
true, // do_verification
1, // init_method: integer value
false, // do_log
false, // time_kernel
param,
split_k);
split_k,
instance_index);
}
}
EXPECT_TRUE(pass);
@@ -149,3 +158,19 @@ TYPED_TEST(TestGroupedConvndBwdDataXdl3d, Test3D)
{3, 1, 1, 1, 1, {3, 3, 3}, {4, 16, 16}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}});
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

@@ -23,6 +23,8 @@
#include "ck/library/utility/convolution_host_tensor_descriptor_helper.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_conv_bwd_weight.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestGroupedConvndBwdWeight : public ::testing::Test
{
@@ -83,7 +85,8 @@ class TestGroupedConvndBwdWeight : public ::testing::Test
}
bool PerformConvWeightBilinear(ck::utils::conv::ConvParam& conv_param,
const ck::index_t split_k)
const ck::index_t split_k,
ck::index_t instance_index_ = -1)
{
bool passed = true;
@@ -163,6 +166,7 @@ class TestGroupedConvndBwdWeight : public ::testing::Test
// get device op instances
const auto op_ptrs = ck::tensor_operation::device::instance::DeviceOperationInstanceFactory<
DeviceOp>::GetInstances();
int num_kernel = 0;
for(std::size_t i = 0; i < op_ptrs.size(); ++i)
{
@@ -197,6 +201,12 @@ class TestGroupedConvndBwdWeight : public ::testing::Test
if(op_ptr->IsSupportedArgument(argument_ptr.get()))
{
++num_kernel;
if((instance_index_ != -1) && (instance_index_ + 1 != num_kernel))
{
// skip test if instance_index is specified
continue;
}
float avg_time = invoker_ptr->Run(argument_ptr.get(), StreamConfig{nullptr});
wei_device_buf.FromDevice(wei_device.mData.data());
passed &= ck::utils::check_err(wei_device, wei_host, "Error: incorrect results!");
@@ -218,6 +228,11 @@ class TestGroupedConvndBwdWeight : public ::testing::Test
std::cerr << op_name << " does not support this problem" << std::endl;
}
}
if(instance_index != -1)
{
std::cout << "grouped_conv_bwd_weight_instance (" << instance_index << "/" << num_kernel
<< "): Passed" << std::endl;
}
return passed;
}
@@ -228,9 +243,14 @@ class TestGroupedConvndBwdWeight : public ::testing::Test
for(auto split_k : split_ks)
{
for(auto& param : conv_params)
for(size_t i = 0; i < conv_params.size(); i++)
{
pass = pass && PerformConvWeightBilinear(param, split_k);
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = conv_params[i];
pass = pass && PerformConvWeightBilinear(param, split_k, instance_index);
}
}
EXPECT_TRUE(pass);
@@ -268,3 +288,20 @@ TYPED_TEST(TestGroupedConvndBwdWeight3d, Test3D)
{3, 1, 1, 4, 4, {3, 3, 3}, {14, 28, 28}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}});
this->Run();
}
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

@@ -15,6 +15,9 @@
#include "profiler/profile_grouped_conv_bwd_weight_impl.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
using namespace ck::tensor_layout::convolution;
template <typename Tuple>
@@ -92,8 +95,13 @@ class TestGroupedConvndBwdWeight : public ::testing::Test
for(auto split_k : split_ks)
{
for(auto& param : conv_params)
for(size_t i = 0; i < conv_params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = conv_params[i];
if(!skip_case(split_k))
{
pass = pass && ck::profiler::profile_grouped_conv_bwd_weight_impl<NDimSpatial{},
@@ -108,7 +116,8 @@ class TestGroupedConvndBwdWeight : public ::testing::Test
false, // do_log
false, // time_kernel
param,
std::to_string(split_k));
std::to_string(split_k),
instance_index);
}
}
}
@@ -224,3 +233,20 @@ TYPED_TEST(TestGroupedConvndBwdWeight3d, Test3D)
{3, 16, 16, 1, 1, {3, 3, 3}, {28, 28, 28}, {2, 2, 2}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}});
this->Run();
}
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

@@ -9,6 +9,9 @@
#include "profiler/profile_grouped_conv_fwd_impl.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestGroupedConvndFwd : public ::testing::Test
{
@@ -26,23 +29,30 @@ class TestGroupedConvndFwd : public ::testing::Test
{
EXPECT_FALSE(conv_params.empty());
bool pass = true;
for(auto& param : conv_params)
for(size_t i = 0; i < conv_params.size(); i++)
{
pass = pass && ck::profiler::profile_grouped_conv_fwd_impl<NDimSpatial,
InLayout,
WeiLayout,
OutLayout,
DataType,
DataType,
DataType,
DataType,
DataType,
IndexType>(
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = conv_params[i];
pass = pass && ck::profiler::profile_grouped_conv_fwd_impl<NDimSpatial,
InLayout,
WeiLayout,
OutLayout,
DataType,
DataType,
DataType,
DataType,
DataType,
IndexType>(
true, // do_verification
1, // init_method: integer value
false, // do_log
false, // time_kernel
param);
param,
ck::tensor_operation::element_wise::PassThrough{},
instance_index);
}
EXPECT_TRUE(pass);
}
@@ -148,3 +158,20 @@ TYPED_TEST(TestGroupedConvndFwd3d, Test3D)
{3, 96, 1, 1, 1, {3, 3, 3}, {4, 30, 160}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}});
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

@@ -11,7 +11,9 @@
#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp"
using BiasNormalizeInInferClamp = ck::tensor_operation::element_wise::BiasNormalizeInInferClamp;
static ck::index_t param_mask = 0xffffff;
static ck::index_t instance_index = -1;
using BiasNormalizeInInferClamp = ck::tensor_operation::element_wise::BiasNormalizeInInferClamp;
template <typename Tuple>
class TestGroupedConvndFwd : public ::testing::Test
@@ -30,8 +32,13 @@ class TestGroupedConvndFwd : public ::testing::Test
{
EXPECT_FALSE(conv_params.empty());
bool pass = true;
for(auto& param : conv_params)
for(size_t i = 0; i < conv_params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = conv_params[i];
pass = pass && ck::profiler::profile_grouped_conv_fwd_bias_clamp_impl<NDimSpatial,
InLayout,
WeiLayout,
@@ -47,7 +54,8 @@ class TestGroupedConvndFwd : public ::testing::Test
1, // init_method: integer value
false, // do_log
false, // time_kernel
param);
param,
instance_index);
}
EXPECT_TRUE(pass);
}
@@ -95,3 +103,19 @@ TYPED_TEST(TestGroupedConvndFwd3d, Test3D)
{3, 2, 32, 128, 256, {3, 3, 3}, {14, 14, 3}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}});
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,8 +10,9 @@
#include "profiler/profile_grouped_conv_fwd_bias_clamp_impl.hpp"
#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp"
using AddClamp = ck::tensor_operation::element_wise::AddClamp;
static ck::index_t param_mask = 0xffffff;
static ck::index_t instance_index = -1;
using AddClamp = ck::tensor_operation::element_wise::AddClamp;
template <typename Tuple>
class TestGroupedConvndFwd : public ::testing::Test
@@ -30,8 +31,13 @@ class TestGroupedConvndFwd : public ::testing::Test
{
EXPECT_FALSE(conv_params.empty());
bool pass = true;
for(auto& param : conv_params)
for(size_t i = 0; i < conv_params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = conv_params[i];
pass = pass && ck::profiler::profile_grouped_conv_fwd_bias_clamp_impl<NDimSpatial,
InLayout,
WeiLayout,
@@ -47,7 +53,8 @@ class TestGroupedConvndFwd : public ::testing::Test
1, // init_method: integer value
false, // do_log
false, // time_kernel
param);
param,
instance_index);
}
EXPECT_TRUE(pass);
}
@@ -95,3 +102,19 @@ TYPED_TEST(TestGroupedConvndFwd3d, Test3D)
{3, 2, 32, 128, 256, {3, 3, 3}, {14, 14, 3}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}});
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,8 +10,9 @@
#include "profiler/profile_grouped_conv_fwd_bias_clamp_impl.hpp"
#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp"
using AddClamp = ck::tensor_operation::element_wise::AddClamp;
static ck::index_t param_mask = 0xffffff;
static ck::index_t instance_index = -1;
using AddClamp = ck::tensor_operation::element_wise::AddClamp;
template <typename Tuple>
class TestGroupedConvndFwd : public ::testing::Test
@@ -30,8 +31,13 @@ class TestGroupedConvndFwd : public ::testing::Test
{
EXPECT_FALSE(conv_params.empty());
bool pass = true;
for(auto& param : conv_params)
for(size_t i = 0; i < conv_params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = conv_params[i];
pass = pass && ck::profiler::profile_grouped_conv_fwd_bias_clamp_impl<NDimSpatial,
InLayout,
WeiLayout,
@@ -47,7 +53,8 @@ class TestGroupedConvndFwd : public ::testing::Test
1, // init_method: integer value
false, // do_log
false, // time_kernel
param);
param,
instance_index);
}
EXPECT_TRUE(pass);
}
@@ -133,3 +140,19 @@ TYPED_TEST(TestGroupedConvndFwdBiasClamp3d, Test3D)
{1, 1, 1}});
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,8 +10,9 @@
#include "profiler/profile_grouped_conv_fwd_impl.hpp"
#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp"
using Clamp = ck::tensor_operation::element_wise::Clamp;
static ck::index_t param_mask = 0xffffff;
static ck::index_t instance_index = -1;
using Clamp = ck::tensor_operation::element_wise::Clamp;
template <typename Tuple>
class TestGroupedConvndFwd : public ::testing::Test
@@ -31,25 +32,31 @@ class TestGroupedConvndFwd : public ::testing::Test
EXPECT_FALSE(conv_params.empty());
bool pass = true;
Clamp out_element_op{0.f, 256.f};
for(auto& param : conv_params)
for(size_t i = 0; i < conv_params.size(); i++)
{
pass = pass && ck::profiler::profile_grouped_conv_fwd_impl<NDimSpatial,
InLayout,
WeiLayout,
OutLayout,
DataType,
DataType,
DataType,
DataType,
DataType,
IndexType,
Clamp>(
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = conv_params[i];
pass = pass && ck::profiler::profile_grouped_conv_fwd_impl<NDimSpatial,
InLayout,
WeiLayout,
OutLayout,
DataType,
DataType,
DataType,
DataType,
DataType,
IndexType,
Clamp>(
true, // do_verification
1, // init_method: integer value
false, // do_log
false, // time_kernel
param,
out_element_op);
out_element_op,
instance_index);
}
EXPECT_TRUE(pass);
}
@@ -97,3 +104,19 @@ TYPED_TEST(TestGroupedConvndFwd3d, Test3D)
{3, 2, 32, 128, 256, {3, 3, 3}, {14, 14, 3}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}});
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,8 +10,9 @@
#include "profiler/profile_grouped_conv_fwd_bias_bnorm_clamp_impl.hpp"
#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp"
using BiasNormalizeInInferClamp = ck::tensor_operation::element_wise::BiasNormalizeInInferClamp;
static ck::index_t param_mask = 0xffffff;
static ck::index_t instance_index = -1;
using BiasNormalizeInInferClamp = ck::tensor_operation::element_wise::BiasNormalizeInInferClamp;
template <typename Tuple>
class TestGroupedConvndFwd : public ::testing::Test
@@ -30,9 +31,14 @@ class TestGroupedConvndFwd : public ::testing::Test
{
EXPECT_FALSE(conv_params.empty());
bool pass = true;
for(auto& param : conv_params)
for(size_t i = 0; i < conv_params.size(); i++)
{
pass = pass &&
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = conv_params[i];
pass = pass &&
ck::profiler::profile_grouped_conv_fwd_bias_clamp_impl<NDimSpatial,
InLayout,
WeiLayout,
@@ -48,7 +54,8 @@ class TestGroupedConvndFwd : public ::testing::Test
1, // init_method: integer value
false, // do_log
false, // time_kernel
param);
param,
instance_index);
}
EXPECT_TRUE(pass);
}
@@ -96,3 +103,19 @@ TYPED_TEST(TestGroupedConvndFwd3d, Test3D)
{3, 2, 32, 128, 256, {3, 3, 3}, {14, 14, 3}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}});
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,8 +10,9 @@
#include "profiler/profile_grouped_conv_fwd_bias_clamp_impl.hpp"
#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp"
using AddClamp = ck::tensor_operation::element_wise::AddClamp;
static ck::index_t param_mask = 0xffffff;
static ck::index_t instance_index = -1;
using AddClamp = ck::tensor_operation::element_wise::AddClamp;
template <typename Tuple>
class TestGroupedConvndFwd : public ::testing::Test
@@ -47,7 +48,8 @@ class TestGroupedConvndFwd : public ::testing::Test
1, // init_method: integer value
false, // do_log
false, // time_kernel
param);
param,
instance_index);
}
EXPECT_TRUE(pass);
}
@@ -95,3 +97,19 @@ TYPED_TEST(TestGroupedConvndFwd3d, Test3D)
{3, 2, 32, 128, 256, {3, 3, 3}, {14, 14, 3}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}});
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 "gtest/gtest.h"
#include "test_grouped_gemm_util.hpp"
ck::index_t param_mask = 0xffffff;
ck::index_t instance_index = -1;
using F16 = ck::half_t;
using BF16 = ck::bhalf_t;
using F8 = ck::f8_t;
@@ -42,3 +45,19 @@ using KernelTypes = ::testing::Types<
TYPED_TEST_SUITE(TestGroupedGemm, KernelTypes);
#include "test_grouped_gemm_ut_cases.inc"
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

@@ -23,6 +23,9 @@
#include "ck/utility/number.hpp"
#include "profiler/profile_grouped_gemm_impl.hpp"
extern ck::index_t param_mask;
extern ck::index_t instance_index;
namespace ck {
namespace test {
@@ -109,8 +112,16 @@ class TestGroupedGemm : public testing::Test
{
SetStrides<ELayout>(stride_cs, Ms, Ns);
}
std::vector<int> k_batches;
for(size_t i = 0; i < k_batches_.size(); i++)
{
if(param_mask & (1 << i))
{
k_batches.push_back(k_batches_[i]);
}
}
RunSingle(Ms, Ns, Ks, stride_as, stride_bs, stride_cs, k_batches_);
RunSingle(Ms, Ns, Ks, stride_as, stride_bs, stride_cs, k_batches);
}
void RunSingle(const std::vector<int>& Ms,
@@ -139,7 +150,8 @@ class TestGroupedGemm : public testing::Test
StrideCs,
kbatches,
n_warmup_,
n_iter_);
n_iter_,
instance_index);
EXPECT_TRUE(pass);
}
};

View File

@@ -56,10 +56,27 @@ __host__ void cpu_magic_number_division(uint32_t magic_multiplier,
}
}
int main(int, char*[])
int main(int argc, char* argv[])
{
uint64_t num_divisor = 4096;
uint64_t num_dividend = 1L << 16;
uint64_t num_divisor = 4096;
uint64_t num_dividend = 1L << 16;
uint32_t divisor_start = 0;
uint32_t divisor_end = num_divisor;
if(argc == 1)
{
// use default range
}
else if(argc == 3)
{
divisor_start = std::stoi(argv[1]);
divisor_end = std::stoi(argv[2]);
}
else
{
std::cerr << "arg1 to 2: divisor_start divisor_end" << std::endl;
return 1;
}
std::vector<int32_t> divisors_host(num_divisor);
std::vector<int32_t> dividends_host(num_dividend);
@@ -90,6 +107,10 @@ int main(int, char*[])
for(std::size_t i = 0; i < num_divisor; ++i)
{
if(i < divisor_start || i > divisor_end)
{
continue;
}
// run naive division on GPU
gpu_naive_division<<<1024, 256>>>(
divisors_host[i],

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();
}

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 TestLayernorm2dBwdGammaBeta : public ::testing::Test
{
@@ -25,8 +28,13 @@ class TestLayernorm2dBwdGammaBeta : 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++)
{
if((length_mask & (1 << i)) == 0)
{
continue;
}
auto length = lengths[i];
bool success = ck::profiler::profile_layernorm_bwd_gamma_beta_impl<DYDataType,
XDataType,
MeanInvStdDataType,
@@ -34,7 +42,7 @@ class TestLayernorm2dBwdGammaBeta : public ::testing::Test
DGammaDataType,
DBetaDataType,
2>(
true, 2, false, false, length);
true, 2, false, false, length, instance_index);
EXPECT_TRUE(success);
}
}
@@ -46,3 +54,20 @@ using KernelTypes = ::testing::Types<
TYPED_TEST_SUITE(TestLayernorm2dBwdGammaBeta, KernelTypes);
TYPED_TEST(TestLayernorm2dBwdGammaBeta, 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 TestGroupnorm : public ::testing::Test
{
@@ -31,16 +34,21 @@ class TestGroupnorm : public ::testing::Test
{2, 32, 32, 32, 40},
{1, 16, 16, 32, 40}};
for(auto length : lengths)
for(size_t i = 0; i < lengths.size(); i++)
{
bool success =
ck::profiler::profile_groupnorm_impl<XDataType,
GammaDataType,
BetaDataType,
ComputeDataType,
YDataType,
SaveMeanInvStdDataType,
true>(true, 2, false, false, length);
if((length_mask & (1 << i)) == 0)
{
continue;
}
auto length = lengths[i];
bool success = ck::profiler::profile_groupnorm_impl<XDataType,
GammaDataType,
BetaDataType,
ComputeDataType,
YDataType,
SaveMeanInvStdDataType,
true>(
true, 2, false, false, length, instance_index);
EXPECT_TRUE(success);
}
}
@@ -52,3 +60,20 @@ using KernelTypes = ::testing::Types<
TYPED_TEST_SUITE(TestGroupnorm, KernelTypes);
TYPED_TEST(TestGroupnorm, Test_FP16) { 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 TestGroupnorm : public ::testing::Test
{
@@ -29,16 +32,21 @@ class TestGroupnorm : 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++)
{
bool success =
ck::profiler::profile_groupnorm_impl<XDataType,
GammaDataType,
BetaDataType,
ComputeDataType,
YDataType,
SaveMeanInvStdDataType,
true>(true, 2, false, false, length);
if((length_mask & (1 << i)) == 0)
{
continue;
}
auto length = lengths[i];
bool success = ck::profiler::profile_groupnorm_impl<XDataType,
GammaDataType,
BetaDataType,
ComputeDataType,
YDataType,
SaveMeanInvStdDataType,
true>(
true, 2, false, false, length, instance_index);
EXPECT_TRUE(success);
}
}
@@ -50,3 +58,20 @@ using KernelTypes = ::testing::Types<
TYPED_TEST_SUITE(TestGroupnorm, KernelTypes);
TYPED_TEST(TestGroupnorm, 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 TestLayernorm2d : public ::testing::Test
{
@@ -25,8 +28,13 @@ class TestLayernorm2d : 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++)
{
if((length_mask & (1 << i)) == 0)
{
continue;
}
auto length = lengths[i];
bool success = ck::profiler::profile_layernorm_impl<XDataType,
GammaDataType,
BetaDataType,
@@ -34,7 +42,8 @@ class TestLayernorm2d : public ::testing::Test
YDataType,
SaveMeanInvStdDataType,
true,
2>(true, 2, false, false, length);
2>(
true, 2, false, false, length, instance_index);
EXPECT_TRUE(success);
}
}
@@ -46,3 +55,19 @@ using KernelTypes = ::testing::Types<
TYPED_TEST_SUITE(TestLayernorm2d, KernelTypes);
TYPED_TEST(TestLayernorm2d, Test_FP16) { 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 TestLayernorm2d : public ::testing::Test
{
@@ -25,8 +28,13 @@ class TestLayernorm2d : 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++)
{
if((length_mask & (1 << i)) == 0)
{
continue;
}
auto length = lengths[i];
bool success = ck::profiler::profile_layernorm_impl<XDataType,
GammaDataType,
BetaDataType,
@@ -34,7 +42,8 @@ class TestLayernorm2d : public ::testing::Test
YDataType,
SaveMeanInvStdDataType,
true,
2>(true, 2, false, false, length);
2>(
true, 2, false, false, length, instance_index);
EXPECT_TRUE(success);
}
}
@@ -46,3 +55,19 @@ using KernelTypes = ::testing::Types<
TYPED_TEST_SUITE(TestLayernorm2d, KernelTypes);
TYPED_TEST(TestLayernorm2d, 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 TestLayernorm4d : public ::testing::Test
{
@@ -25,8 +28,13 @@ class TestLayernorm4d : public ::testing::Test
std::vector<std::vector<ck::index_t>> lengths = {
{1, 1, 1, 1}, {7, 7, 7, 7}, {256, 16, 16, 8}};
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_layernorm_impl<XDataType,
GammaDataType,
BetaDataType,
@@ -34,7 +42,8 @@ class TestLayernorm4d : public ::testing::Test
YDataType,
SaveMeanInvStdDataType,
true,
4>(true, 2, false, false, length);
4>(
true, 2, false, false, length, instance_index);
EXPECT_TRUE(success);
}
}
@@ -46,3 +55,19 @@ using KernelTypes = ::testing::Types<
TYPED_TEST_SUITE(TestLayernorm4d, KernelTypes);
TYPED_TEST(TestLayernorm4d, Test_FP16) { 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

@@ -5,6 +5,9 @@
#include "profiler/profile_avg_pool2d_bwd_impl.hpp"
#include "test_pool_fwd_common.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename T>
class AvgPool2dBWDTest : public ::testing::Test
{
@@ -16,8 +19,13 @@ class AvgPool2dBWDTest : public ::testing::Test
void Run()
{
for(auto param : this->params)
for(size_t i = 0; i < this->params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = this->params[i];
bool success =
ck::profiler::profile_avg_pool2d_bwd_impl<InDataType, OutDataType, NHWC, NHWC>(
true,
@@ -29,7 +37,8 @@ class AvgPool2dBWDTest : public ::testing::Test
param.window_strides_,
param.window_dilations_,
param.input_left_pads_,
param.input_right_pads_);
param.input_right_pads_,
instance_index);
EXPECT_TRUE(success);
}
}
@@ -131,3 +140,20 @@ TYPED_TEST(AvgPool2D_f16, AvgPool2DTest_f16) { this->Run(); }
TYPED_TEST(AvgPool2D_bf16, AvgPool2DTest_bf16) { this->Run(); }
TYPED_TEST(AvgPool2D_f8, AvgPool2DTest_f8) { this->Run(); }
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

@@ -5,6 +5,9 @@
#include "profiler/profile_pool2d_fwd_impl.hpp"
#include "test_pool_fwd_common.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestAvgPool2dFwd : public ::testing::Test
{
@@ -18,8 +21,13 @@ class TestAvgPool2dFwd : public ::testing::Test
void Run()
{
for(auto param : params)
for(size_t i = 0; i < this->params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = this->params[i];
bool success =
ck::profiler::profile_pool2d_fwd_impl<InDataType,
OutDataType,
@@ -38,7 +46,8 @@ class TestAvgPool2dFwd : public ::testing::Test
param.window_strides_,
param.window_dilations_,
param.input_left_pads_,
param.input_right_pads_);
param.input_right_pads_,
instance_index);
EXPECT_TRUE(success);
}
}
@@ -143,3 +152,19 @@ TYPED_TEST(AvgPool2D_F16, AvgPool2D_F16_Test) { this->Run(); }
TYPED_TEST(AvgPool2D_BF16, AvgPool2D_BF16_Test) { this->Run(); }
TYPED_TEST(AvgPool2D_I8, AvgPool2D_I8_Test) { this->Run(); }
TYPED_TEST(AvgPool2D_F8, AvgPool2D_F8_Test) { this->Run(); }
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

@@ -5,6 +5,9 @@
#include "profiler/profile_avg_pool3d_bwd_impl.hpp"
#include "test_pool_fwd_common.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestAvgPool3dBwd : public ::testing::Test
{
@@ -19,8 +22,13 @@ class TestAvgPool3dBwd : public ::testing::Test
void Run()
{
for(auto param : params)
for(size_t i = 0; i < this->params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = this->params[i];
bool success =
ck::profiler::profile_avg_pool3d_bwd_impl<DOutDataType,
DInDataType,
@@ -35,7 +43,8 @@ class TestAvgPool3dBwd : public ::testing::Test
param.window_strides_,
param.window_dilations_,
param.input_left_pads_,
param.input_right_pads_);
param.input_right_pads_,
instance_index);
EXPECT_TRUE(success);
}
}
@@ -72,3 +81,19 @@ TYPED_TEST(TestAvgPool3dBwd, Test_Pool)
this->Run();
}
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

@@ -5,6 +5,9 @@
#include "profiler/profile_pool3d_fwd_impl.hpp"
#include "test_pool_fwd_common.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestAvgPool3dFwd : public ::testing::Test
{
@@ -20,8 +23,13 @@ class TestAvgPool3dFwd : public ::testing::Test
void Run()
{
for(auto param : params)
for(size_t i = 0; i < this->params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = this->params[i];
ck::profiler::PoolFwdKernelParams kernel_params{param.length_,
param.window_spatial_lengths_,
param.window_strides_,
@@ -38,7 +46,8 @@ class TestAvgPool3dFwd : public ::testing::Test
ck::tensor_layout::convolution::NDHWC,
ck::ReduceTensorOp::AVG,
false,
false>(in_params_avg_pool, kernel_params);
false>(
in_params_avg_pool, kernel_params, instance_index);
EXPECT_TRUE(success);
}
}
@@ -61,3 +70,19 @@ TYPED_TEST(TestAvgPool3dFwd, Test_Pool)
this->Run();
}
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

@@ -5,6 +5,9 @@
#include "profiler/profile_max_pool2d_bwd_impl.hpp"
#include "test_pool_fwd_common.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename T>
class MaxPool2dBWDTest : public ::testing::Test
{
@@ -20,8 +23,13 @@ class MaxPool2dBWDTest : public ::testing::Test
void Run()
{
for(auto param : this->params)
for(size_t i = 0; i < this->params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = this->params[i];
bool success =
ck::profiler::profile_max_pool2d_bwd_impl<InDataType,
OutDataType,
@@ -37,7 +45,8 @@ class MaxPool2dBWDTest : public ::testing::Test
param.window_strides_,
param.window_dilations_,
param.input_left_pads_,
param.input_right_pads_);
param.input_right_pads_,
instance_index);
EXPECT_TRUE(success);
}
}
@@ -137,3 +146,20 @@ TYPED_TEST(MaxPool2D_f16, MaxPool2DTest_f16) { this->Run(); }
TYPED_TEST(MaxPool2D_bf16, MaxPool2DTest_bf16) { this->Run(); }
TYPED_TEST(MaxPool2D_f8, MaxPool2DTest_f8) { this->Run(); }
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

@@ -5,6 +5,9 @@
#include "profiler/profile_pool2d_fwd_impl.hpp"
#include "test_pool_fwd_common.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestMaxPool2dFwd : public ::testing::Test
{
@@ -19,8 +22,13 @@ class TestMaxPool2dFwd : public ::testing::Test
void Run()
{
for(auto param : params)
for(size_t i = 0; i < this->params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = this->params[i];
// max pool
bool success =
ck::profiler::profile_pool2d_fwd_impl<InDataType,
@@ -40,7 +48,8 @@ class TestMaxPool2dFwd : public ::testing::Test
param.window_strides_,
param.window_dilations_,
param.input_left_pads_,
param.input_right_pads_);
param.input_right_pads_,
instance_index);
EXPECT_TRUE(success);
}
}
@@ -148,3 +157,20 @@ TYPED_TEST(MaxPool2D_F16, MaxPool2D_F16_Test) { this->Run(); }
TYPED_TEST(MaxPool2D_BF16, MaxPool2D_BF16_Test) { this->Run(); }
TYPED_TEST(MaxPool2D_I8, MaxPool2D_I8_Test) { this->Run(); }
TYPED_TEST(MaxPool2D_F8, MaxPool2D_F8_Test) { this->Run(); }
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

@@ -5,6 +5,9 @@
#include "profiler/profile_max_pool3d_bwd_impl.hpp"
#include "test_pool_fwd_common.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestMaxPool3dBwd : public ::testing::Test
{
@@ -20,8 +23,13 @@ class TestMaxPool3dBwd : public ::testing::Test
void Run()
{
for(auto param : params)
for(size_t i = 0; i < this->params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = this->params[i];
bool success =
ck::profiler::profile_max_pool3d_bwd_impl<InDataType,
OutDataType,
@@ -37,7 +45,8 @@ class TestMaxPool3dBwd : public ::testing::Test
param.window_strides_,
param.window_dilations_,
param.input_left_pads_,
param.input_right_pads_);
param.input_right_pads_,
instance_index);
EXPECT_TRUE(success);
}
}
@@ -77,3 +86,20 @@ TYPED_TEST(TestMaxPool3dBwd, Test_Pool)
this->Run();
}
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

@@ -5,6 +5,9 @@
#include "profiler/profile_pool3d_fwd_impl.hpp"
#include "test_pool_fwd_common.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
template <typename Tuple>
class TestMaxPool3dFwd : public ::testing::Test
{
@@ -21,8 +24,14 @@ class TestMaxPool3dFwd : public ::testing::Test
void Run()
{
for(auto param : params)
for(size_t i = 0; i < this->params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = this->params[i];
ck::profiler::PoolFwdKernelParams kernel_params{param.length_,
param.window_spatial_lengths_,
param.window_strides_,
@@ -40,7 +49,8 @@ class TestMaxPool3dFwd : public ::testing::Test
ck::tensor_layout::convolution::NDHWC,
ck::ReduceTensorOp::MAX,
false,
false>(in_params_max_pool, kernel_params);
false>(
in_params_max_pool, kernel_params, instance_index);
EXPECT_TRUE(success);
// max pool + index
@@ -52,8 +62,8 @@ class TestMaxPool3dFwd : public ::testing::Test
ck::tensor_layout::convolution::NDHWC,
ck::ReduceTensorOp::MAX,
false,
true>(in_params_max_pool_indexed,
kernel_params);
true>(
in_params_max_pool_indexed, kernel_params, instance_index);
EXPECT_TRUE(success);
}
}
@@ -76,3 +86,20 @@ TYPED_TEST(TestMaxPool3dFwd, Test_Pool)
this->Run();
}
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

@@ -8,6 +8,9 @@
#include <gtest/gtest.h>
using namespace ck;
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
struct ReduceParam
{
bool do_verification{true};
@@ -53,8 +56,13 @@ class ReduceWithIndexTest : public ::testing::Test
template <ReduceTensorOp ReduceOpIdType>
void Run()
{
for(auto param : this->params)
for(size_t i = 0; i < this->params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = this->params[i];
bool success = ck::profiler::profile_reduce_impl<InDataType, AccDataType, OutDataType>(
param.do_verification,
param.init_method,
@@ -66,7 +74,8 @@ class ReduceWithIndexTest : public ::testing::Test
param.propagateNan,
param.useIndex,
param.alpha,
param.beta);
param.beta,
instance_index);
EXPECT_TRUE(success);
}
}
@@ -201,3 +210,20 @@ TYPED_TEST(ReduceWithNoIndexBHalfFloat, ReduceWithNoIndexTestBHalfFloat_MAX)
// trigger Run() -> Generic
this->template Run<ReduceTensorOp::MAX>();
}
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

@@ -8,6 +8,9 @@
#include <gtest/gtest.h>
using namespace ck;
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
struct ReduceParam
{
bool do_verification{true};
@@ -53,8 +56,13 @@ class ReduceWithIndexTest : public ::testing::Test
template <ReduceTensorOp ReduceOpIdType>
void Run()
{
for(auto param : this->params)
for(size_t i = 0; i < this->params.size(); i++)
{
if((param_mask & (1 << i)) == 0)
{
continue;
}
auto& param = this->params[i];
bool success = ck::profiler::profile_reduce_impl<InDataType, AccDataType, OutDataType>(
param.do_verification,
param.init_method,
@@ -66,7 +74,8 @@ class ReduceWithIndexTest : public ::testing::Test
param.propagateNan,
param.useIndex,
param.alpha,
param.beta);
param.beta,
instance_index);
EXPECT_TRUE(success);
}
}
@@ -201,3 +210,20 @@ TYPED_TEST(ReduceWithIndexBHalfFloat, ReduceWithIndexTestBHalfFloat_MAX)
// trigger Run() -> Generic
this->template Run<ReduceTensorOp::MAX>();
}
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

@@ -58,3 +58,20 @@ TYPED_TEST(TestSoftmax, ReduceOddLengths)
this->Run({this->Rank - 1});
this->Run({this->Rank - 2});
}
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

@@ -15,6 +15,9 @@
#include "include/ck/utility/data_type.hpp"
#include "profiler/profile_softmax_impl.hpp"
static ck::index_t param_mask = 0xffff;
static ck::index_t instance_index = -1;
namespace ck {
template <typename Range>
@@ -56,7 +59,8 @@ class TestSoftmax : public ::testing::Test
void RunSingle(std::vector<index_t> in_length,
std::vector<index_t> reduce_dims,
AccDataType alpha,
AccDataType beta)
AccDataType beta,
index_t instance_index)
{
int init_method = 1; // integer value initialization
bool log = false;
@@ -67,84 +71,98 @@ class TestSoftmax : public ::testing::Test
{
if(reduce_dims.size() == 1)
pass = ck::profiler::
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 1>(verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta);
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 1>(
verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta,
instance_index);
else if(reduce_dims.size() == 2)
pass = ck::profiler::
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 2>(verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta);
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 2>(
verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta,
instance_index);
else if(reduce_dims.size() == 3)
pass = ck::profiler::
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 3>(verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta);
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 3>(
verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta,
instance_index);
}
else if constexpr(Rank == 4)
{
if(reduce_dims.size() == 1)
pass = ck::profiler::
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 1>(verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta);
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 1>(
verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta,
instance_index);
else if(reduce_dims.size() == 2)
pass = ck::profiler::
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 2>(verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta);
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 2>(
verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta,
instance_index);
else if(reduce_dims.size() == 3)
pass = ck::profiler::
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 3>(verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta);
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 3>(
verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta,
instance_index);
else if(reduce_dims.size() == 4)
pass = ck::profiler::
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 4>(verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta);
profile_softmax_impl<InDataType, AccDataType, OutDataType, Rank, 4>(
verify_,
init_method,
log,
bench_,
in_length,
strides,
reduce_dims,
alpha,
beta,
instance_index);
};
EXPECT_TRUE(pass);
@@ -161,7 +179,7 @@ class TestSoftmax : public ::testing::Test
{
for(auto scale : this->scales_)
{
this->RunSingle(in_length, reduce_dims, scale[0], scale[1]);
this->RunSingle(in_length, reduce_dims, scale[0], scale[1], instance_index);
}
}
}