From 0860461d626f8cd42a443335c0764925f8195e9c Mon Sep 17 00:00:00 2001 From: Paul Fultz II Date: Wed, 11 Dec 2024 08:06:13 -0600 Subject: [PATCH] Add reduce section for verify tests (#3677) --- test/verify/CMakeLists.txt | 2 +- test/verify/test_arg_ops.cpp | 2 ++ test/verify/test_block_reduce_small.cpp | 2 ++ test/verify/test_instancenorm.cpp | 6 ++++- test/verify/test_layernorm.cpp | 24 +++++++++++++++++++ test/verify/test_logsoftmax.cpp | 2 ++ test/verify/test_logsoftmax1.cpp | 4 +++- .../test_pointwise_broadcast_reduce.cpp | 2 ++ test/verify/test_reduce_add.cpp | 2 ++ test/verify/test_reduce_mean_bias_half.cpp | 4 +++- test/verify/test_reduce_mean_large_half.cpp | 4 +++- test/verify/test_reduce_mean_nhwc.cpp | 2 ++ test/verify/test_reduce_mean_reduce_sum.cpp | 2 ++ test/verify/test_reduce_mean_variance.cpp | 2 ++ test/verify/test_reduce_noop_add.cpp | 4 +++- test/verify/test_reduce_op_large.cpp | 2 ++ test/verify/test_reduce_op_small.cpp | 2 ++ test/verify/test_select_module_reduce.cpp | 4 +++- test/verify/test_softmax.cpp | 2 ++ test/verify/test_softmax1.cpp | 4 +++- test/verify/test_softmax2.cpp | 4 +++- test/verify/test_softmax3.cpp | 4 +++- test/verify/test_softmax4.cpp | 4 +++- test/verify/test_softmax_large1.cpp | 4 +++- test/verify/test_softmax_large2.cpp | 4 +++- test/verify/test_softmax_large3.cpp | 4 +++- .../test_softmaxcrossentropyloss_2d.cpp | 2 ++ .../test_softmaxcrossentropyloss_2d_mean.cpp | 2 ++ .../test_softmaxcrossentropyloss_2d_sum.cpp | 2 ++ .../test_softmaxcrossentropyloss_kd.cpp | 2 ++ .../test_softmaxcrossentropyloss_kd_mean.cpp | 2 ++ .../test_softmaxcrossentropyloss_kd_sum.cpp | 2 ++ 32 files changed, 100 insertions(+), 14 deletions(-) diff --git a/test/verify/CMakeLists.txt b/test/verify/CMakeLists.txt index 3e45e9bc3a9..bd57abea883 100644 --- a/test/verify/CMakeLists.txt +++ b/test/verify/CMakeLists.txt @@ -31,7 +31,7 @@ target_link_libraries(test_verify migraphx migraphx_all_targets) target_include_directories(test_verify PUBLIC ../include) rocm_clang_tidy_check(test_verify) -foreach(SECTION general rnn conv gemm) +foreach(SECTION general reduce rnn conv gemm) rocm_add_test(NAME test_verify_${SECTION} COMMAND test_verify ${SECTION}) set_tests_properties(test_verify_${SECTION} PROPERTIES COST 100 diff --git a/test/verify/test_arg_ops.cpp b/test/verify/test_arg_ops.cpp index ac52da56a23..674e8cb8969 100644 --- a/test/verify/test_arg_ops.cpp +++ b/test/verify/test_arg_ops.cpp @@ -57,6 +57,8 @@ struct test_arg_ops : verify_programadd_instruction(T{Axis, LastIndex}, param); return p; } + + std::string section() const { return "reduce"; } }; // transpose argmax tests template struct test_arg_ops; diff --git a/test/verify/test_block_reduce_small.cpp b/test/verify/test_block_reduce_small.cpp index 0ef4f4bc824..c97e5b7002d 100644 --- a/test/verify/test_block_reduce_small.cpp +++ b/test/verify/test_block_reduce_small.cpp @@ -46,6 +46,8 @@ struct test_block_reduce_small : verify_program> mm->add_return({add}); return p; }; + + std::string section() const { return "reduce"; } }; template diff --git a/test/verify/test_instancenorm.cpp b/test/verify/test_instancenorm.cpp index 5f4a551b1a1..77a5541fbae 100644 --- a/test/verify/test_instancenorm.cpp +++ b/test/verify/test_instancenorm.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -75,6 +75,8 @@ struct test_instancenorm : verify_program> add_instancenorm(*mm, x, {1, 2, 1, 1}); return p; } + + std::string section() const { return "reduce"; } }; template struct test_instancenorm; template struct test_instancenorm; @@ -91,6 +93,8 @@ struct test_instancenorm_large_3d : verify_program; diff --git a/test/verify/test_layernorm.cpp b/test/verify/test_layernorm.cpp index 1468c6054f9..725834bad1e 100644 --- a/test/verify/test_layernorm.cpp +++ b/test/verify/test_layernorm.cpp @@ -40,6 +40,8 @@ struct test_layernorm : verify_program add_layernorm(*mm, x, dims); return p; } + + std::string section() const { return "reduce"; } }; struct test_layernorm2 : verify_program @@ -53,6 +55,8 @@ struct test_layernorm2 : verify_program add_layernorm(*mm, x, dims); return p; } + + std::string section() const { return "reduce"; } }; struct test_layernorm_large : verify_program @@ -66,6 +70,8 @@ struct test_layernorm_large : verify_program add_layernorm(*mm, x, dims); return p; } + + std::string section() const { return "reduce"; } }; struct test_layernorm_fp16 : verify_program @@ -79,6 +85,8 @@ struct test_layernorm_fp16 : verify_program add_layernorm(*mm, x, dims); return p; } + + std::string section() const { return "reduce"; } }; struct test_layernorm_fp8_1 : verify_program @@ -92,6 +100,8 @@ struct test_layernorm_fp8_1 : verify_program add_layernorm(*mm, x, dims); return p; } + + std::string section() const { return "reduce"; } }; struct test_layernorm_fp8_2 : verify_program @@ -105,6 +115,8 @@ struct test_layernorm_fp8_2 : verify_program add_layernorm(*mm, x, dims); return p; } + + std::string section() const { return "reduce"; } }; struct test_layernorm_fp8_3 : verify_program @@ -118,6 +130,8 @@ struct test_layernorm_fp8_3 : verify_program add_layernorm(*mm, x, dims); return p; } + + std::string section() const { return "reduce"; } }; struct test_layernorm_fp8_4 : verify_program @@ -131,6 +145,8 @@ struct test_layernorm_fp8_4 : verify_program add_layernorm(*mm, x, dims); return p; } + + std::string section() const { return "reduce"; } }; struct test_layernorm_eps : verify_program @@ -144,6 +160,8 @@ struct test_layernorm_eps : verify_program add_layernorm(*mm, x, dims, 1e-5f); return p; } + + std::string section() const { return "reduce"; } }; struct test_layernorm_triadd : verify_program @@ -161,6 +179,8 @@ struct test_layernorm_triadd : verify_program add_layernorm(*mm, add2, dims); return p; } + + std::string section() const { return "reduce"; } }; struct test_layernorm_triadd_large : verify_program @@ -178,6 +198,8 @@ struct test_layernorm_triadd_large : verify_program add_layernorm(*mm, add2, dims); return p; } + + std::string section() const { return "reduce"; } }; struct test_add_layernorm_add_gemm_nonstd : verify_program @@ -210,4 +232,6 @@ struct test_pw_layernorm : verify_program add_pointwise_layernorm(*mm, x, dims); return p; } + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_logsoftmax.cpp b/test/verify/test_logsoftmax.cpp index 0586227a7c7..afa1ec43aa1 100644 --- a/test/verify/test_logsoftmax.cpp +++ b/test/verify/test_logsoftmax.cpp @@ -40,6 +40,8 @@ struct test_logsoftmax : verify_program> return p; } + + std::string section() const { return "reduce"; } }; template struct test_logsoftmax<0, migraphx::shape::float_type>; diff --git a/test/verify/test_logsoftmax1.cpp b/test/verify/test_logsoftmax1.cpp index a51a83e832b..d6a9daf83b5 100644 --- a/test/verify/test_logsoftmax1.cpp +++ b/test/verify/test_logsoftmax1.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -40,4 +40,6 @@ struct test_logsoftmax1 : verify_program mm->add_return({r}); return p; } + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_pointwise_broadcast_reduce.cpp b/test/verify/test_pointwise_broadcast_reduce.cpp index ffcc658838b..c0269625457 100644 --- a/test/verify/test_pointwise_broadcast_reduce.cpp +++ b/test/verify/test_pointwise_broadcast_reduce.cpp @@ -52,4 +52,6 @@ struct test_pointwise_broadcast_reduce : verify_programadd_return({reshape}); return p; }; + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_reduce_add.cpp b/test/verify/test_reduce_add.cpp index c0e2b5ddf93..f1d8d6f3fd3 100644 --- a/test/verify/test_reduce_add.cpp +++ b/test/verify/test_reduce_add.cpp @@ -47,6 +47,8 @@ struct test_reduce_add : verify_program> mm->add_return({add}); return p; }; + + std::string section() const { return "reduce"; } }; template struct test_reduce_add; diff --git a/test/verify/test_reduce_mean_bias_half.cpp b/test/verify/test_reduce_mean_bias_half.cpp index c83d7565de7..e70d9dc1dc4 100644 --- a/test/verify/test_reduce_mean_bias_half.cpp +++ b/test/verify/test_reduce_mean_bias_half.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -45,4 +45,6 @@ struct test_reduce_mean_bias_half : verify_program mm->add_return({sqrt}); return p; }; + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_reduce_mean_large_half.cpp b/test/verify/test_reduce_mean_large_half.cpp index f8925dbe577..5e40f9e9229 100644 --- a/test/verify/test_reduce_mean_large_half.cpp +++ b/test/verify/test_reduce_mean_large_half.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -38,4 +38,6 @@ struct test_reduce_mean_large_half : verify_program mm->add_instruction(migraphx::make_op("reduce_mean", {{"axes", {2}}}), x); return p; }; + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_reduce_mean_nhwc.cpp b/test/verify/test_reduce_mean_nhwc.cpp index 5ba5f617cde..275c7d218d3 100644 --- a/test/verify/test_reduce_mean_nhwc.cpp +++ b/test/verify/test_reduce_mean_nhwc.cpp @@ -43,6 +43,8 @@ struct test_reduce_mean_nhwc : verify_program> mm->add_return({sqrt}); return p; }; + + std::string section() const { return "reduce"; } }; template struct test_reduce_mean_nhwc; diff --git a/test/verify/test_reduce_mean_reduce_sum.cpp b/test/verify/test_reduce_mean_reduce_sum.cpp index 9dd29f8cffe..b5df0f0147a 100644 --- a/test/verify/test_reduce_mean_reduce_sum.cpp +++ b/test/verify/test_reduce_mean_reduce_sum.cpp @@ -51,4 +51,6 @@ struct test_reduce_mean_reduce_sum : verify_program mm->add_return({mean_div2}); return p; }; + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_reduce_mean_variance.cpp b/test/verify/test_reduce_mean_variance.cpp index dccd74a84c3..6843ae7e459 100644 --- a/test/verify/test_reduce_mean_variance.cpp +++ b/test/verify/test_reduce_mean_variance.cpp @@ -45,4 +45,6 @@ struct test_reduce_mean_variance : verify_program mm->add_return({add}); return p; }; + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_reduce_noop_add.cpp b/test/verify/test_reduce_noop_add.cpp index 9e642da2f71..c72d7f967f0 100644 --- a/test/verify/test_reduce_noop_add.cpp +++ b/test/verify/test_reduce_noop_add.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -45,4 +45,6 @@ struct test_reduce_noop_add : verify_program mm->add_return({add}); return p; }; + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_reduce_op_large.cpp b/test/verify/test_reduce_op_large.cpp index 473c762d23a..edcd550ef66 100644 --- a/test/verify/test_reduce_op_large.cpp +++ b/test/verify/test_reduce_op_large.cpp @@ -45,6 +45,8 @@ struct test_reduce_op_large : verify_program> mm->add_instruction(Op{{Axis}}, x); return p; }; + + std::string section() const { return "reduce"; } }; template struct test_reduce_op_large; diff --git a/test/verify/test_reduce_op_small.cpp b/test/verify/test_reduce_op_small.cpp index 2d47498aaec..b1d824f1c8a 100644 --- a/test/verify/test_reduce_op_small.cpp +++ b/test/verify/test_reduce_op_small.cpp @@ -45,6 +45,8 @@ struct test_reduce_op_small : verify_program> mm->add_instruction(Op{{Axis}}, x); return p; }; + + std::string section() const { return "reduce"; } }; template struct test_reduce_op_small; diff --git a/test/verify/test_select_module_reduce.cpp b/test/verify/test_select_module_reduce.cpp index aeffd90417e..5e3d8ad1d63 100644 --- a/test/verify/test_select_module_reduce.cpp +++ b/test/verify/test_select_module_reduce.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -66,4 +66,6 @@ struct test_select_module_reduce : verify_program return p; } + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_softmax.cpp b/test/verify/test_softmax.cpp index af9b02a2903..3d666a240ad 100644 --- a/test/verify/test_softmax.cpp +++ b/test/verify/test_softmax.cpp @@ -40,6 +40,8 @@ struct test_softmax : verify_program> return p; } + + std::string section() const { return "reduce"; } }; template struct test_softmax<0, migraphx::shape::float_type>; diff --git a/test/verify/test_softmax1.cpp b/test/verify/test_softmax1.cpp index 4742e03607a..ef8c71871bb 100644 --- a/test/verify/test_softmax1.cpp +++ b/test/verify/test_softmax1.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -37,4 +37,6 @@ struct test_softmax1 : verify_program mm->add_instruction(migraphx::make_op("softmax", {{"axis", 0}}), x); return p; } + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_softmax2.cpp b/test/verify/test_softmax2.cpp index 804f8f04f0b..c39dcec6c35 100644 --- a/test/verify/test_softmax2.cpp +++ b/test/verify/test_softmax2.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -38,4 +38,6 @@ struct test_softmax2 : verify_program mm->add_instruction(migraphx::make_op("softmax"), x); return p; } + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_softmax3.cpp b/test/verify/test_softmax3.cpp index 027c4d64ad3..c8ca6bc95ef 100644 --- a/test/verify/test_softmax3.cpp +++ b/test/verify/test_softmax3.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -41,4 +41,6 @@ struct test_softmax3 : verify_program mm->add_return({r}); return p; } + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_softmax4.cpp b/test/verify/test_softmax4.cpp index 73117df57c5..dae139227a8 100644 --- a/test/verify/test_softmax4.cpp +++ b/test/verify/test_softmax4.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -38,4 +38,6 @@ struct test_softmax4 : verify_program mm->add_instruction(migraphx::make_op("softmax", {{"axis", 3}}), x); return p; } + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_softmax_large1.cpp b/test/verify/test_softmax_large1.cpp index e8d98194da8..9669b095807 100644 --- a/test/verify/test_softmax_large1.cpp +++ b/test/verify/test_softmax_large1.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -40,4 +40,6 @@ struct test_softmax_large1 : verify_program mm->add_instruction(migraphx::make_op("softmax", {{"axis", -1}}), add); return p; } + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_softmax_large2.cpp b/test/verify/test_softmax_large2.cpp index c4311f6f819..12874f647b9 100644 --- a/test/verify/test_softmax_large2.cpp +++ b/test/verify/test_softmax_large2.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -40,4 +40,6 @@ struct test_softmax_large2 : verify_program mm->add_instruction(migraphx::make_op("softmax", {{"axis", -1}}), add); return p; } + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_softmax_large3.cpp b/test/verify/test_softmax_large3.cpp index d91bece8048..900d52ca90d 100644 --- a/test/verify/test_softmax_large3.cpp +++ b/test/verify/test_softmax_large3.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -40,4 +40,6 @@ struct test_softmax_large3 : verify_program mm->add_instruction(migraphx::make_op("softmax", {{"axis", -1}}), add); return p; } + + std::string section() const { return "reduce"; } }; diff --git a/test/verify/test_softmaxcrossentropyloss_2d.cpp b/test/verify/test_softmaxcrossentropyloss_2d.cpp index 5839a25020b..684975ea119 100644 --- a/test/verify/test_softmaxcrossentropyloss_2d.cpp +++ b/test/verify/test_softmaxcrossentropyloss_2d.cpp @@ -81,6 +81,8 @@ struct test_softmaxcrossentropyloss_2d return p; } + + std::string section() const { return "reduce"; } }; // template struct test_softmaxcrossentropyloss_2d