mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-12 09:16:52 +00:00
* Add reduction across all dims cases. * host softmax: handle all reduce * Test cases when reduced dim is not innermost axis. * Fix syntax. * Test non innermost dim for fp32 and int8 * Group test suites wrt NumReduceDim. * Additionally test failing cases. * Throw error when Rank or NumReduceDims doesn't match arguments. * Check reducedDims has correct values * Move don't reuse DeviceReduceMultiblock IsSupportedArgument method. Instead implement own. (in fact just get rid of one check to enable reduction across inner dimensions). * Reorganize unit tests to better cover use scenarios. * Test input validation * Test reduction of inner dimensions with custom op instances. * Refactor fp32 and int8 unit tests. * Fix FP32 instance template parameters. * Add more instances. * Instances with InSrcVectorDim=0. * Do not initialize and copy data when arg not supported. * ckProfiler Softmax use instance factory. * Refactor device softmax IsSupported. * Additionally add non-polymorphic api functions * Split softmax instances into multiple files. * Fix profiler. * Reorganize tests to reuse profiler and cover edge cases. * Clang-format * I8 Softmax instances along with UT. * Reuse type alias definitions from instance factory header. * Clean included headers * Fix variable names. * Add missing checks in Argument constructor. Co-authored-by: Adam Osewski <aosewski@amd.com> Co-authored-by: Anthony Chang <ac.chang@outlook.com>
61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
#pragma once
|
|
|
|
TYPED_TEST(TestSoftmax, ReduceOutermostDim)
|
|
{
|
|
std::vector<ck::index_t> reduce_dims{this->Rank - 1};
|
|
this->Run(reduce_dims);
|
|
}
|
|
|
|
TYPED_TEST(TestSoftmax, ReduceMiddleDim)
|
|
{
|
|
for(int dim = 0; dim < this->Rank - 1; ++dim)
|
|
{
|
|
std::vector<ck::index_t> reduce_dims{dim};
|
|
this->Run(reduce_dims);
|
|
}
|
|
}
|
|
|
|
TYPED_TEST(TestSoftmax, ReduceMultipleDimsWithOutermost)
|
|
{
|
|
for(int dim = 0; dim < this->Rank - 1; ++dim)
|
|
{
|
|
std::vector<ck::index_t> reduce_dims{dim, this->Rank - 1};
|
|
this->Run(reduce_dims);
|
|
}
|
|
}
|
|
|
|
TYPED_TEST(TestSoftmax, ReduceMultipleMiddleDims)
|
|
{
|
|
std::vector<ck::index_t> reduce_dims{0, 1};
|
|
if(this->Rank >= 3)
|
|
{
|
|
this->Run(reduce_dims);
|
|
}
|
|
|
|
if(this->Rank >= 4)
|
|
{
|
|
reduce_dims = std::vector<ck::index_t>{0, 2};
|
|
this->Run(reduce_dims);
|
|
reduce_dims = std::vector<ck::index_t>{0, 1, 2};
|
|
this->Run(reduce_dims);
|
|
}
|
|
}
|
|
|
|
TYPED_TEST(TestSoftmax, ReduceAllDims)
|
|
{
|
|
std::vector<ck::index_t> reduce_dims(this->Rank);
|
|
std::iota(std::begin(reduce_dims), std::end(reduce_dims), 0);
|
|
this->Run(reduce_dims);
|
|
}
|
|
|
|
TYPED_TEST(TestSoftmax, ReduceOddLengths)
|
|
{
|
|
this->in_lengths_ = {{3, 63, 1032}};
|
|
if(this->Rank >= 4)
|
|
{
|
|
this->in_lengths_ = {{1, 3, 63, 1032}};
|
|
}
|
|
this->Run({this->Rank - 1});
|
|
this->Run({this->Rank - 2});
|
|
}
|