CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
81 lines
1.9 KiB
C++
81 lines
1.9 KiB
C++
// Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#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});
|
|
}
|
|
|
|
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();
|
|
}
|