From 790facd1e19e56798fee7b7241af9d62a8e079fe Mon Sep 17 00:00:00 2001 From: Mateusz Ozga <110818320+mozga-amd@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:28:10 +0200 Subject: [PATCH] Rewrite *sh reduce unit tests to gtest: part 1 (#1407) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Rewrite .sh test to Gtest * review chnages * Removew unused comments * Review v2 * Typo * Separete UT: AMAX, MAX, MIN; added template params to trigger them * Update test/reduce/reduce_no_index.cpp --------- Co-authored-by: Bartłomiej Kocot [ROCm/composable_kernel commit: ab60b390f892052cee5ccbd68464caecec6981d9] --- script/test_reduce_with_index.sh | 63 ----- test/reduce/CMakeLists.txt | 4 +- test/reduce/reduce_no_index.cpp | 425 +++++++++++++----------------- test/reduce/reduce_with_index.cpp | 425 +++++++++++++----------------- 4 files changed, 382 insertions(+), 535 deletions(-) delete mode 100755 script/test_reduce_with_index.sh diff --git a/script/test_reduce_with_index.sh b/script/test_reduce_with_index.sh deleted file mode 100755 index b0843ba6c1..0000000000 --- a/script/test_reduce_with_index.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -## The following will be used for CI - -set -x - -## for float -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,2,3 0 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,2 0 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,3 0 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,2,3 0 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 1,2,3 0 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0 0 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 1 0 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 2 0 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 3 0 2 - -## for float64 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,2,3 6 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,2 6 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,3 6 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,2,3 6 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 1,2,3 6 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0 6 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 1 6 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 2 6 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 3 6 2 - -## for float16 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,2,3 1 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,2 1 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,3 1 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,2,3 1 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 1,2,3 1 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0 1 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 1 1 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 2 1 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 3 1 2 - -## for int8_t -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,2,3 3 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,2 3 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,3 3 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,2,3 3 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 1,2,3 3 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0 3 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 1 3 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 2 3 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 3 3 2 - -## for bfloat16 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,2,3 5 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,2 5 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,1,3 5 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0,2,3 5 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 1,2,3 5 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 0 5 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 1 5 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 2 5 2 -bin/test_reduce_with_index -D 64,4,280,82 -R 3 5 2 - -set +x - diff --git a/test/reduce/CMakeLists.txt b/test/reduce/CMakeLists.txt index fabaf7cc54..bf05795063 100644 --- a/test/reduce/CMakeLists.txt +++ b/test/reduce/CMakeLists.txt @@ -1,5 +1,5 @@ -add_test_executable(test_reduce_no_index reduce_no_index.cpp) -add_test_executable(test_reduce_with_index reduce_with_index.cpp) +add_gtest_executable(test_reduce_no_index reduce_no_index.cpp) +add_gtest_executable(test_reduce_with_index reduce_with_index.cpp) target_link_libraries(test_reduce_no_index PRIVATE utility device_reduce_instance) target_link_libraries(test_reduce_with_index PRIVATE utility device_reduce_instance) diff --git a/test/reduce/reduce_no_index.cpp b/test/reduce/reduce_no_index.cpp index 1ab452442d..9153805889 100644 --- a/test/reduce/reduce_no_index.cpp +++ b/test/reduce/reduce_no_index.cpp @@ -1,248 +1,203 @@ // SPDX-License-Identifier: MIT -// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved. +// Copyright (c) 2018-2024, Advanced Micro Devices, Inc. All rights reserved. #include #include "ck/library/utility/host_common_util.hpp" #include "profiler/profile_reduce_impl.hpp" - +#include using namespace ck; -static struct option long_options[] = {{"inLengths", required_argument, nullptr, 'D'}, - {"reduceDimensions", required_argument, nullptr, 'R'}, - {"scales", required_argument, nullptr, 'S'}, - {"help", no_argument, nullptr, '?'}, - {nullptr, 0, nullptr, 0}}; - -class SimpleAppArgs +struct ReduceParam { - private: - int option_index = 0; - - public: - std::vector inLengths; - std::vector reduceDims; - std::vector scales; - - int data_type; - int init_method = 1; - - public: - void show_usage(const char* cmd) - { - std::cout << "Usage of " << cmd << std::endl; - std::cout << "--inLengths or -D, comma separated list of input tensor dimension lengths " - "(only 4-d tensor supported)" - << std::endl; - std::cout << "--reduceDimensions or -R comma seperated list of dimension indexes to reduce " - "(only 1 or 3 or 4 dimensions supported)" - << std::endl; - std::cout << "--scales or -S, comma separated two float values for alpha and beta" - << std::endl; - std::cout << "Arg1 -- data type (0: fp16, 1: fp32, 3: int8, 5: bp16, 6: fp64)" << std::endl; - std::cout << "Arg2 -- init method(0=no init, 1=single integer value, 2=scope integer " - "value, 3=decimal value)" - << std::endl; - }; - - int processArgs(int argc, char* argv[]) - { - using ck::host_common::getTypeValuesFromString; - - int ch; - - while(1) - { - ch = getopt_long(argc, argv, "D:R:S:", long_options, &option_index); - if(ch == -1) - break; - switch(ch) - { - case 'D': - if(!optarg) - throw std::runtime_error("Invalid option format!"); - - inLengths = getTypeValuesFromString(optarg); - break; - case 'R': - if(!optarg) - throw std::runtime_error("Invalid option format!"); - - reduceDims = getTypeValuesFromString(optarg); - break; - case 'S': - if(!optarg) - throw std::runtime_error("Invalid option format!"); - - scales = getTypeValuesFromString(optarg); - break; - case '?': - if(std::string(long_options[option_index].name) == "help") - { - show_usage(argv[0]); - return (-1); - }; - break; - default: show_usage(argv[0]); return (-1); - }; - }; - - if(optind + 2 > argc) - throw std::runtime_error("Invalid cmd-line arguments, more argumetns are needed!"); - - data_type = std::atoi(argv[optind++]); - init_method = std::atoi(argv[optind]); - - if(scales.empty()) - { - scales.push_back(1.0f); - scales.push_back(0.0f); - }; - - if(inLengths.size() != 4 || - (reduceDims.size() != 1 && reduceDims.size() != 3 && reduceDims.size() != 4)) - return (-1); - - if(data_type != 0 && data_type != 1 && data_type != 3 && data_type != 5 && data_type != 6) - return (-1); - - return (0); - }; + bool do_verification{true}; + bool propagateNan{false}; + bool useIndex{false}; + bool time_kernel{false}; + bool do_dumpout{false}; + int init_method{2}; + float alpha{1.0f}; + float beta{0.0f}; + std::vector inLengths{64, 4, 280, 82}; + std::vector reduceDims{0, 1, 2, 3}; }; -bool test_reduce_no_index(int data_type, - int init_method, - std::vector reduceDims, - std::vector inLengths, - ReduceTensorOp reduceOpId, - bool propagateNan, - float alpha, - float beta) +std::vector> SetGenericReduceDim() { - using ck::profiler::profile_reduce_impl; - - bool result = true; - - if(data_type == 0) - { - result = profile_reduce_impl(true, - init_method, - false, - false, - inLengths, - reduceDims, - reduceOpId, - propagateNan, - false, - alpha, - beta); - } - else if(data_type == 1) - { - result = profile_reduce_impl(true, - init_method, - false, - false, - inLengths, - reduceDims, - reduceOpId, - propagateNan, - false, - alpha, - beta); - } - else if(data_type == 3) - { - result = profile_reduce_impl(true, - init_method, - false, - false, - inLengths, - reduceDims, - reduceOpId, - propagateNan, - false, - alpha, - beta); - } - else if(data_type == 5) - { - result = profile_reduce_impl(true, - init_method, - false, - false, - inLengths, - reduceDims, - reduceOpId, - propagateNan, - false, - alpha, - beta); - } - else if(data_type == 6) - { - result = profile_reduce_impl(true, - init_method, - false, - false, - inLengths, - reduceDims, - reduceOpId, - propagateNan, - false, - alpha, - beta); - } - - return (result); -}; - -constexpr ReduceTensorOp reduceOpId = ReduceTensorOp::AVG; -constexpr bool propagateNan = false; - -int main(int argc, char* argv[]) -{ - SimpleAppArgs args; - - bool result = true; - - if(argc == 1) - { - int data_type = 1; - int init_method = 2; - std::vector inLengths{64, 4, 280, 80}; - std::vector> v_reduceDims{ - {0, 1, 2, 3}, {0, 1, 2}, {1, 2, 3}, {0, 1, 3}, {0, 2, 3}, {0}, {1}, {2}, {3}}; - - for(auto& reduceDims : v_reduceDims) - result = result && test_reduce_no_index(data_type, - init_method, - reduceDims, - inLengths, - reduceOpId, - propagateNan, - 1.0f, - 0.0f); - } - else - { - if(args.processArgs(argc, argv) < 0) - { - throw std::runtime_error( - "Invalid input arguments, test_reduce_no_index could not be executed!"); - }; - - result = test_reduce_no_index(args.data_type, - args.init_method, - args.reduceDims, - args.inLengths, - reduceOpId, - propagateNan, - args.scales[0], - args.scales[1]); - } - - std::cout << "test_reduce_no_index ..... " << (result ? "SUCCESS" : "FAILURE") << std::endl; - - return (result ? 0 : -1); + return {{0, 1, 2, 3}, {0, 1, 2}, {0, 1, 3}, {0, 2, 3}, {1, 2, 3}, {0}, {1}, {2}, {3}}; +} + +template +class ReduceWithIndexTest : public ::testing::Test +{ + protected: + using InDataType = std::tuple_element_t<0, T>; + using AccDataType = std::tuple_element_t<1, T>; + using OutDataType = std::tuple_element_t<2, T>; + + static std::vector params; + + static void SetUpTestSuite() + { + // set testcase variables + ReduceParam set; + const auto setReduceDim = SetGenericReduceDim(); + + for(std::size_t i(0); i < setReduceDim.size(); ++i) + { + set.reduceDims = setReduceDim[i]; + params.emplace_back(set); + } + } + + template + void Run() + { + for(auto param : this->params) + { + bool success = ck::profiler::profile_reduce_impl( + param.do_verification, + param.init_method, + param.do_dumpout, + param.time_kernel, + param.inLengths, + param.reduceDims, + ReduceOpIdType, + param.propagateNan, + param.useIndex, + param.alpha, + param.beta); + EXPECT_TRUE(success); + } + } +}; + +template +std::vector ReduceWithIndexTest::params = {}; + +using Reduce_float_types = ::testing::Types>; +using Reduce_double_types = ::testing::Types>; +using Reduce_int8t_types = ::testing::Types>; +using Reduce_half_types = ::testing::Types>; +using Reduce_bhalf_float_Types = ::testing::Types>; + +template +class ReduceWithNoIndexFloat : public ReduceWithIndexTest +{ +}; + +template +class ReduceWithNoIndexDouble : public ReduceWithIndexTest +{ +}; + +template +class ReduceWithNoIndexInt8 : public ReduceWithIndexTest +{ +}; + +template +class ReduceWithNoIndexHalf : public ReduceWithIndexTest +{ +}; + +template +class ReduceWithNoIndexBHalfFloat : public ReduceWithIndexTest +{ +}; + +TYPED_TEST_SUITE(ReduceWithNoIndexFloat, Reduce_float_types); +TYPED_TEST_SUITE(ReduceWithNoIndexDouble, Reduce_double_types); +TYPED_TEST_SUITE(ReduceWithNoIndexInt8, Reduce_int8t_types); +TYPED_TEST_SUITE(ReduceWithNoIndexHalf, Reduce_half_types); +TYPED_TEST_SUITE(ReduceWithNoIndexBHalfFloat, Reduce_bhalf_float_Types); + +TYPED_TEST(ReduceWithNoIndexFloat, ReduceWithNoIndexTestFloat_AMAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexFloat, ReduceWithNoIndexTestFloat_MIN) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexFloat, ReduceWithNoIndexTestFloat_MAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexDouble, ReduceWithNoIndexTestDouble_AMAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexDouble, ReduceWithNoIndexTestDouble_MIN) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexDouble, ReduceWithNoIndexTestDouble_MAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexInt8, ReduceWithNoIndexTestInt8_AMAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexInt8, ReduceWithNoIndexTestInt8_MIN) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexInt8, ReduceWithNoIndexTestInt8_MAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexHalf, ReduceWithNoIndexTestHalf_AMAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexHalf, ReduceWithNoIndexTestHalf_MIN) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexHalf, ReduceWithNoIndexTestHalf_MAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexBHalfFloat, ReduceWithNoIndexTesBtHalfFloat_AMAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexBHalfFloat, ReduceWithNoIndexTestBHalfFloat_MIN) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithNoIndexBHalfFloat, ReduceWithNoIndexTestBHalfFloat_MAX) +{ + // trigger Run() -> Generic + this->template Run(); } diff --git a/test/reduce/reduce_with_index.cpp b/test/reduce/reduce_with_index.cpp index 0301669c5a..796211a69a 100644 --- a/test/reduce/reduce_with_index.cpp +++ b/test/reduce/reduce_with_index.cpp @@ -1,248 +1,203 @@ // SPDX-License-Identifier: MIT -// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved. +// Copyright (c) 2018-2024, Advanced Micro Devices, Inc. All rights reserved. #include #include "ck/library/utility/host_common_util.hpp" #include "profiler/profile_reduce_impl.hpp" - +#include using namespace ck; -static struct option long_options[] = {{"inLengths", required_argument, nullptr, 'D'}, - {"reduceDimensions", required_argument, nullptr, 'R'}, - {"scales", required_argument, nullptr, 'S'}, - {"help", no_argument, nullptr, '?'}, - {nullptr, 0, nullptr, 0}}; - -class SimpleAppArgs +struct ReduceParam { - private: - int option_index = 0; - - public: - std::vector inLengths; - std::vector reduceDims; - std::vector scales; - - int data_type; - int init_method = 1; - - public: - void show_usage(const char* cmd) - { - std::cout << "Usage of " << cmd << std::endl; - std::cout << "--inLengths or -D, comma separated list of input tensor dimension lengths " - "(only 4-d tensor supported)" - << std::endl; - std::cout << "--reduceDimensions or -R comma seperated list of dimension indexes to reduce " - "(only 1 or 3 or 4 dimensions supported)" - << std::endl; - std::cout << "--scales or -S, comma separated two float values for alpha and beta" - << std::endl; - std::cout << "Arg1 -- data type (1: fp32, 3: int8, 5: bp16, 6: fp64)" << std::endl; - std::cout << "Arg2 -- init method(0=no init, 1=single integer value, 2=scope integer " - "value, 3=decimal value)" - << std::endl; - }; - - int processArgs(int argc, char* argv[]) - { - using ck::host_common::getTypeValuesFromString; - - int ch; - - while(1) - { - ch = getopt_long(argc, argv, "D:R:S:", long_options, &option_index); - if(ch == -1) - break; - switch(ch) - { - case 'D': - if(!optarg) - throw std::runtime_error("Invalid option format!"); - - inLengths = getTypeValuesFromString(optarg); - break; - case 'R': - if(!optarg) - throw std::runtime_error("Invalid option format!"); - - reduceDims = getTypeValuesFromString(optarg); - break; - case 'S': - if(!optarg) - throw std::runtime_error("Invalid option format!"); - - scales = getTypeValuesFromString(optarg); - break; - case '?': - if(std::string(long_options[option_index].name) == "help") - { - show_usage(argv[0]); - return (-1); - }; - break; - default: show_usage(argv[0]); return (-1); - }; - }; - - if(optind + 2 > argc) - throw std::runtime_error("Invalid cmd-line arguments, more argumetns are needed!"); - - data_type = std::atoi(argv[optind++]); - init_method = std::atoi(argv[optind]); - - if(scales.empty()) - { - scales.push_back(1.0f); - scales.push_back(0.0f); - }; - - if(inLengths.size() != 4 || - (reduceDims.size() != 1 && reduceDims.size() != 3 && reduceDims.size() != 4)) - return (-1); - - if(data_type != 0 && data_type != 1 && data_type != 3 && data_type != 5 && data_type != 6) - return (-1); - - return (0); - }; + bool do_verification{true}; + bool propagateNan{false}; + bool useIndex{false}; + bool time_kernel{false}; + bool do_dumpout{false}; + int init_method{2}; + float alpha{1.0f}; + float beta{0.0f}; + std::vector inLengths{64, 4, 280, 82}; + std::vector reduceDims{0, 1, 2, 3}; }; -bool test_reduce_with_index(int data_type, - int init_method, - std::vector reduceDims, - std::vector inLengths, - ReduceTensorOp reduceOpId, - bool propagateNan, - float alpha, - float beta) +std::vector> SetGenericReduceDim() { - using ck::profiler::profile_reduce_impl; - - bool result = true; - - if(data_type == 0) - { - result = profile_reduce_impl(true, - init_method, - false, - false, - inLengths, - reduceDims, - reduceOpId, - propagateNan, - true, - alpha, - beta); - } - else if(data_type == 1) - { - result = profile_reduce_impl(true, - init_method, - false, - false, - inLengths, - reduceDims, - reduceOpId, - propagateNan, - true, - alpha, - beta); - } - else if(data_type == 3) - { - result = profile_reduce_impl(true, - init_method, - false, - false, - inLengths, - reduceDims, - reduceOpId, - propagateNan, - true, - alpha, - beta); - } - else if(data_type == 5) - { - result = profile_reduce_impl(true, - init_method, - false, - false, - inLengths, - reduceDims, - reduceOpId, - propagateNan, - true, - alpha, - beta); - } - else if(data_type == 6) - { - result = profile_reduce_impl(true, - init_method, - false, - false, - inLengths, - reduceDims, - reduceOpId, - propagateNan, - true, - alpha, - beta); - } - - return (result); -}; - -constexpr ReduceTensorOp reduceOpId = ReduceTensorOp::AMAX; -constexpr bool propagateNan = false; - -int main(int argc, char* argv[]) -{ - SimpleAppArgs args; - - bool result = true; - - if(argc == 1) - { - int data_type = 1; - int init_method = 2; - std::vector inLengths{64, 4, 280, 80}; - std::vector> v_reduceDims{ - {0, 1, 2, 3}, {0, 1, 2}, {1, 2, 3}, {0, 1, 3}, {0, 2, 3}, {0}, {1}, {2}, {3}}; - - for(auto& reduceDims : v_reduceDims) - result = result && test_reduce_with_index(data_type, - init_method, - reduceDims, - inLengths, - reduceOpId, - propagateNan, - 1.0f, - 0.0f); - } - else - { - if(args.processArgs(argc, argv) < 0) - { - throw std::runtime_error( - "Invalid input arguments, test_reduce_with_index could not be executed!"); - }; - - result = test_reduce_with_index(args.data_type, - args.init_method, - args.reduceDims, - args.inLengths, - reduceOpId, - propagateNan, - args.scales[0], - args.scales[1]); - } - - std::cout << "test_reduce_with_index ..... " << (result ? "SUCCESS" : "FAILURE") << std::endl; - - return (result ? 0 : -1); + return {{0, 1, 2, 3}, {0, 1, 2}, {0, 1, 3}, {0, 2, 3}, {1, 2, 3}, {0}, {1}, {2}, {3}}; +} + +template +class ReduceWithIndexTest : public ::testing::Test +{ + protected: + using InDataType = std::tuple_element_t<0, T>; + using AccDataType = std::tuple_element_t<1, T>; + using OutDataType = std::tuple_element_t<2, T>; + + static std::vector params; + + static void SetUpTestSuite() + { + // set testcase variables + ReduceParam set; + const auto setReduceDim = SetGenericReduceDim(); + + for(std::size_t i(0); i < setReduceDim.size(); ++i) + { + set.reduceDims = setReduceDim[i]; + params.emplace_back(set); + } + } + + template + void Run() + { + for(auto param : this->params) + { + bool success = ck::profiler::profile_reduce_impl( + param.do_verification, + param.init_method, + param.do_dumpout, + param.time_kernel, + param.inLengths, + param.reduceDims, + ReduceOpIdType, + param.propagateNan, + param.useIndex, + param.alpha, + param.beta); + EXPECT_TRUE(success); + } + } +}; + +template +std::vector ReduceWithIndexTest::params = {}; + +using Reduce_float_types = ::testing::Types>; +using Reduce_double_types = ::testing::Types>; +using Reduce_int8t_types = ::testing::Types>; +using Reduce_half_types = ::testing::Types>; +using Reduce_bhalf_float_Types = ::testing::Types>; + +template +class ReduceWithIndexFloat : public ReduceWithIndexTest +{ +}; + +template +class ReduceWithIndexDouble : public ReduceWithIndexTest +{ +}; + +template +class ReduceWithIndexInt8 : public ReduceWithIndexTest +{ +}; + +template +class ReduceWithIndexHalf : public ReduceWithIndexTest +{ +}; + +template +class ReduceWithIndexBHalfFloat : public ReduceWithIndexTest +{ +}; + +TYPED_TEST_SUITE(ReduceWithIndexFloat, Reduce_float_types); +TYPED_TEST_SUITE(ReduceWithIndexDouble, Reduce_double_types); +TYPED_TEST_SUITE(ReduceWithIndexInt8, Reduce_int8t_types); +TYPED_TEST_SUITE(ReduceWithIndexHalf, Reduce_half_types); +TYPED_TEST_SUITE(ReduceWithIndexBHalfFloat, Reduce_bhalf_float_Types); + +TYPED_TEST(ReduceWithIndexFloat, ReduceWithIndexTestFloat_AMAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexFloat, ReduceWithIndexTestFloat_MIN) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexFloat, ReduceWithIndexTestFloat_MAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexDouble, ReduceWithIndexTestDouble_AMAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexDouble, ReduceWithIndexTestDouble_MIN) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexDouble, ReduceWithIndexTestDouble_MAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexInt8, ReduceWithIndexTestInt8_AMAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexInt8, ReduceWithIndexTestInt8_MIN) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexInt8, ReduceWithIndexTestInt8_MAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexHalf, ReduceWithIndexTestHalf_AMAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexHalf, ReduceWithIndexTestHalf_MIN) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexHalf, ReduceWithIndexTestHalf_MAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexBHalfFloat, ReduceWithIndexTesBtHalfFloat_AMAX) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexBHalfFloat, ReduceWithIndexTestBHalfFloat_MIN) +{ + // trigger Run() -> Generic + this->template Run(); +} + +TYPED_TEST(ReduceWithIndexBHalfFloat, ReduceWithIndexTestBHalfFloat_MAX) +{ + // trigger Run() -> Generic + this->template Run(); }