From 89c8fe241342f9f09a283286eaac3eb109decb57 Mon Sep 17 00:00:00 2001 From: alecsandraBara Date: Sat, 13 May 2023 00:12:10 +0000 Subject: [PATCH 01/29] conv_2d_wrapper gtest --- test/gtest/conv_2d_wrapper.cpp | 104 +++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 test/gtest/conv_2d_wrapper.cpp diff --git a/test/gtest/conv_2d_wrapper.cpp b/test/gtest/conv_2d_wrapper.cpp new file mode 100644 index 0000000000..cb41b4211e --- /dev/null +++ b/test/gtest/conv_2d_wrapper.cpp @@ -0,0 +1,104 @@ +/******************************************************************************* +* +* MIT License +* +* Copyright (c) 2022 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +*******************************************************************************/ + +#include +#include +#include "conv_common.hpp" +#include "get_handle.hpp" + +template +struct conv2d_driver : conv_driver +{ + conv2d_driver() : conv_driver() + { + this->add(this->input_dims, "input"); + this->add(this->weight_tensor_dims, "weights"); + this->add(this->batch_size, + "batch_size", + this->generate_data_limited(this->get_batch_sizes(), 1)); + this->add(this->input_channels, + "input_channels", + this->generate_data_limited(this->get_input_channels(), 1, {32})); + this->add(this->output_channels, + "output_channels", + this->generate_data_limited(this->get_output_channels(), 1, {64})); + this->add(this->spatial_dim_elements, + "spatial_dim_elements", + this->generate_data_limited(this->get_2d_spatial_dims(), 1, {28, 28})); + this->add(this->filter_dims, + "filter_dims", + this->generate_data_limited(this->get_2d_filter_dims(), 2, {3, 3})); + this->add(this->pads_strides_dilations, + "pads_strides_dilations", + this->generate_data_limited(this->get_2d_pads_strides_dilations(), 2)); + this->add(this->trans_output_pads, + "trans_output_pads", + this->generate_data(this->get_2d_trans_output_pads())); + this->add(this->in_layout, "in_layout", this->generate_data({"NCHW"})); + this->add(this->fil_layout, "fil_layout", this->generate_data({"NCHW"})); + this->add(this->out_layout, "out_layout", this->generate_data({"NCHW"})); + this->add(this->deterministic, "deterministic", this->generate_data({false})); + this->add(this->tensor_vect, "tensor_vect", this->generate_data({0})); + this->add(this->vector_length, "vector_length", this->generate_data({1})); + // Only valid for int8 input and weights + this->add(this->output_type, "output_type", this->generate_data({"int32"})); + this->add(this->int8_vectorize, "int8_vectorize", this->generate_data({false})); + } +}; + +class MyTestSuite : public testing::TestWithParam {}; + +TEST_P(MyTestSuite, MyTest) +{ + std::cout << "Example Test Param: " << GetParam() << std::endl; + const auto& handle = get_handle(); + //std::cout << handle.GetDeviceName() << std::endl; + if(miopen::StartsWith(handle.GetDeviceName(),"gfx906")){ + std::cout << "gfx906" << std::endl; + GTEST_SKIP(); + } + + const auto param = GetParam(); + std::stringstream ss(param); + std::istream_iterator begin(ss); + std::istream_iterator end; + std::vector tokens(begin, end); + std::vector ptrs; + + for (std::string const& str : tokens) { + ptrs.push_back(str.data()); + //std::cout << str.data() << std::endl; + } + //std::cout << "PTR SIZE: " << ptrs.size() << std::endl; + + test_drive(ptrs.size(), ptrs.data()); + + +} + +INSTANTIATE_TEST_SUITE_P(MyGroup, MyTestSuite, + testing::Values("--disable-validation --verbose --input  1 8  10  10  --weights 8 8 3 3     --pads_strides_dilations 0 0 1 1 1 1 ", + "--disable-validation --verbose --input  32 160 73 73 --weights  64 160 1 1 --pads_strides_dilations 0 0 1 1 1 1")); From dc3b8b9a1e187a3175f8155ef954ee53f84e2e97 Mon Sep 17 00:00:00 2001 From: Alex Bara Date: Tue, 16 May 2023 10:14:32 -0500 Subject: [PATCH 02/29] pulling in env vars --- test/gtest/conv_2d_wrapper.cpp | 392 ++++++++++++++++++++++++++++++++- 1 file changed, 384 insertions(+), 8 deletions(-) diff --git a/test/gtest/conv_2d_wrapper.cpp b/test/gtest/conv_2d_wrapper.cpp index cb41b4211e..4907464de9 100644 --- a/test/gtest/conv_2d_wrapper.cpp +++ b/test/gtest/conv_2d_wrapper.cpp @@ -23,6 +23,7 @@ * SOFTWARE. * *******************************************************************************/ +#include #include #include @@ -69,19 +70,91 @@ struct conv2d_driver : conv_driver } }; -class MyTestSuite : public testing::TestWithParam {}; +class MyTestSuite : public testing::TestWithParam {}; +/* +set(MIOPEN_EMBED_TEST_ARG ${MIOPEN_TEST_FLOAT_ARG} --disable-validation --verbose) +# WORKAROUND for issue #874 +set(MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1 MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0) +set(MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1 MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0) +set(MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1W MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0 MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0) +# WORKAROUND for issue #1008 +set(MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2 MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0) +*/ -TEST_P(MyTestSuite, MyTest) -{ - std::cout << "Example Test Param: " << GetParam() << std::endl; - const auto& handle = get_handle(); - //std::cout << handle.GetDeviceName() << std::endl; +/* +env vars: +add_custom_test(test_conv_embed_db TEST_PERF_DB_RECORD_NOT_FOUND GFX908_DISABLED GFX90A_DISABLED +*/ + + + +TEST_P(MyTestSuite, MyTest) +{ + + //SKIP_UNLESS_COMPOSABLEKERNEL + //SKIP_UNLESS_ALL??? + //TEST_PERF_DB_RECORD_NOT_FOUND check + + + std::unordered_map env_vars = {}; + env_vars["MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2"] = "0"; + env_vars["MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1" = "0"; //F + env_vars["MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" = "0"; //W, FW + env_vars["GFX908_DISABLED" = "1"; + env_vars["GFX90A_DISABLED" = "1"; + env_vars["GFX94X_ENABLED" = "1"; + env_vars["GFX103X_ENABLED" = "1"; + env_vars["GFX110X_ENABLED" = "1"; + env_vars["HALF_ENABLED" = "1"; + env_vars["INT8_ENABLED" = "1"; + env_vars["OCL_DISABLED" = "1"; + + //IMPLICITGEMM_MLIR_ENV_BASE + env_vars["MIOPEN_FIND_MODE" = "normal"]; + env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"= "ConvMlirIgemmFwd"]; + env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"= "ConvMlirIgemmBwd"]; + env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"= "ConvMlirIgemmWrW"]; + env_vars["FIND_MODE" = "normal"]; //IMPLICITGEMM_MLIR_ENV_BASE + env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER" = "ConvMlirIgemmFwdXdlops"]; + env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER" = "ConvMlirIgemmBwdXdlops"]; + env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER" = "ConvMlirIgemmWrWXdlops"]; + + /* + env_vars["MIOPEN_DEBUG_" = ""; + */ + std::unordered_map xtra_args = {}; + xtra_args["MIOPEN_TEST_FLOAT_ARG"] = "--disable-validation --verbose" + + //MIOPEN_TEST_FLOAT_ARGS + + xtra_args["TEST_CONV_VERBOSE_F" = "--verbose --disable-backward-data --disable-backward-weights"]; + xtra_args["TEST_CONV_VERBOSE_B" = "--verbose --disable-forward --disable-backward-weights"]; + xtra_args["TEST_CONV_VERBOSE_W" = "--verbose --disable-forward --disable-backward-data"]; + xtra_args["MIOPEN_TEST_FLOAT_ARG" = "--disable-forward --disable-backward-data"]; + + std::cout << "Example Test Param: " << GetParam() << std::endl; + const auto& handle = get_handle(); + //std::cout << handle.GetDeviceName() << std::endl; if(miopen::StartsWith(handle.GetDeviceName(),"gfx906")){ std::cout << "gfx906" << std::endl; GTEST_SKIP(); } const auto param = GetParam(); + for (auto& elem : param) + std::cout << elem << ", "; + const auto t_size = std::tuple_size::value; + std::cout "tuple size: " << t_size << std::endl; + const auto test_cmd = std::get(param); + std::cout "param: " << test_cmd << std::endl; + + /* + for elem in param[0,n-2] + if elem in env_vars.keys set env var + if elem in xtra_args prepend xtra cmd to driver + if elem=="TEST_PERF_DB_RECORD_NOT_FOUND" check output + */ + + std::stringstream ss(param); std::istream_iterator begin(ss); std::istream_iterator end; @@ -100,5 +173,308 @@ TEST_P(MyTestSuite, MyTest) } INSTANTIATE_TEST_SUITE_P(MyGroup, MyTestSuite, - testing::Values("--disable-validation --verbose --input  1 8  10  10  --weights 8 8 3 3     --pads_strides_dilations 0 0 1 1 1 1 ", - "--disable-validation --verbose --input  32 160 73 73 --weights  64 160 1 1 --pads_strides_dilations 0 0 1 1 1 1")); + testing::Values( + std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1", "--disable-validation --verbose --input  1 8  10  10  --weights 8 8 3 3     --pads_strides_dilations 0 0 1 1 1 1 "), + std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "--disable-validation --verbose --input  32 160 73 73 --weights  64 160 1 1 --pads_strides_dilations 0 0 1 1 1 1") + )); + + +//set following env vars prior to running test +//add_custom_test(test_conv_embed_db TEST_PERF_DB_RECORD_NOT_FOUND GFX908_DISABLED GFX90A_DISABLED +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", ${MIOPEN_EMBED_TEST_ARG} --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", ${MIOPEN_EMBED_TEST_ARG} --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", ${MIOPEN_EMBED_TEST_ARG} --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1 +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), +std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + + + +/* +set(IMPLICITGEMM_MLIR_ENV_BASE MIOPEN_FIND_MODE=normal) +set(IMPLICITGEMM_MLIR_ENV_F ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmFwd) +set(IMPLICITGEMM_MLIR_ENV_B ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmBwd) +set(IMPLICITGEMM_MLIR_ENV_W ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmWrW) + +set(TEST_CONV_VERBOSE_F ${MIOPEN_TEST_FLOAT_ARG} --verbose --disable-backward-data --disable-backward-weights) +set(TEST_CONV_VERBOSE_B ${MIOPEN_TEST_FLOAT_ARG} --verbose --disable-forward --disable-backward-weights) +set(TEST_CONV_VERBOSE_W ${MIOPEN_TEST_FLOAT_ARG} --verbose --disable-forward --disable-backward-data) + +add_custom_test(test_pooling2d_asymmetric SKIP_UNLESS_ALL HALF_ENABLED GFX94X_ENABLED GFX103X_ENABLED GFX110X_ENABLED + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --all --dataset 1 --limit 0 ${MIOPEN_TEST_FLAGS_ARGS} +) + +add_custom_test(test_conv_igemm_mlir_fwd SKIP_UNLESS_ALL HALF_ENABLED INT8_ENABLED SKIP_UNLESS_MLIR GFX900_DISABLED GFX908_DISABLED GFX90A_DISABLED GFX103X_ENABLED + + +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 256 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 256 256 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --group-count 4") + + + +//set following env vars prior to running test +//add_custom_test(test_conv_igemm_mlir_bwd_wrw SKIP_UNLESS_ALL HALF_ENABLED SKIP_UNLESS_MLIR GFX900_DISABLED GFX908_DISABLED GFX90A_DISABLED GFX103X_ENABLED +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 256 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 256 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), + +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 64 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 64 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 256 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 0 0 2 2 1 1"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 256 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 0 0 2 2 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), +std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 256 1024 14 14 --weights 1024 32 1 1 --pads_strides_dilations 0 0 1 1 1 1 --group-count 32") + + + + + +set(IMPLICITGEMM_MLIR_ENV_F_XDLOPS ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmFwdXdlops) +set(IMPLICITGEMM_MLIR_ENV_B_XDLOPS ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmBwdXdlops) +set(IMPLICITGEMM_MLIR_ENV_W_XDLOPS ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmWrWXdlops) + +add_custom_test(test_conv_igemm_mlir_xdlops_fwd SKIP_UNLESS_ALL HALF_ENABLED INT8_ENABLED SKIP_UNLESS_MLIR GFX900_DISABLED GFX906_DISABLED + COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 256 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1 + COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 + COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC + COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 + COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC + COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 + COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC + COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 256 256 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --group-count 4 +) + +add_custom_test(test_conv_hip_igemm_xdlops SKIP_UNLESS_ALL OCL_DISABLED HALF_DISABLED FLOAT_DISABLED INT8_ENABLED GFX900_DISABLED GFX906_DISABLED GFX94X_ENABLED SKIP_UNLESS_COMPOSABLEKERNEL + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 256 128 28 28 --weights 128 128 3 3 ${MIOPEN_TEST_CONV_INT8_OUTPUT_TYPE_INT8} --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 128 512 7 7 --weights 512 512 3 3 ${MIOPEN_TEST_CONV_INT8_OUTPUT_TYPE_INT8} --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 128 64 56 56 --weights 64 64 1 1 ${MIOPEN_TEST_CONV_INT8_OUTPUT_TYPE_INT8} --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 256 256 56 56 --weights 256 64 1 1 ${MIOPEN_TEST_CONV_INT8_OUTPUT_TYPE_INT8} --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 256 128 28 28 --weights 128 128 3 3 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 128 512 7 7 --weights 512 512 3 3 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 128 64 56 56 --weights 64 64 1 1 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 256 256 56 56 --weights 256 64 1 1 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 256 128 28 28 --weights 128 128 3 3 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 128 512 7 7 --weights 512 512 3 3 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 128 64 56 56 --weights 64 64 1 1 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 256 256 56 56 --weights 256 64 1 1 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 256 128 28 28 --weights 128 128 3 3 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 128 512 7 7 --weights 512 512 3 3 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 128 64 56 56 --weights 64 64 1 1 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 256 256 56 56 --weights 256 64 1 1 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 256 128 28 28 --weights 128 128 3 3 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 128 512 7 7 --weights 512 512 3 3 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 128 64 56 56 --weights 64 64 1 1 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 + COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 256 256 56 56 --weights 256 64 1 1 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 +) + +add_custom_test(test_conv_igemm_mlir_xdlops_bwd_wrw SKIP_UNLESS_ALL HALF_ENABLED SKIP_UNLESS_MLIR GFX900_DISABLED GFX906_DISABLED + COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 256 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1 + COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 256 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC + COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 + COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC + COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 + COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC + COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 + COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC + + COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 64 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1 + COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 64 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC + COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 256 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 0 0 2 2 1 1 + COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 256 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 0 0 2 2 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC + COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1 + COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC + COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC + COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 256 1024 14 14 --weights 1024 32 1 1 --pads_strides_dilations 0 0 1 1 1 1 --group-count 32 + + COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 64 1024 14 14 --weights 1024 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1 +) + +set(IMPLICITGEMM_TESTING_ENV + MIOPEN_DEBUG_CONV_WINOGRAD=0 + MIOPEN_DEBUG_CONV_FFT=0 + MIOPEN_DEBUG_CONV_DIRECT=0 + MIOPEN_DEBUG_CONV_GEMM=0 + MIOPEN_DEBUG_CONV_IMPLICIT_GEMM=1 +) + +if(WORKAROUND_ISSUE_936 AND MIOPEN_TEST_HALF) + SET(SAVE_IMPLICITGEMM_TESTING_ENV ${IMPLICITGEMM_TESTING_ENV}) + LIST(APPEND IMPLICITGEMM_TESTING_ENV MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0 MIOPEN_FIND_MODE=normal) + SET(SAVE_MIOPEN_TEST_FLOAT_ARG ${MIOPEN_TEST_FLOAT_ARG}) + LIST(APPEND MIOPEN_TEST_FLOAT_ARG --disable-forward --disable-backward-data) + #Afther fix need to remove '| grep -v "No suitable algorithm was found to execute the required convolution"' +endif() + +add_custom_test(test_conv_for_implicit_gemm SKIP_UNLESS_ALL BF16_ENABLED HALF_ENABLED GFX94X_ENABLED GFX103X_ENABLED +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 16 28 28 --weights 192 16 3 3 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 16 14 14 --weights 160 16 3 3 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 16 7 7 --weights 128 16 3 3 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 16 55 55 --weights 96 16 1 7 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 16 28 28 --weights 64 16 1 7 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 16 14 14 --weights 32 16 1 7 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 28 28 --weights 192 32 3 3 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 14 14 --weights 160 32 3 3 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 7 7 --weights 128 32 3 3 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 55 55 --weights 96 32 1 7 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 28 28 --weights 64 32 1 7 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 14 14 --weights 32 32 1 7 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 64 73 73 --weights 80 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 55 55 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 28 28 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 14 14 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 7 7 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 64 73 73 --weights 80 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 128 55 55 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 128 28 28 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +# COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 128 14 14 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 128 7 7 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 55 55 --weights 16 128 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 28 28 --weights 16 128 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 14 14 --weights 16 128 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 7 7 --weights 16 128 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 160 73 73 --weights 64 160 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 35 35 --weights 32 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 35 35 --weights 48 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 35 35 --weights 64 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 28 28 --weights 16 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 28 28 --weights 32 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 28 28 --weights 64 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 28 28 --weights 96 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 35 35 --weights 48 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 35 35 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 28 28 --weights 128 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 28 28 --weights 32 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 28 28 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 288 35 35 --weights 48 288 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 288 35 35 --weights 64 288 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 384 35 35 --weights 192 384 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 384 35 35 --weights 64 384 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 384 35 35 --weights 96 384 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 480 14 14 --weights 16 480 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 480 14 14 --weights 192 480 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 480 14 14 --weights 64 480 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 480 14 14 --weights 96 480 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 112 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 144 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 160 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 24 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 32 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 64 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 128 832 7 7 --weights 32 832 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 128 832 7 7 --weights 192 832 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 128 832 7 7 --weights 128 832 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 128 832 7 7 --weights 32 832 1 1 --pads_strides_dilations 0 0 1 1 2 2 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 128 832 7 7 --weights 192 832 1 1 --pads_strides_dilations 0 0 1 1 2 2 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 128 832 7 7 --weights 128 832 1 1 --pads_strides_dilations 0 0 1 1 2 2 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 2048 7 7 --weights 192 2048 1 1 --pads_strides_dilations 0 0 1 1 2 2 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 28 28 --weights 192 32 3 3 --pads_strides_dilations 1 1 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 8 16 14 14 --weights 32 16 1 1 --pads_strides_dilations 1 1 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 14 14 --weights 192 32 3 3 --pads_strides_dilations 1 1 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 7 7 --weights 192 32 3 3 --pads_strides_dilations 1 1 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 28 28 --weights 192 32 3 3 --pads_strides_dilations 2 2 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 14 14 --weights 192 32 3 3 --pads_strides_dilations 2 2 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 7 7 --weights 192 32 3 3 --pads_strides_dilations 2 2 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" +) + +if(WORKAROUND_ISSUE_936 AND MIOPEN_TEST_HALF) + SET(IMPLICITGEMM_TESTING_ENV ${SAVE_IMPLICITGEMM_TESTING_ENV}) + SET(MIOPEN_TEST_FLOAT_ARG ${SAVE_MIOPEN_TEST_FLOAT_ARG}) +endif() + +add_custom_test(test_conv_group SKIP_UNLESS_ALL GFX94X_ENABLED GFX103X_ENABLED GFX110X_ENABLED +COMMAND $ --verbose --input 16 128 56 56 --weights 256 4 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 +COMMAND $ --verbose --input 16 256 56 56 --weights 512 8 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 32 +COMMAND $ --verbose --input 16 256 28 28 --weights 512 8 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 +COMMAND $ --verbose --input 16 512 28 28 --weights 1024 16 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 32 +COMMAND $ --verbose --input 16 512 14 14 --weights 1024 16 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 +COMMAND $ --verbose --input 16 1024 14 14 --weights 2048 32 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 32 +COMMAND $ --verbose --input 16 1024 7 7 --weights 2048 32 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 +COMMAND $ --verbose --input 32 128 56 56 --weights 256 4 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 +COMMAND $ --verbose --input 32 256 56 56 --weights 512 8 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 32 +# +# Workaround for "Memory access fault by GPU node" during "HIP Release All" - WrW disabled. +COMMAND $ --verbose --input 32 256 28 28 --weights 512 8 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 --disable-backward-weights +COMMAND $ --verbose --input 32 512 28 28 --weights 1024 16 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 32 +COMMAND $ --verbose --input 32 512 14 14 --weights 1024 16 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 +COMMAND $ --verbose --input 32 1024 14 14 --weights 2048 32 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 32 +COMMAND $ --verbose --input 32 1024 7 7 --weights 2048 32 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 +COMMAND $ --verbose --input 4 4 161 700 --weights 32 1 5 20 --pads_strides_dilations 0 0 2 2 1 1 --group-count 4 +COMMAND $ --verbose --input 8 2 161 700 --weights 32 1 5 20 --pads_strides_dilations 0 0 2 2 1 1 --group-count 2 +COMMAND $ --verbose --input 16 4 161 700 --weights 32 1 5 20 --pads_strides_dilations 0 0 2 2 1 1 --group-count 4 +COMMAND $ --verbose --input 32 2 161 700 --weights 32 1 5 20 --pads_strides_dilations 0 0 2 2 1 1 --group-count 2 +COMMAND $ --verbose --input 4 32 79 341 --weights 32 16 5 10 --pads_strides_dilations 0 0 2 2 1 1 --group-count 2 +COMMAND $ --verbose --input 8 32 79 341 --weights 32 16 5 10 --pads_strides_dilations 0 0 2 2 1 1 --group-count 2 +COMMAND $ --verbose --input 16 32 79 341 --weights 32 16 5 10 --pads_strides_dilations 0 0 2 2 1 1 --group-count 2 +COMMAND $ --verbose --input 32 32 79 341 --weights 32 16 5 10 --pads_strides_dilations 0 0 2 2 1 1 --group-count 2 +COMMAND $ --verbose --input 16 4 48 480 --weights 16 1 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 4 +COMMAND $ --verbose --input 16 16 24 240 --weights 32 1 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 16 +COMMAND $ --verbose --input 16 32 12 120 --weights 64 8 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 4 +COMMAND $ --verbose --input 16 64 6 60 --weights 128 16 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 4 +COMMAND $ --verbose --input 8 3 108 108 --weights 63 1 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 3 +COMMAND $ --verbose --input 8 64 54 54 --weights 64 8 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 8 +COMMAND $ --verbose --input 8 128 27 27 --weights 128 16 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 8 +COMMAND $ --verbose --input 8 3 224 224 --weights 63 1 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 3 +COMMAND $ --verbose --input 8 64 112 112 --weights 128 32 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 2 +COMMAND $ --verbose --input 16 9 224 224 --weights 63 3 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 3 +# +# Workaround for "Memory access fault by GPU node" during "FP32 gfx908 Hip Release All subset" - WrW disabled. +COMMAND $ --verbose --input 16 64 112 112 --weights 128 16 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 4 --disable-backward-weights +COMMAND $ --verbose --input 16 3 224 224 --weights 63 1 7 7 --pads_strides_dilations 3 3 2 2 1 1 --group-count 3 +COMMAND $ --verbose --input 16 192 28 28 --weights 32 12 5 5 --pads_strides_dilations 2 2 1 1 1 1 --group-count 16 +COMMAND $ --verbose --input 16 832 7 7 --weights 128 52 5 5 --pads_strides_dilations 2 2 1 1 1 1 --group-count 16 +COMMAND $ --verbose --input 16 192 28 28 --weights 32 24 1 1 --pads_strides_dilations 0 0 1 1 1 1 --group-count 8 +COMMAND $ --verbose --input 16 832 7 7 --weights 128 104 1 1 --pads_strides_dilations 0 0 1 1 1 1 --group-count 8 +COMMAND $ --verbose --input 11 23 161 700 --weights 46 1 7 7 --pads_strides_dilations 1 1 2 2 1 1 --group-count 23 +COMMAND $ --verbose --input 8 7 224 224 --weights 63 1 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 7 +COMMAND $ --verbose --input 8 7 224 224 --weights 63 1 3 3 --pads_strides_dilations 0 0 1 1 1 1 --group-count 7 +COMMAND $ --verbose --input 8 7 224 224 --weights 63 1 3 3 --pads_strides_dilations 0 0 2 2 1 1 --group-count 7 +COMMAND $ --verbose --input 8 7 224 224 --weights 63 1 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 7 +COMMAND $ --verbose --input 8 7 224 224 --weights 63 1 3 3 --pads_strides_dilations 2 2 2 2 1 1 --group-count 7 +COMMAND $ --verbose --input 8 3 108 108 --weights 63 1 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 3 +COMMAND $ --verbose --input 8 3 108 108 --weights 63 1 3 3 --pads_strides_dilations 0 0 1 1 1 1 --group-count 3 +COMMAND $ --verbose --input 8 3 108 108 --weights 63 1 3 3 --pads_strides_dilations 0 0 2 2 1 1 --group-count 3 +COMMAND $ --verbose --input 8 3 108 108 --weights 63 1 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 3 +COMMAND $ --verbose --input 8 3 108 108 --weights 63 1 3 3 --pads_strides_dilations 2 2 2 2 1 1 --group-count 3 +) +*/ From 6f1d5b089d7b06ff380cd97b77ef729c2856e952 Mon Sep 17 00:00:00 2001 From: alecsandraBara Date: Tue, 16 May 2023 18:08:54 +0000 Subject: [PATCH 03/29] sending tuple values --- test/gtest/conv_2d_wrapper.cpp | 98 +++++++++++++++++----------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/test/gtest/conv_2d_wrapper.cpp b/test/gtest/conv_2d_wrapper.cpp index 4907464de9..3da3e400ef 100644 --- a/test/gtest/conv_2d_wrapper.cpp +++ b/test/gtest/conv_2d_wrapper.cpp @@ -70,7 +70,7 @@ struct conv2d_driver : conv_driver } }; -class MyTestSuite : public testing::TestWithParam {}; +class MyTestSuite : public testing::TestWithParam, std::string>> {}; /* set(MIOPEN_EMBED_TEST_ARG ${MIOPEN_TEST_FLOAT_ARG} --disable-validation --verbose) # WORKAROUND for issue #874 @@ -98,40 +98,37 @@ TEST_P(MyTestSuite, MyTest) std::unordered_map env_vars = {}; env_vars["MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2"] = "0"; - env_vars["MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1" = "0"; //F - env_vars["MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" = "0"; //W, FW - env_vars["GFX908_DISABLED" = "1"; - env_vars["GFX90A_DISABLED" = "1"; - env_vars["GFX94X_ENABLED" = "1"; - env_vars["GFX103X_ENABLED" = "1"; - env_vars["GFX110X_ENABLED" = "1"; - env_vars["HALF_ENABLED" = "1"; - env_vars["INT8_ENABLED" = "1"; - env_vars["OCL_DISABLED" = "1"; + env_vars["MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1"] = "0"; //F + env_vars["MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1"] = "0"; //W, FW + env_vars["GFX908_DISABLED"] = "1"; + env_vars["GFX90A_DISABLED"] = "1"; + env_vars["GFX94X_ENABLED"] = "1"; + env_vars["GFX103X_ENABLED"] = "1"; + env_vars["GFX110X_ENABLED"] = "1"; + env_vars["HALF_ENABLED"] = "1"; + env_vars["INT8_ENABLED"] = "1"; + env_vars["OCL_DISABLED"] = "1"; //IMPLICITGEMM_MLIR_ENV_BASE - env_vars["MIOPEN_FIND_MODE" = "normal"]; - env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"= "ConvMlirIgemmFwd"]; - env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"= "ConvMlirIgemmBwd"]; - env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"= "ConvMlirIgemmWrW"]; - env_vars["FIND_MODE" = "normal"]; //IMPLICITGEMM_MLIR_ENV_BASE - env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER" = "ConvMlirIgemmFwdXdlops"]; - env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER" = "ConvMlirIgemmBwdXdlops"]; - env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER" = "ConvMlirIgemmWrWXdlops"]; + env_vars["MIOPEN_FIND_MODE"] = "normal"; + env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"] = "ConvMlirIgemmFwd"; + env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"] = "ConvMlirIgemmBwd"; + env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"] = "ConvMlirIgemmWrW"; + env_vars["FIND_MODE"] = "normal"; //IMPLICITGEMM_MLIR_ENV_BASE + env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"] = "ConvMlirIgemmFwdXdlops"; + env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"] = "ConvMlirIgemmBwdXdlops"; + env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"] = "ConvMlirIgemmWrWXdlops"; - /* - env_vars["MIOPEN_DEBUG_" = ""; - */ std::unordered_map xtra_args = {}; - xtra_args["MIOPEN_TEST_FLOAT_ARG"] = "--disable-validation --verbose" + xtra_args["MIOPEN_TEST_FLOAT_ARG"] = "--disable-validation --verbose"; //MIOPEN_TEST_FLOAT_ARGS + - xtra_args["TEST_CONV_VERBOSE_F" = "--verbose --disable-backward-data --disable-backward-weights"]; - xtra_args["TEST_CONV_VERBOSE_B" = "--verbose --disable-forward --disable-backward-weights"]; - xtra_args["TEST_CONV_VERBOSE_W" = "--verbose --disable-forward --disable-backward-data"]; - xtra_args["MIOPEN_TEST_FLOAT_ARG" = "--disable-forward --disable-backward-data"]; + xtra_args["TEST_CONV_VERBOSE_F"] = "--verbose --disable-backward-data --disable-backward-weights"; + xtra_args["TEST_CONV_VERBOSE_B"] = "--verbose --disable-forward --disable-backward-weights"; + xtra_args["TEST_CONV_VERBOSE_W"] = "--verbose --disable-forward --disable-backward-data"; + xtra_args["MIOPEN_TEST_FLOAT_ARG"] = "--disable-forward --disable-backward-data"; - std::cout << "Example Test Param: " << GetParam() << std::endl; + //std::cout << "Example Test Param: " << GetParam() << std::endl; const auto& handle = get_handle(); //std::cout << handle.GetDeviceName() << std::endl; if(miopen::StartsWith(handle.GetDeviceName(),"gfx906")){ @@ -139,13 +136,15 @@ TEST_P(MyTestSuite, MyTest) GTEST_SKIP(); } - const auto param = GetParam(); - for (auto& elem : param) - std::cout << elem << ", "; - const auto t_size = std::tuple_size::value; - std::cout "tuple size: " << t_size << std::endl; - const auto test_cmd = std::get(param); - std::cout "param: " << test_cmd << std::endl; + //auto [vec, cmd] = GetParam(); + auto tple = GetParam(); + std::cout << "Tuple size: " << std::tuple_size::value << std::endl; + auto vec = std::get<0>(tple); + for(const auto &elem : vec) + std::cout << elem << std::endl; + + auto cmd = std::get<1>(tple); + std::cout << cmd << std::endl; /* for elem in param[0,n-2] @@ -155,30 +154,31 @@ TEST_P(MyTestSuite, MyTest) */ - std::stringstream ss(param); - std::istream_iterator begin(ss); - std::istream_iterator end; - std::vector tokens(begin, end); - std::vector ptrs; + //std::stringstream ss(param); + //std::istream_iterator begin(ss); + //std::istream_iterator end; + //std::vector tokens(begin, end); + //std::vector ptrs; - for (std::string const& str : tokens) { - ptrs.push_back(str.data()); - //std::cout << str.data() << std::endl; - } + //for (std::string const& str : tokens) { + // ptrs.push_back(str.data()); + // //std::cout << str.data() << std::endl; + //} //std::cout << "PTR SIZE: " << ptrs.size() << std::endl; - test_drive(ptrs.size(), ptrs.data()); + //test_drive(ptrs.size(), ptrs.data()); } + INSTANTIATE_TEST_SUITE_P(MyGroup, MyTestSuite, testing::Values( - std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1", "--disable-validation --verbose --input  1 8  10  10  --weights 8 8 3 3     --pads_strides_dilations 0 0 1 1 1 1 "), - std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "--disable-validation --verbose --input  32 160 73 73 --weights  64 160 1 1 --pads_strides_dilations 0 0 1 1 1 1") + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1"}, "--disable-validation --verbose --input  1 8  10  10  --weights 8 8 3 3     --pads_strides_dilations 0 0 1 1 1 1 ") )); - +//std::vector{"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "--disable-validation --verbose --input  32 160 73 73 --weights  64 160 1 1 --pads_strides_dilations 0 0 1 1 1 1"} +/* //set following env vars prior to running test //add_custom_test(test_conv_embed_db TEST_PERF_DB_RECORD_NOT_FOUND GFX908_DISABLED GFX90A_DISABLED std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), @@ -202,7 +202,7 @@ std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICI std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - +*/ /* From ba9cd2a790d0c88fc811566818dce62aa65d87f3 Mon Sep 17 00:00:00 2001 From: alecsandraBara Date: Wed, 17 May 2023 17:17:15 +0000 Subject: [PATCH 04/29] updates to env vars --- test/gtest/conv_2d_wrapper.cpp | 105 ++++++++------------------------- 1 file changed, 26 insertions(+), 79 deletions(-) diff --git a/test/gtest/conv_2d_wrapper.cpp b/test/gtest/conv_2d_wrapper.cpp index 3da3e400ef..6ea2947f55 100644 --- a/test/gtest/conv_2d_wrapper.cpp +++ b/test/gtest/conv_2d_wrapper.cpp @@ -70,63 +70,17 @@ struct conv2d_driver : conv_driver } }; -class MyTestSuite : public testing::TestWithParam, std::string>> {}; -/* -set(MIOPEN_EMBED_TEST_ARG ${MIOPEN_TEST_FLOAT_ARG} --disable-validation --verbose) -# WORKAROUND for issue #874 -set(MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1 MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0) -set(MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1 MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0) -set(MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1W MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0 MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0) -# WORKAROUND for issue #1008 -set(MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2 MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0) -*/ - -/* -env vars: -add_custom_test(test_conv_embed_db TEST_PERF_DB_RECORD_NOT_FOUND GFX908_DISABLED GFX90A_DISABLED -*/ - +class MyTestSuite : public testing::TestWithParam, std::string>> {}; TEST_P(MyTestSuite, MyTest) { - +#if MIOPEN_EMBED_DB //SKIP_UNLESS_COMPOSABLEKERNEL //SKIP_UNLESS_ALL??? - //TEST_PERF_DB_RECORD_NOT_FOUND check - - - std::unordered_map env_vars = {}; - env_vars["MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2"] = "0"; - env_vars["MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1"] = "0"; //F - env_vars["MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1"] = "0"; //W, FW - env_vars["GFX908_DISABLED"] = "1"; - env_vars["GFX90A_DISABLED"] = "1"; - env_vars["GFX94X_ENABLED"] = "1"; - env_vars["GFX103X_ENABLED"] = "1"; - env_vars["GFX110X_ENABLED"] = "1"; - env_vars["HALF_ENABLED"] = "1"; - env_vars["INT8_ENABLED"] = "1"; - env_vars["OCL_DISABLED"] = "1"; - - //IMPLICITGEMM_MLIR_ENV_BASE - env_vars["MIOPEN_FIND_MODE"] = "normal"; - env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"] = "ConvMlirIgemmFwd"; - env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"] = "ConvMlirIgemmBwd"; - env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"] = "ConvMlirIgemmWrW"; - env_vars["FIND_MODE"] = "normal"; //IMPLICITGEMM_MLIR_ENV_BASE - env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"] = "ConvMlirIgemmFwdXdlops"; - env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"] = "ConvMlirIgemmBwdXdlops"; - env_vars["MIOPEN_DEBUG_FIND_ONLY_SOLVER"] = "ConvMlirIgemmWrWXdlops"; - - std::unordered_map xtra_args = {}; - xtra_args["MIOPEN_TEST_FLOAT_ARG"] = "--disable-validation --verbose"; - - //MIOPEN_TEST_FLOAT_ARGS + - xtra_args["TEST_CONV_VERBOSE_F"] = "--verbose --disable-backward-data --disable-backward-weights"; - xtra_args["TEST_CONV_VERBOSE_B"] = "--verbose --disable-forward --disable-backward-weights"; - xtra_args["TEST_CONV_VERBOSE_W"] = "--verbose --disable-forward --disable-backward-data"; - xtra_args["MIOPEN_TEST_FLOAT_ARG"] = "--disable-forward --disable-backward-data"; + //TEST_PERF_DB_RECORD_NOT_FOUND checks for test string to make it pass/fail + //MIOPEN_EMBED_DB is set with -DMIOPEN_EMBED_DB=1 compile flag + //std::cout << "Example Test Param: " << GetParam() << std::endl; const auto& handle = get_handle(); @@ -136,46 +90,39 @@ TEST_P(MyTestSuite, MyTest) GTEST_SKIP(); } - //auto [vec, cmd] = GetParam(); auto tple = GetParam(); std::cout << "Tuple size: " << std::tuple_size::value << std::endl; - auto vec = std::get<0>(tple); - for(const auto &elem : vec) + auto env_vars = std::get<0>(tple); + for(auto &elem : env_vars){ std::cout << elem << std::endl; + putenv(elem.data()); + } auto cmd = std::get<1>(tple); std::cout << cmd << std::endl; - /* - for elem in param[0,n-2] - if elem in env_vars.keys set env var - if elem in xtra_args prepend xtra cmd to driver - if elem=="TEST_PERF_DB_RECORD_NOT_FOUND" check output - */ - - - //std::stringstream ss(param); - //std::istream_iterator begin(ss); - //std::istream_iterator end; - //std::vector tokens(begin, end); - //std::vector ptrs; - - //for (std::string const& str : tokens) { - // ptrs.push_back(str.data()); - // //std::cout << str.data() << std::endl; - //} - //std::cout << "PTR SIZE: " << ptrs.size() << std::endl; - - //test_drive(ptrs.size(), ptrs.data()); - + std::stringstream ss(cmd); + std::istream_iterator begin(ss); + std::istream_iterator end; + std::vector tokens(begin, end); + std::vector ptrs; + + for (std::string const& str : tokens) { + ptrs.push_back(str.data()); + } + test_drive(ptrs.size(), ptrs.data()); -} +#else +GTEST_SKIP(); +#endif +}; INSTANTIATE_TEST_SUITE_P(MyGroup, MyTestSuite, testing::Values( - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1"}, "--disable-validation --verbose --input  1 8  10  10  --weights 8 8 3 3     --pads_strides_dilations 0 0 1 1 1 1 ") - )); + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --disable-validation --verbose --input  1 8  10  10  --weights 8 8 3 3     --pads_strides_dilations 0 0 1 1 1 1 ") + )); + //std::vector{"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "--disable-validation --verbose --input  32 160 73 73 --weights  64 160 1 1 --pads_strides_dilations 0 0 1 1 1 1"} /* From 9f3fe10dd14446655de60b9dad857730d07e4f01 Mon Sep 17 00:00:00 2001 From: alecsandraBara Date: Fri, 19 May 2023 18:20:12 +0000 Subject: [PATCH 05/29] stdout test capture to fail based in stderr stream --- test/gtest/conv_2d_wrapper.cpp | 404 ++++++--------------------------- 1 file changed, 66 insertions(+), 338 deletions(-) diff --git a/test/gtest/conv_2d_wrapper.cpp b/test/gtest/conv_2d_wrapper.cpp index 6ea2947f55..40df06f89c 100644 --- a/test/gtest/conv_2d_wrapper.cpp +++ b/test/gtest/conv_2d_wrapper.cpp @@ -70,358 +70,86 @@ struct conv2d_driver : conv_driver } }; -class MyTestSuite : public testing::TestWithParam, std::string>> {}; +class MyTestSuite : public testing::TestWithParam, std::string>> {}; TEST_P(MyTestSuite, MyTest) { #if MIOPEN_EMBED_DB - //SKIP_UNLESS_COMPOSABLEKERNEL - //SKIP_UNLESS_ALL??? - //TEST_PERF_DB_RECORD_NOT_FOUND checks for test string to make it pass/fail - //MIOPEN_EMBED_DB is set with -DMIOPEN_EMBED_DB=1 compile flag + const auto GFX908_DISABLED = std::getenv("GFX908_DISABLED"); + const auto GFX90A_DISABLED = std::getenv("GFX90A_DISABLED"); + //putenv("MIOPEN_TEST_FLOAT_ARG="--float""); + if(GFX908_DISABLED && GFX90A_DISABLED){ + const auto& handle = get_handle(); + if(miopen::StartsWith(handle.GetDeviceName(),"gfx906")){ + std::cout << "gfx906" << std::endl; + GTEST_SKIP(); + } + + auto param = GetParam(); + auto env_vars = std::get<0>(param); + for(auto &elem : env_vars){ + std::cout << elem << std::endl; + putenv(elem.data()); + } + + auto cmd = std::get<1>(param); + std::cout << cmd << std::endl; + + std::stringstream ss(cmd); + std::istream_iterator begin(ss); + std::istream_iterator end; + std::vector tokens(begin, end); + std::vector ptrs; + + for (std::string const& str : tokens) { + ptrs.push_back(str.data()); + } + + //testing::internal::CaptureStdout(); + testing::internal::CaptureStderr(); + test_drive(ptrs.size(), ptrs.data()); + //std::string output = testing::internal::GetCapturedStdout(); + auto capture = testing::internal::GetCapturedStderr(); + //std::cout << "Captured stdout: " << output << std::endl; + //std::cout << "Capture stderr stream : " << capture << std::endl; + EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); + EXPECT_FALSE(capture.find("real descritor") != std::string::npos); - //std::cout << "Example Test Param: " << GetParam() << std::endl; - const auto& handle = get_handle(); - //std::cout << handle.GetDeviceName() << std::endl; - if(miopen::StartsWith(handle.GetDeviceName(),"gfx906")){ - std::cout << "gfx906" << std::endl; + } + else{ GTEST_SKIP(); - } - - auto tple = GetParam(); - std::cout << "Tuple size: " << std::tuple_size::value << std::endl; - auto env_vars = std::get<0>(tple); - for(auto &elem : env_vars){ - std::cout << elem << std::endl; - putenv(elem.data()); - } - - auto cmd = std::get<1>(tple); - std::cout << cmd << std::endl; - - std::stringstream ss(cmd); - std::istream_iterator begin(ss); - std::istream_iterator end; - std::vector tokens(begin, end); - std::vector ptrs; - - for (std::string const& str : tokens) { - ptrs.push_back(str.data()); - } - test_drive(ptrs.size(), ptrs.data()); + } #else -GTEST_SKIP(); + GTEST_SKIP(); #endif }; +//add_custom_test(test_conv_embed_db TEST_PERF_DB_RECORD_NOT_FOUND GFX908_DISABLED GFX90A_DISABLED INSTANTIATE_TEST_SUITE_P(MyGroup, MyTestSuite, testing::Values( - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --disable-validation --verbose --input  1 8  10  10  --weights 8 8 3 3     --pads_strides_dilations 0 0 1 1 1 1 ") + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1") )); - - -//std::vector{"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "--disable-validation --verbose --input  32 160 73 73 --weights  64 160 1 1 --pads_strides_dilations 0 0 1 1 1 1"} -/* -//set following env vars prior to running test -//add_custom_test(test_conv_embed_db TEST_PERF_DB_RECORD_NOT_FOUND GFX908_DISABLED GFX90A_DISABLED -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", ${MIOPEN_EMBED_TEST_ARG} --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", ${MIOPEN_EMBED_TEST_ARG} --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", ${MIOPEN_EMBED_TEST_ARG} --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1 -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), -std::make_tuple("MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1" ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1"), -*/ - - -/* -set(IMPLICITGEMM_MLIR_ENV_BASE MIOPEN_FIND_MODE=normal) -set(IMPLICITGEMM_MLIR_ENV_F ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmFwd) -set(IMPLICITGEMM_MLIR_ENV_B ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmBwd) -set(IMPLICITGEMM_MLIR_ENV_W ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmWrW) - -set(TEST_CONV_VERBOSE_F ${MIOPEN_TEST_FLOAT_ARG} --verbose --disable-backward-data --disable-backward-weights) -set(TEST_CONV_VERBOSE_B ${MIOPEN_TEST_FLOAT_ARG} --verbose --disable-forward --disable-backward-weights) -set(TEST_CONV_VERBOSE_W ${MIOPEN_TEST_FLOAT_ARG} --verbose --disable-forward --disable-backward-data) - -add_custom_test(test_pooling2d_asymmetric SKIP_UNLESS_ALL HALF_ENABLED GFX94X_ENABLED GFX103X_ENABLED GFX110X_ENABLED - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --all --dataset 1 --limit 0 ${MIOPEN_TEST_FLAGS_ARGS} -) - -add_custom_test(test_conv_igemm_mlir_fwd SKIP_UNLESS_ALL HALF_ENABLED INT8_ENABLED SKIP_UNLESS_MLIR GFX900_DISABLED GFX908_DISABLED GFX90A_DISABLED GFX103X_ENABLED - - -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 256 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_F} $ ${TEST_CONV_VERBOSE_F} --input 256 256 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --group-count 4") - - - -//set following env vars prior to running test -//add_custom_test(test_conv_igemm_mlir_bwd_wrw SKIP_UNLESS_ALL HALF_ENABLED SKIP_UNLESS_MLIR GFX900_DISABLED GFX908_DISABLED GFX90A_DISABLED GFX103X_ENABLED -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 256 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 256 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_B} $ ${TEST_CONV_VERBOSE_B} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), - -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 64 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 64 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 256 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 0 0 2 2 1 1"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 256 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 0 0 2 2 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC"), -std::make_tuple("${IMPLICITGEMM_MLIR_ENV_W} $ ${TEST_CONV_VERBOSE_W} --input 256 1024 14 14 --weights 1024 32 1 1 --pads_strides_dilations 0 0 1 1 1 1 --group-count 32") - - - - - -set(IMPLICITGEMM_MLIR_ENV_F_XDLOPS ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmFwdXdlops) -set(IMPLICITGEMM_MLIR_ENV_B_XDLOPS ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmBwdXdlops) -set(IMPLICITGEMM_MLIR_ENV_W_XDLOPS ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmWrWXdlops) - -add_custom_test(test_conv_igemm_mlir_xdlops_fwd SKIP_UNLESS_ALL HALF_ENABLED INT8_ENABLED SKIP_UNLESS_MLIR GFX900_DISABLED GFX906_DISABLED - COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 256 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 - COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC - COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 - COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC - COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC - COMMAND ${IMPLICITGEMM_MLIR_ENV_F_XDLOPS} $ ${TEST_CONV_VERBOSE_F} --input 256 256 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --group-count 4 -) - -add_custom_test(test_conv_hip_igemm_xdlops SKIP_UNLESS_ALL OCL_DISABLED HALF_DISABLED FLOAT_DISABLED INT8_ENABLED GFX900_DISABLED GFX906_DISABLED GFX94X_ENABLED SKIP_UNLESS_COMPOSABLEKERNEL - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 256 128 28 28 --weights 128 128 3 3 ${MIOPEN_TEST_CONV_INT8_OUTPUT_TYPE_INT8} --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 128 512 7 7 --weights 512 512 3 3 ${MIOPEN_TEST_CONV_INT8_OUTPUT_TYPE_INT8} --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 128 64 56 56 --weights 64 64 1 1 ${MIOPEN_TEST_CONV_INT8_OUTPUT_TYPE_INT8} --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 256 256 56 56 --weights 256 64 1 1 ${MIOPEN_TEST_CONV_INT8_OUTPUT_TYPE_INT8} --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 256 128 28 28 --weights 128 128 3 3 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 128 512 7 7 --weights 512 512 3 3 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 128 64 56 56 --weights 64 64 1 1 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 256 256 56 56 --weights 256 64 1 1 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 256 128 28 28 --weights 128 128 3 3 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 128 512 7 7 --weights 512 512 3 3 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 128 64 56 56 --weights 64 64 1 1 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-backward-data --disable-backward-weights --verbose --input 256 256 56 56 --weights 256 64 1 1 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 256 128 28 28 --weights 128 128 3 3 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 128 512 7 7 --weights 512 512 3 3 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 128 64 56 56 --weights 64 64 1 1 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 256 256 56 56 --weights 256 64 1 1 --output_type fp32 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 256 128 28 28 --weights 128 128 3 3 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 128 512 7 7 --weights 512 512 3 3 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 1 1 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 128 64 56 56 --weights 64 64 1 1 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 - COMMAND $ ${MIOPEN_TEST_FLOAT_ARG} --disable-forward --disable-backward-weights --verbose --input 256 256 56 56 --weights 256 64 1 1 --output_type fp16 --in_layout NHWC --fil_layout NHWC --out_layout NHWC --pads_strides_dilations 0 0 1 1 1 1 -) - -add_custom_test(test_conv_igemm_mlir_xdlops_bwd_wrw SKIP_UNLESS_ALL HALF_ENABLED SKIP_UNLESS_MLIR GFX900_DISABLED GFX906_DISABLED - COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 256 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 256 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC - COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 - COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 256 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC - COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 - COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC - COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${IMPLICITGEMM_MLIR_ENV_B_XDLOPS} $ ${TEST_CONV_VERBOSE_B} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC - - COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 64 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 64 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC - COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 256 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 256 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 0 0 2 2 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC - COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC - COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC - COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 256 1024 14 14 --weights 1024 32 1 1 --pads_strides_dilations 0 0 1 1 1 1 --group-count 32 - - COMMAND ${IMPLICITGEMM_MLIR_ENV_W_XDLOPS} $ ${TEST_CONV_VERBOSE_W} --input 64 1024 14 14 --weights 1024 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1 -) - -set(IMPLICITGEMM_TESTING_ENV - MIOPEN_DEBUG_CONV_WINOGRAD=0 - MIOPEN_DEBUG_CONV_FFT=0 - MIOPEN_DEBUG_CONV_DIRECT=0 - MIOPEN_DEBUG_CONV_GEMM=0 - MIOPEN_DEBUG_CONV_IMPLICIT_GEMM=1 -) - -if(WORKAROUND_ISSUE_936 AND MIOPEN_TEST_HALF) - SET(SAVE_IMPLICITGEMM_TESTING_ENV ${IMPLICITGEMM_TESTING_ENV}) - LIST(APPEND IMPLICITGEMM_TESTING_ENV MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0 MIOPEN_FIND_MODE=normal) - SET(SAVE_MIOPEN_TEST_FLOAT_ARG ${MIOPEN_TEST_FLOAT_ARG}) - LIST(APPEND MIOPEN_TEST_FLOAT_ARG --disable-forward --disable-backward-data) - #Afther fix need to remove '| grep -v "No suitable algorithm was found to execute the required convolution"' -endif() - -add_custom_test(test_conv_for_implicit_gemm SKIP_UNLESS_ALL BF16_ENABLED HALF_ENABLED GFX94X_ENABLED GFX103X_ENABLED -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 16 28 28 --weights 192 16 3 3 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 16 14 14 --weights 160 16 3 3 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 16 7 7 --weights 128 16 3 3 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 16 55 55 --weights 96 16 1 7 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 16 28 28 --weights 64 16 1 7 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 16 14 14 --weights 32 16 1 7 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 28 28 --weights 192 32 3 3 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 14 14 --weights 160 32 3 3 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 7 7 --weights 128 32 3 3 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 55 55 --weights 96 32 1 7 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 28 28 --weights 64 32 1 7 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 14 14 --weights 32 32 1 7 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 64 73 73 --weights 80 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 55 55 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 28 28 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 14 14 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 7 7 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 64 73 73 --weights 80 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 128 55 55 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 128 28 28 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -# COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 128 14 14 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 128 7 7 --weights 16 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 55 55 --weights 16 128 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 28 28 --weights 16 128 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 14 14 --weights 16 128 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 7 7 --weights 16 128 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 160 73 73 --weights 64 160 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 35 35 --weights 32 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 35 35 --weights 48 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 35 35 --weights 64 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 28 28 --weights 16 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 28 28 --weights 32 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 28 28 --weights 64 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 192 28 28 --weights 96 192 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 35 35 --weights 48 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 35 35 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 28 28 --weights 128 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 28 28 --weights 32 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 256 28 28 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 288 35 35 --weights 48 288 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 288 35 35 --weights 64 288 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 384 35 35 --weights 192 384 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 384 35 35 --weights 64 384 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 384 35 35 --weights 96 384 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 480 14 14 --weights 16 480 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 480 14 14 --weights 192 480 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 480 14 14 --weights 64 480 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 480 14 14 --weights 96 480 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 112 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 144 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 160 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 24 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 32 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 512 14 14 --weights 64 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 128 832 7 7 --weights 32 832 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 128 832 7 7 --weights 192 832 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 128 832 7 7 --weights 128 832 1 1 --pads_strides_dilations 0 0 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 128 832 7 7 --weights 32 832 1 1 --pads_strides_dilations 0 0 1 1 2 2 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 128 832 7 7 --weights 192 832 1 1 --pads_strides_dilations 0 0 1 1 2 2 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 128 832 7 7 --weights 128 832 1 1 --pads_strides_dilations 0 0 1 1 2 2 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 16 2048 7 7 --weights 192 2048 1 1 --pads_strides_dilations 0 0 1 1 2 2 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 28 28 --weights 192 32 3 3 --pads_strides_dilations 1 1 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 8 16 14 14 --weights 32 16 1 1 --pads_strides_dilations 1 1 1 1 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 14 14 --weights 192 32 3 3 --pads_strides_dilations 1 1 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 7 7 --weights 192 32 3 3 --pads_strides_dilations 1 1 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 28 28 --weights 192 32 3 3 --pads_strides_dilations 2 2 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 14 14 --weights 192 32 3 3 --pads_strides_dilations 2 2 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -COMMAND ${IMPLICITGEMM_TESTING_ENV} $ ${MIOPEN_TEST_FLOAT_ARG} --verbose --input 64 32 7 7 --weights 192 32 3 3 --pads_strides_dilations 2 2 2 2 1 1 | grep -v "No suitable algorithm was found to execute the required convolution" -) - -if(WORKAROUND_ISSUE_936 AND MIOPEN_TEST_HALF) - SET(IMPLICITGEMM_TESTING_ENV ${SAVE_IMPLICITGEMM_TESTING_ENV}) - SET(MIOPEN_TEST_FLOAT_ARG ${SAVE_MIOPEN_TEST_FLOAT_ARG}) -endif() - -add_custom_test(test_conv_group SKIP_UNLESS_ALL GFX94X_ENABLED GFX103X_ENABLED GFX110X_ENABLED -COMMAND $ --verbose --input 16 128 56 56 --weights 256 4 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 -COMMAND $ --verbose --input 16 256 56 56 --weights 512 8 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 32 -COMMAND $ --verbose --input 16 256 28 28 --weights 512 8 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 -COMMAND $ --verbose --input 16 512 28 28 --weights 1024 16 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 32 -COMMAND $ --verbose --input 16 512 14 14 --weights 1024 16 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 -COMMAND $ --verbose --input 16 1024 14 14 --weights 2048 32 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 32 -COMMAND $ --verbose --input 16 1024 7 7 --weights 2048 32 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 -COMMAND $ --verbose --input 32 128 56 56 --weights 256 4 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 -COMMAND $ --verbose --input 32 256 56 56 --weights 512 8 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 32 -# -# Workaround for "Memory access fault by GPU node" during "HIP Release All" - WrW disabled. -COMMAND $ --verbose --input 32 256 28 28 --weights 512 8 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 --disable-backward-weights -COMMAND $ --verbose --input 32 512 28 28 --weights 1024 16 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 32 -COMMAND $ --verbose --input 32 512 14 14 --weights 1024 16 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 -COMMAND $ --verbose --input 32 1024 14 14 --weights 2048 32 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 32 -COMMAND $ --verbose --input 32 1024 7 7 --weights 2048 32 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 32 -COMMAND $ --verbose --input 4 4 161 700 --weights 32 1 5 20 --pads_strides_dilations 0 0 2 2 1 1 --group-count 4 -COMMAND $ --verbose --input 8 2 161 700 --weights 32 1 5 20 --pads_strides_dilations 0 0 2 2 1 1 --group-count 2 -COMMAND $ --verbose --input 16 4 161 700 --weights 32 1 5 20 --pads_strides_dilations 0 0 2 2 1 1 --group-count 4 -COMMAND $ --verbose --input 32 2 161 700 --weights 32 1 5 20 --pads_strides_dilations 0 0 2 2 1 1 --group-count 2 -COMMAND $ --verbose --input 4 32 79 341 --weights 32 16 5 10 --pads_strides_dilations 0 0 2 2 1 1 --group-count 2 -COMMAND $ --verbose --input 8 32 79 341 --weights 32 16 5 10 --pads_strides_dilations 0 0 2 2 1 1 --group-count 2 -COMMAND $ --verbose --input 16 32 79 341 --weights 32 16 5 10 --pads_strides_dilations 0 0 2 2 1 1 --group-count 2 -COMMAND $ --verbose --input 32 32 79 341 --weights 32 16 5 10 --pads_strides_dilations 0 0 2 2 1 1 --group-count 2 -COMMAND $ --verbose --input 16 4 48 480 --weights 16 1 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 4 -COMMAND $ --verbose --input 16 16 24 240 --weights 32 1 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 16 -COMMAND $ --verbose --input 16 32 12 120 --weights 64 8 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 4 -COMMAND $ --verbose --input 16 64 6 60 --weights 128 16 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 4 -COMMAND $ --verbose --input 8 3 108 108 --weights 63 1 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 3 -COMMAND $ --verbose --input 8 64 54 54 --weights 64 8 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 8 -COMMAND $ --verbose --input 8 128 27 27 --weights 128 16 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 8 -COMMAND $ --verbose --input 8 3 224 224 --weights 63 1 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 3 -COMMAND $ --verbose --input 8 64 112 112 --weights 128 32 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 2 -COMMAND $ --verbose --input 16 9 224 224 --weights 63 3 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 3 -# -# Workaround for "Memory access fault by GPU node" during "FP32 gfx908 Hip Release All subset" - WrW disabled. -COMMAND $ --verbose --input 16 64 112 112 --weights 128 16 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 4 --disable-backward-weights -COMMAND $ --verbose --input 16 3 224 224 --weights 63 1 7 7 --pads_strides_dilations 3 3 2 2 1 1 --group-count 3 -COMMAND $ --verbose --input 16 192 28 28 --weights 32 12 5 5 --pads_strides_dilations 2 2 1 1 1 1 --group-count 16 -COMMAND $ --verbose --input 16 832 7 7 --weights 128 52 5 5 --pads_strides_dilations 2 2 1 1 1 1 --group-count 16 -COMMAND $ --verbose --input 16 192 28 28 --weights 32 24 1 1 --pads_strides_dilations 0 0 1 1 1 1 --group-count 8 -COMMAND $ --verbose --input 16 832 7 7 --weights 128 104 1 1 --pads_strides_dilations 0 0 1 1 1 1 --group-count 8 -COMMAND $ --verbose --input 11 23 161 700 --weights 46 1 7 7 --pads_strides_dilations 1 1 2 2 1 1 --group-count 23 -COMMAND $ --verbose --input 8 7 224 224 --weights 63 1 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 7 -COMMAND $ --verbose --input 8 7 224 224 --weights 63 1 3 3 --pads_strides_dilations 0 0 1 1 1 1 --group-count 7 -COMMAND $ --verbose --input 8 7 224 224 --weights 63 1 3 3 --pads_strides_dilations 0 0 2 2 1 1 --group-count 7 -COMMAND $ --verbose --input 8 7 224 224 --weights 63 1 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 7 -COMMAND $ --verbose --input 8 7 224 224 --weights 63 1 3 3 --pads_strides_dilations 2 2 2 2 1 1 --group-count 7 -COMMAND $ --verbose --input 8 3 108 108 --weights 63 1 3 3 --pads_strides_dilations 1 1 1 1 1 1 --group-count 3 -COMMAND $ --verbose --input 8 3 108 108 --weights 63 1 3 3 --pads_strides_dilations 0 0 1 1 1 1 --group-count 3 -COMMAND $ --verbose --input 8 3 108 108 --weights 63 1 3 3 --pads_strides_dilations 0 0 2 2 1 1 --group-count 3 -COMMAND $ --verbose --input 8 3 108 108 --weights 63 1 3 3 --pads_strides_dilations 1 1 2 2 1 1 --group-count 3 -COMMAND $ --verbose --input 8 3 108 108 --weights 63 1 3 3 --pads_strides_dilations 2 2 2 2 1 1 --group-count 3 -) -*/ From 251bb897dbb6d4a499281ef0df3bd35c152624a5 Mon Sep 17 00:00:00 2001 From: alecsandraBara Date: Sat, 20 May 2023 01:06:51 +0000 Subject: [PATCH 06/29] clang tidy --- test/gtest/conv_2d_wrapper.cpp | 260 +++++++++++++++++++++------------ 1 file changed, 169 insertions(+), 91 deletions(-) diff --git a/test/gtest/conv_2d_wrapper.cpp b/test/gtest/conv_2d_wrapper.cpp index 40df06f89c..a028a7aba7 100644 --- a/test/gtest/conv_2d_wrapper.cpp +++ b/test/gtest/conv_2d_wrapper.cpp @@ -1,28 +1,3 @@ -/******************************************************************************* -* -* MIT License -* -* Copyright (c) 2022 Advanced Micro Devices, Inc. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ #include #include @@ -70,86 +45,189 @@ struct conv2d_driver : conv_driver } }; -class MyTestSuite : public testing::TestWithParam, std::string>> {}; - - -TEST_P(MyTestSuite, MyTest) -{ +class Conv2dSuite : public testing::TestWithParam, std::string>> +{ +}; +TEST_P(Conv2dSuite, MyTest) +{ #if MIOPEN_EMBED_DB const auto GFX908_DISABLED = std::getenv("GFX908_DISABLED"); const auto GFX90A_DISABLED = std::getenv("GFX90A_DISABLED"); - //putenv("MIOPEN_TEST_FLOAT_ARG="--float""); - if(GFX908_DISABLED && GFX90A_DISABLED){ - const auto& handle = get_handle(); - if(miopen::StartsWith(handle.GetDeviceName(),"gfx906")){ - std::cout << "gfx906" << std::endl; - GTEST_SKIP(); - } + if(GFX908_DISABLED && GFX90A_DISABLED) + { + const auto& handle = get_handle(); + if(miopen::StartsWith(handle.GetDeviceName(), "gfx906")) + { + GTEST_SKIP(); + } - auto param = GetParam(); - auto env_vars = std::get<0>(param); - for(auto &elem : env_vars){ - std::cout << elem << std::endl; - putenv(elem.data()); - } + auto param = GetParam(); + auto env_vars = std::get<0>(param); + for(auto& elem : env_vars) + putenv(elem.data()); - auto cmd = std::get<1>(param); - std::cout << cmd << std::endl; + auto cmd = std::get<1>(param); + std::cout << cmd << std::endl; - std::stringstream ss(cmd); - std::istream_iterator begin(ss); - std::istream_iterator end; - std::vector tokens(begin, end); - std::vector ptrs; - - for (std::string const& str : tokens) { - ptrs.push_back(str.data()); - } + std::stringstream ss(cmd); + std::istream_iterator begin(ss); + std::istream_iterator end; + std::vector tokens(begin, end); + std::vector ptrs; - //testing::internal::CaptureStdout(); - testing::internal::CaptureStderr(); - test_drive(ptrs.size(), ptrs.data()); - //std::string output = testing::internal::GetCapturedStdout(); - auto capture = testing::internal::GetCapturedStderr(); - //std::cout << "Captured stdout: " << output << std::endl; - //std::cout << "Capture stderr stream : " << capture << std::endl; - EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); - EXPECT_FALSE(capture.find("real descritor") != std::string::npos); + for(std::string const& str : tokens) + ptrs.push_back(str.data()); + testing::internal::CaptureStderr(); + test_drive(ptrs.size(), ptrs.data()); + auto capture = testing::internal::GetCapturedStderr(); + EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); } - else{ - GTEST_SKIP(); + else + { + GTEST_SKIP(); } #else GTEST_SKIP(); #endif - }; -//add_custom_test(test_conv_embed_db TEST_PERF_DB_RECORD_NOT_FOUND GFX908_DISABLED GFX90A_DISABLED -INSTANTIATE_TEST_SUITE_P(MyGroup, MyTestSuite, - testing::Values( - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>({"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + " --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1") - )); +INSTANTIATE_TEST_SUITE_P( + Conv2dGroup, + Conv2dSuite, + testing::Values( + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 1024 14 14 --weights 2048 i" + "1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 1024 14 14 --weights 256 " + "1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"))); From 61e49ec47b590dcb39cd11dae530f413b376b382 Mon Sep 17 00:00:00 2001 From: alecsandraBara Date: Mon, 22 May 2023 18:36:23 +0000 Subject: [PATCH 07/29] MIOPEN_FLOAT_TEST_ARG assigments to all gtests --- test/gtest/CMakeLists.txt | 2 +- test/gtest/conv_2d_wrapper.cpp | 79 ++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/test/gtest/CMakeLists.txt b/test/gtest/CMakeLists.txt index 627dd5697b..c18a482a2b 100644 --- a/test/gtest/CMakeLists.txt +++ b/test/gtest/CMakeLists.txt @@ -35,7 +35,7 @@ function(add_gtest TEST_NAME) target_link_libraries(test_${TEST_NAME} gtest_main MIOpen ${Boost_LIBRARIES} hip::host $) endif() # Enable CMake to discover the test binary - gtest_discover_tests(test_${TEST_NAME} PROPERTIES ENVIRONMENT "MIOPEN_USER_DB_PATH=${CMAKE_CURRENT_BINARY_DIR}") + gtest_discover_tests(test_${TEST_NAME} PROPERTIES ENVIRONMENT "MIOPEN_USER_DB_PATH=${CMAKE_CURRENT_BINARY_DIR};MIOPEN_TEST_FLOAT_ARG=${MIOPEN_TEST_FLOAT_ARG}") endif() endfunction() diff --git a/test/gtest/conv_2d_wrapper.cpp b/test/gtest/conv_2d_wrapper.cpp index a028a7aba7..6ccce012be 100644 --- a/test/gtest/conv_2d_wrapper.cpp +++ b/test/gtest/conv_2d_wrapper.cpp @@ -45,6 +45,18 @@ struct conv2d_driver : conv_driver } }; +std::string SetEnvVar() +{ + if(std::getenv("MIOPEN_TEST_FLOAT_ARG") == nullptr) + { + char env[] = "MIOPEN_TEST_FLOAT_ARG=--float"; + putenv(env); + } + + std::cout << std::getenv("MIOPEN_TEST_FLOAT_ARG") << std::endl; + return std::getenv("MIOPEN_TEST_FLOAT_ARG"); +} + class Conv2dSuite : public testing::TestWithParam, std::string>> { }; @@ -52,16 +64,13 @@ TEST_P(Conv2dSuite, MyTest) { #if MIOPEN_EMBED_DB - const auto GFX908_DISABLED = std::getenv("GFX908_DISABLED"); - const auto GFX90A_DISABLED = std::getenv("GFX90A_DISABLED"); - if(GFX908_DISABLED && GFX90A_DISABLED) + const auto& handle = get_handle(); + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906")) + { + GTEST_SKIP(); + } + else { - const auto& handle = get_handle(); - if(miopen::StartsWith(handle.GetDeviceName(), "gfx906")) - { - GTEST_SKIP(); - } - auto param = GetParam(); auto env_vars = std::get<0>(param); for(auto& elem : env_vars) @@ -84,10 +93,6 @@ TEST_P(Conv2dSuite, MyTest) auto capture = testing::internal::GetCapturedStderr(); EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); } - else - { - GTEST_SKIP(); - } #else GTEST_SKIP(); @@ -101,133 +106,131 @@ INSTANTIATE_TEST_SUITE_P( std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + - " --disable-validation --verbose --input 128 1024 14 14 --weights 2048 i" - "1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + SetEnvVar() + " --disable-validation --verbose --input 128 1024 14 14 --weights 2048 " + "1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + - " --disable-validation --verbose --input 128 1024 14 14 --weights 256 " - "1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + SetEnvVar() + " --disable-validation --verbose --input 128 1024 14 14 --weights 256 " + "1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " "--pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 " "--pads_strides_dilations 1 1 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " "--pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 " "--pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 " "--pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 " "--pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 " "--pads_strides_dilations 1 1 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 " "--pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 " "--pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 " "--pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 " "--pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 " "--pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 " "--pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 " "--pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 " "--pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 " "--pads_strides_dilations 1 1 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 " "--pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 " "--pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - std::string(std::getenv("MIOPEN_TEST_FLOAT_ARG")) + + SetEnvVar() + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 " "--pads_strides_dilations 1 1 1 1 1 1"))); From 17aedb8a0be446617904ba44fc0e833b2dfb5776 Mon Sep 17 00:00:00 2001 From: alecsandraBara Date: Tue, 23 May 2023 18:38:07 +0000 Subject: [PATCH 08/29] added all precision based tests --- test/gtest/conv_2d_wrapper.cpp | 606 ++++++++++++++++++++++++++++----- 1 file changed, 523 insertions(+), 83 deletions(-) diff --git a/test/gtest/conv_2d_wrapper.cpp b/test/gtest/conv_2d_wrapper.cpp index 6ccce012be..2c722b0f06 100644 --- a/test/gtest/conv_2d_wrapper.cpp +++ b/test/gtest/conv_2d_wrapper.cpp @@ -45,44 +45,56 @@ struct conv2d_driver : conv_driver } }; -std::string SetEnvVar() +void GetArgs(const std::tuple, std::string>& param, + std::vector& tokens) { - if(std::getenv("MIOPEN_TEST_FLOAT_ARG") == nullptr) + auto env_vars = std::get<0>(param); + for(auto& elem : env_vars) { - char env[] = "MIOPEN_TEST_FLOAT_ARG=--float"; - putenv(env); + std::cout << elem.data() << std::endl; + putenv(elem.data()); } - std::cout << std::getenv("MIOPEN_TEST_FLOAT_ARG") << std::endl; - return std::getenv("MIOPEN_TEST_FLOAT_ARG"); + auto cmd = std::get<1>(param); + std::cout << cmd << std::endl; + + std::stringstream ss(cmd); + std::istream_iterator begin(ss); + std::istream_iterator end; + while(begin != end) + tokens.push_back(*begin++); } -class Conv2dSuite : public testing::TestWithParam, std::string>> +class Conv2dHalf : public testing::TestWithParam, std::string>> +{ +}; +class Conv2dInt8 : public testing::TestWithParam, std::string>> +{ +}; +class Conv2dBFloat16 + : public testing::TestWithParam, std::string>> { }; -TEST_P(Conv2dSuite, MyTest) +class Conv2dFloat : public testing::TestWithParam, std::string>> +{ +}; +TEST_P(Conv2dFloat, FloatTest) { #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906")) + + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || + ((std::getenv("MIOPEN_TEST_FLOAT_ARG") != nullptr) && + !(strcmp(std::getenv("MIOPEN_TEST_FLOAT_ARG"), "--float") == 0))) { GTEST_SKIP(); } else { - auto param = GetParam(); - auto env_vars = std::get<0>(param); - for(auto& elem : env_vars) - putenv(elem.data()); - - auto cmd = std::get<1>(param); - std::cout << cmd << std::endl; - - std::stringstream ss(cmd); - std::istream_iterator begin(ss); - std::istream_iterator end; - std::vector tokens(begin, end); + auto param = GetParam(); + std::vector tokens; + GetArgs(param, tokens); std::vector ptrs; for(std::string const& str : tokens) @@ -99,138 +111,566 @@ TEST_P(Conv2dSuite, MyTest) #endif }; +TEST_P(Conv2dHalf, HalfTest) +{ +#if MIOPEN_EMBED_DB + + const auto& handle = get_handle(); + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || + ((std::getenv("MIOPEN_TEST_FLOAT_ARG") != nullptr) && + !(strcmp(std::getenv("MIOPEN_TEST_FLOAT_ARG"), "--half") == 0))) + { + GTEST_SKIP(); + } + else + { + auto param = GetParam(); + std::vector tokens; + GetArgs(param, tokens); + std::vector ptrs; + + for(std::string const& str : tokens) + ptrs.push_back(str.data()); + + testing::internal::CaptureStderr(); + test_drive(ptrs.size(), ptrs.data()); + auto capture = testing::internal::GetCapturedStderr(); + EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); + } + +#else + GTEST_SKIP(); +#endif +}; + +TEST_P(Conv2dInt8, Int8Test) +{ +#if MIOPEN_EMBED_DB + + const auto& handle = get_handle(); + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || + ((std::getenv("MIOPEN_TEST_FLOAT_ARG") != nullptr) && + !(strcmp(std::getenv("MIOPEN_TEST_FLOAT_ARG"), "--int8") == 0))) + { + GTEST_SKIP(); + } + else + { + auto param = GetParam(); + std::vector tokens; + GetArgs(param, tokens); + std::vector ptrs; + + for(std::string const& str : tokens) + ptrs.push_back(str.data()); + + testing::internal::CaptureStderr(); + test_drive(ptrs.size(), ptrs.data()); + auto capture = testing::internal::GetCapturedStderr(); + EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); + } + +#else + GTEST_SKIP(); +#endif +}; + +TEST_P(Conv2dBFloat16, BFloat16Test) +{ +#if MIOPEN_EMBED_DB + + const auto& handle = get_handle(); + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || + ((std::getenv("MIOPEN_TEST_FLOAT_ARG") != nullptr) && + !(strcmp(std::getenv("MIOPEN_TEST_FLOAT_ARG"), "--bfloat16") == 0))) + { + GTEST_SKIP(); + } + else + { + auto param = GetParam(); + std::vector tokens; + GetArgs(param, tokens); + std::vector ptrs; + + for(std::string const& str : tokens) + ptrs.push_back(str.data()); + + testing::internal::CaptureStderr(); + test_drive(ptrs.size(), ptrs.data()); + auto capture = testing::internal::GetCapturedStderr(); + EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); + } + +#else + GTEST_SKIP(); +#endif +}; + +INSTANTIATE_TEST_SUITE_P( + Conv2dGroup, + Conv2dFloat, + testing::Values( + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 1024 14 14 --weights 2048 " + "1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, + " --float --disable-validation --verbose --input 128 1024 14 14 --weights 256 " + "1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + " --float --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, + " --float --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + " --float --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + " --float --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --float --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"))); + +INSTANTIATE_TEST_SUITE_P( + Conv2dGroup, + Conv2dHalf, + testing::Values( + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 1024 14 14 --weights 2048 " + "1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, + " --half --disable-validation --verbose --input 128 1024 14 14 --weights 256 " + "1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + " --half --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, + " --half --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + " --half --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + " --half --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --half --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"))); + +INSTANTIATE_TEST_SUITE_P( + Conv2dGroup, + Conv2dInt8, + testing::Values( + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 1024 14 14 --weights 2048 " + "1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 1024 14 14 --weights 256 " + "1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + " --int8 --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + " --int8 --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + " --int8 --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 " + "--pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + " --int8 --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"))); + INSTANTIATE_TEST_SUITE_P( Conv2dGroup, - Conv2dSuite, + Conv2dBFloat16, testing::Values( std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + " --disable-validation --verbose --input 128 1024 14 14 --weights 2048 " - "1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 1024 14 14 --weights 2048 " + "1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - SetEnvVar() + " --disable-validation --verbose --input 128 1024 14 14 --weights 256 " - "1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 1024 14 14 --weights 256 " + "1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 " + "1 1 --pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 " + "3 --pads_strides_dilations 1 1 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 " + "1 1 --pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 " + "1 --pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 " + "1 --pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 " + "1 --pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 " + "3 --pads_strides_dilations 1 1 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 " + "1 --pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 " + "1 --pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 " - "--pads_strides_dilations 0 0 2 2 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 " + "--pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 " + "1 1 --pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 " + "1 --pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 " + "1 --pads_strides_dilations 0 0 2 2 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 " + "1 1 --pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 " + "3 --pads_strides_dilations 1 1 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), + " --bfloat16 --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 " + "--pads_strides_dilations 0 0 1 1 1 1"), std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - SetEnvVar() + - " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"))); + " --bfloat16 --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 " + "--pads_strides_dilations 1 1 1 1 1 1"))); From 1b5e8c1805ccaa93f062fd5db67ec1708131edb6 Mon Sep 17 00:00:00 2001 From: alecsandraBara Date: Wed, 24 May 2023 17:32:35 +0000 Subject: [PATCH 09/29] some rework --- test/gtest/conv_2d_wrapper.cpp | 678 +++++---------------------------- 1 file changed, 102 insertions(+), 576 deletions(-) diff --git a/test/gtest/conv_2d_wrapper.cpp b/test/gtest/conv_2d_wrapper.cpp index 2c722b0f06..b0d2f0f863 100644 --- a/test/gtest/conv_2d_wrapper.cpp +++ b/test/gtest/conv_2d_wrapper.cpp @@ -45,6 +45,16 @@ struct conv2d_driver : conv_driver } }; +std::string GetFloatArg() +{ + static const auto tmp = std::getenv("MIOPEN_TEST_FLOAT_ARG"); + if(tmp == nullptr) + { + return ""; + } + return tmp; +}; + void GetArgs(const std::tuple, std::string>& param, std::vector& tokens) { @@ -56,7 +66,6 @@ void GetArgs(const std::tuple, std::string>& param, } auto cmd = std::get<1>(param); - std::cout << cmd << std::endl; std::stringstream ss(cmd); std::istream_iterator begin(ss); @@ -65,17 +74,17 @@ void GetArgs(const std::tuple, std::string>& param, tokens.push_back(*begin++); } -class Conv2dHalf : public testing::TestWithParam, std::string>> +class Conv2dHalf : public testing::TestWithParam, std::string>>> { }; -class Conv2dInt8 : public testing::TestWithParam, std::string>> +class Conv2dInt8 : public testing::TestWithParam, std::string>>> { }; class Conv2dBFloat16 - : public testing::TestWithParam, std::string>> + : public testing::TestWithParam, std::string>>> { }; -class Conv2dFloat : public testing::TestWithParam, std::string>> +class Conv2dFloat : public testing::TestWithParam, std::string>>> { }; TEST_P(Conv2dFloat, FloatTest) @@ -83,27 +92,27 @@ TEST_P(Conv2dFloat, FloatTest) #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || - ((std::getenv("MIOPEN_TEST_FLOAT_ARG") != nullptr) && - !(strcmp(std::getenv("MIOPEN_TEST_FLOAT_ARG"), "--float") == 0))) + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx908") || GetFloatArg() != "--float") { GTEST_SKIP(); } else { - auto param = GetParam(); - std::vector tokens; - GetArgs(param, tokens); - std::vector ptrs; - - for(std::string const& str : tokens) - ptrs.push_back(str.data()); - - testing::internal::CaptureStderr(); - test_drive(ptrs.size(), ptrs.data()); - auto capture = testing::internal::GetCapturedStderr(); - EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); + auto params = GetParam(); + for(const auto& test_value : params) + { + std::vector tokens; + GetArgs(test_value, tokens); + std::vector ptrs; + + for(std::string const& str : tokens) + ptrs.push_back(str.data()); + + testing::internal::CaptureStderr(); + test_drive(ptrs.size(), ptrs.data()); + auto capture = testing::internal::GetCapturedStderr(); + EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); + } } #else @@ -111,566 +120,83 @@ TEST_P(Conv2dFloat, FloatTest) #endif }; -TEST_P(Conv2dHalf, HalfTest) +std::vector, std::string>> GetTestCases(const std::string& precision) { -#if MIOPEN_EMBED_DB - - const auto& handle = get_handle(); - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || - ((std::getenv("MIOPEN_TEST_FLOAT_ARG") != nullptr) && - !(strcmp(std::getenv("MIOPEN_TEST_FLOAT_ARG"), "--half") == 0))) - { - GTEST_SKIP(); - } - else - { - auto param = GetParam(); - std::vector tokens; - GetArgs(param, tokens); - std::vector ptrs; - - for(std::string const& str : tokens) - ptrs.push_back(str.data()); - - testing::internal::CaptureStderr(); - test_drive(ptrs.size(), ptrs.data()); - auto capture = testing::internal::GetCapturedStderr(); - EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); - } - -#else - GTEST_SKIP(); -#endif -}; - -TEST_P(Conv2dInt8, Int8Test) +const std::vector, std::string>> test_cases = { -#if MIOPEN_EMBED_DB - - const auto& handle = get_handle(); - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || - ((std::getenv("MIOPEN_TEST_FLOAT_ARG") != nullptr) && - !(strcmp(std::getenv("MIOPEN_TEST_FLOAT_ARG"), "--int8") == 0))) - { - GTEST_SKIP(); - } - else - { - auto param = GetParam(); - std::vector tokens; - GetArgs(param, tokens); - std::vector ptrs; - - for(std::string const& str : tokens) - ptrs.push_back(str.data()); - - testing::internal::CaptureStderr(); - test_drive(ptrs.size(), ptrs.data()); - auto capture = testing::internal::GetCapturedStderr(); - EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); - } - -#else - GTEST_SKIP(); -#endif + // clang-format off + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + precision + " --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + precision + " --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, + precision + " --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>( + {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, + precision + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1") + // clang-format on }; -TEST_P(Conv2dBFloat16, BFloat16Test) -{ -#if MIOPEN_EMBED_DB - - const auto& handle = get_handle(); - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || - ((std::getenv("MIOPEN_TEST_FLOAT_ARG") != nullptr) && - !(strcmp(std::getenv("MIOPEN_TEST_FLOAT_ARG"), "--bfloat16") == 0))) - { - GTEST_SKIP(); - } - else - { - auto param = GetParam(); - std::vector tokens; - GetArgs(param, tokens); - std::vector ptrs; - - for(std::string const& str : tokens) - ptrs.push_back(str.data()); - - testing::internal::CaptureStderr(); - test_drive(ptrs.size(), ptrs.data()); - auto capture = testing::internal::GetCapturedStderr(); - EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); - } - -#else - GTEST_SKIP(); -#endif -}; + return test_cases; +} INSTANTIATE_TEST_SUITE_P( Conv2dGroup, Conv2dFloat, - testing::Values( - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 1024 14 14 --weights 2048 " - "1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - " --float --disable-validation --verbose --input 128 1024 14 14 --weights 256 " - "1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - " --float --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - " --float --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - " --float --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - " --float --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --float --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"))); - -INSTANTIATE_TEST_SUITE_P( - Conv2dGroup, - Conv2dHalf, - testing::Values( - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 1024 14 14 --weights 2048 " - "1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - " --half --disable-validation --verbose --input 128 1024 14 14 --weights 256 " - "1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - " --half --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - " --half --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - " --half --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - " --half --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --half --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"))); - -INSTANTIATE_TEST_SUITE_P( - Conv2dGroup, - Conv2dInt8, - testing::Values( - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 1024 14 14 --weights 2048 " - "1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 1024 14 14 --weights 256 " - "1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - " --int8 --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - " --int8 --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - " --int8 --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --int8 --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"))); - -INSTANTIATE_TEST_SUITE_P( - Conv2dGroup, - Conv2dBFloat16, - testing::Values( - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 1024 14 14 --weights 2048 " - "1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 1024 14 14 --weights 256 " - "1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 " - "1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - " --bfloat16 --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 " - "3 --pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 " - "1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 " - "1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 " - "1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 " - "1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 " - "3 --pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 " - "1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - " --bfloat16 --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 " - "1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - " --bfloat16 --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 " - "--pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 " - "1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 " - "1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 " - "1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 " - "1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 " - "3 --pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 " - "--pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - " --bfloat16 --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 " - "--pads_strides_dilations 1 1 1 1 1 1"))); + testing::Values(GetTestCases("--float") + )); From f5d3cf1c5056089b2a9489d32b2b1f90b1633a45 Mon Sep 17 00:00:00 2001 From: alecsandraBara Date: Thu, 25 May 2023 14:29:04 +0000 Subject: [PATCH 10/29] renamed file --- test/CMakeLists.txt | 35 ---- test/gtest/conv_2d.hpp | 66 +++++++ ..._wrapper.cpp => conv_2d_implicit_gemm.cpp} | 173 ++++++++++++------ 3 files changed, 181 insertions(+), 93 deletions(-) create mode 100644 test/gtest/conv_2d.hpp rename test/gtest/{conv_2d_wrapper.cpp => conv_2d_implicit_gemm.cpp} (68%) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 65a1716ab4..7958c438c1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -735,41 +735,6 @@ if(${MIOPEN_TEST_WITH_MIOPENDRIVER}) ) endif() -# ./bin/MIOpenDriver conv -n 128 -c 1024 -H 14 -W 14 -k 2048 -y 1 -x 1 -p 0 -q 0 -u 2 -v 2 -l 1 -j 1 -m conv -g 1 -F 1 -t 1 -# MIOPEN_DEBUG_CONV_IMMED_FALLBACK=0 -if(MIOPEN_EMBED_DB) - set(MIOPEN_EMBED_TEST_ARG ${MIOPEN_TEST_FLOAT_ARG} --disable-validation --verbose) - # WORKAROUND for issue #874 - set(MIOPEN_WA_ISSUE_874_F MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0) - set(MIOPEN_WA_ISSUE_874_W MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0) - set(MIOPEN_WA_ISSUE_874_FW MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0 MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0) - # WORKAROUND for issue #1008 - set(MIOPEN_WA_ISSUE_1008 MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0) -add_custom_test(test_conv_embed_db TEST_PERF_DB_RECORD_NOT_FOUND GFX908_DISABLED GFX90A_DISABLED - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_W} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_F} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_W} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_W} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_F} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_W} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_W} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_W} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1 -) -endif() - set(IMPLICITGEMM_MLIR_ENV_BASE MIOPEN_FIND_MODE=normal) set(IMPLICITGEMM_MLIR_ENV_F ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmFwd) set(IMPLICITGEMM_MLIR_ENV_B ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmBwd) diff --git a/test/gtest/conv_2d.hpp b/test/gtest/conv_2d.hpp new file mode 100644 index 0000000000..add9d442a4 --- /dev/null +++ b/test/gtest/conv_2d.hpp @@ -0,0 +1,66 @@ +/******************************************************************************* + * + * MIT License + * + * Copyright (c) 2019 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + *******************************************************************************/ +#include "conv_common.hpp" + +template +struct conv2d_driver : conv_driver +{ + conv2d_driver() : conv_driver() + { + this->add(this->input_dims, "input"); + this->add(this->weight_tensor_dims, "weights"); + this->add(this->batch_size, + "batch_size", + this->generate_data_limited(this->get_batch_sizes(), 1)); + this->add(this->input_channels, + "input_channels", + this->generate_data_limited(this->get_input_channels(), 1, {32})); + this->add(this->output_channels, + "output_channels", + this->generate_data_limited(this->get_output_channels(), 1, {64})); + this->add(this->spatial_dim_elements, + "spatial_dim_elements", + this->generate_data_limited(this->get_2d_spatial_dims(), 1, {28, 28})); + this->add(this->filter_dims, + "filter_dims", + this->generate_data_limited(this->get_2d_filter_dims(), 2, {3, 3})); + this->add(this->pads_strides_dilations, + "pads_strides_dilations", + this->generate_data_limited(this->get_2d_pads_strides_dilations(), 2)); + this->add(this->trans_output_pads, + "trans_output_pads", + this->generate_data(this->get_2d_trans_output_pads())); + this->add(this->in_layout, "in_layout", this->generate_data({"NCHW"})); + this->add(this->fil_layout, "fil_layout", this->generate_data({"NCHW"})); + this->add(this->out_layout, "out_layout", this->generate_data({"NCHW"})); + this->add(this->deterministic, "deterministic", this->generate_data({false})); + this->add(this->tensor_vect, "tensor_vect", this->generate_data({0})); + this->add(this->vector_length, "vector_length", this->generate_data({1})); + // Only valid for int8 input and weights + this->add(this->output_type, "output_type", this->generate_data({"int32"})); + this->add(this->int8_vectorize, "int8_vectorize", this->generate_data({false})); + } +}; diff --git a/test/gtest/conv_2d_wrapper.cpp b/test/gtest/conv_2d_implicit_gemm.cpp similarity index 68% rename from test/gtest/conv_2d_wrapper.cpp rename to test/gtest/conv_2d_implicit_gemm.cpp index b0d2f0f863..d72ddc1007 100644 --- a/test/gtest/conv_2d_wrapper.cpp +++ b/test/gtest/conv_2d_implicit_gemm.cpp @@ -2,48 +2,10 @@ #include #include -#include "conv_common.hpp" +#include "conv_2d.hpp" #include "get_handle.hpp" -template -struct conv2d_driver : conv_driver -{ - conv2d_driver() : conv_driver() - { - this->add(this->input_dims, "input"); - this->add(this->weight_tensor_dims, "weights"); - this->add(this->batch_size, - "batch_size", - this->generate_data_limited(this->get_batch_sizes(), 1)); - this->add(this->input_channels, - "input_channels", - this->generate_data_limited(this->get_input_channels(), 1, {32})); - this->add(this->output_channels, - "output_channels", - this->generate_data_limited(this->get_output_channels(), 1, {64})); - this->add(this->spatial_dim_elements, - "spatial_dim_elements", - this->generate_data_limited(this->get_2d_spatial_dims(), 1, {28, 28})); - this->add(this->filter_dims, - "filter_dims", - this->generate_data_limited(this->get_2d_filter_dims(), 2, {3, 3})); - this->add(this->pads_strides_dilations, - "pads_strides_dilations", - this->generate_data_limited(this->get_2d_pads_strides_dilations(), 2)); - this->add(this->trans_output_pads, - "trans_output_pads", - this->generate_data(this->get_2d_trans_output_pads())); - this->add(this->in_layout, "in_layout", this->generate_data({"NCHW"})); - this->add(this->fil_layout, "fil_layout", this->generate_data({"NCHW"})); - this->add(this->out_layout, "out_layout", this->generate_data({"NCHW"})); - this->add(this->deterministic, "deterministic", this->generate_data({false})); - this->add(this->tensor_vect, "tensor_vect", this->generate_data({0})); - this->add(this->vector_length, "vector_length", this->generate_data({1})); - // Only valid for int8 input and weights - this->add(this->output_type, "output_type", this->generate_data({"int32"})); - this->add(this->int8_vectorize, "int8_vectorize", this->generate_data({false})); - } -}; +using TestCase = std::tuple, std::string>; std::string GetFloatArg() { @@ -55,8 +17,7 @@ std::string GetFloatArg() return tmp; }; -void GetArgs(const std::tuple, std::string>& param, - std::vector& tokens) +void GetArgs(const TestCase& param, std::vector& tokens) { auto env_vars = std::get<0>(param); for(auto& elem : env_vars) @@ -74,25 +35,25 @@ void GetArgs(const std::tuple, std::string>& param, tokens.push_back(*begin++); } -class Conv2dHalf : public testing::TestWithParam, std::string>>> +class Conv2dHalf : public testing::TestWithParam> { }; -class Conv2dInt8 : public testing::TestWithParam, std::string>>> +class Conv2dInt8 : public testing::TestWithParam> { }; -class Conv2dBFloat16 - : public testing::TestWithParam, std::string>>> +class Conv2dBFloat16 : public testing::TestWithParam> { }; -class Conv2dFloat : public testing::TestWithParam, std::string>>> +class Conv2dFloat : public testing::TestWithParam> { }; + TEST_P(Conv2dFloat, FloatTest) { #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx908") || GetFloatArg() != "--float") + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--float") { GTEST_SKIP(); } @@ -120,11 +81,108 @@ TEST_P(Conv2dFloat, FloatTest) #endif }; -std::vector, std::string>> GetTestCases(const std::string& precision) +TEST_P(Conv2dHalf, HalfTest) { -const std::vector, std::string>> test_cases = +#if MIOPEN_EMBED_DB + + const auto& handle = get_handle(); + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--half") + { + GTEST_SKIP(); + } + else + { + auto params = GetParam(); + for(const auto& test_value : params) + { + std::vector tokens; + GetArgs(test_value, tokens); + std::vector ptrs; + + for(std::string const& str : tokens) + ptrs.push_back(str.data()); + + testing::internal::CaptureStderr(); + test_drive(ptrs.size(), ptrs.data()); + auto capture = testing::internal::GetCapturedStderr(); + EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); + } + } + +#else + GTEST_SKIP(); +#endif +}; + +TEST_P(Conv2dInt8, Int8Test) { - // clang-format off +#if MIOPEN_EMBED_DB + + const auto& handle = get_handle(); + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--int8") + { + GTEST_SKIP(); + } + else + { + auto params = GetParam(); + for(const auto& test_value : params) + { + std::vector tokens; + GetArgs(test_value, tokens); + std::vector ptrs; + + for(std::string const& str : tokens) + ptrs.push_back(str.data()); + + testing::internal::CaptureStderr(); + test_drive(ptrs.size(), ptrs.data()); + auto capture = testing::internal::GetCapturedStderr(); + EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); + } + } + +#else + GTEST_SKIP(); +#endif +}; + +TEST_P(Conv2dBFloat16, BFloat16Test) +{ +#if MIOPEN_EMBED_DB + + const auto& handle = get_handle(); + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--bfloat16") + { + GTEST_SKIP(); + } + else + { + auto params = GetParam(); + for(const auto& test_value : params) + { + std::vector tokens; + GetArgs(test_value, tokens); + std::vector ptrs; + + for(std::string const& str : tokens) + ptrs.push_back(str.data()); + + testing::internal::CaptureStderr(); + test_drive(ptrs.size(), ptrs.data()); + auto capture = testing::internal::GetCapturedStderr(); + EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); + } + } + +#else + GTEST_SKIP(); +#endif +}; +std::vector GetTestCases(const std::string& precision) +{ + const std::vector test_cases = { + // clang-format off std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), @@ -189,14 +247,13 @@ const std::vector, std::string>> test_cases std::make_tuple, std::string>( {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, precision + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1") - // clang-format on -}; + // clang-format on + }; return test_cases; } -INSTANTIATE_TEST_SUITE_P( - Conv2dGroup, - Conv2dFloat, - testing::Values(GetTestCases("--float") - )); +INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dFloat, testing::Values(GetTestCases("--float"))); +INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dHalf, testing::Values(GetTestCases("--half"))); +INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dInt8, testing::Values(GetTestCases("--int8"))); +INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dBFloat16, testing::Values(GetTestCases("--bfloat16"))); From c5cbb1adecd94dcb878a7543d2dc322ca2fa40e0 Mon Sep 17 00:00:00 2001 From: alecsandraBara Date: Thu, 25 May 2023 16:15:29 +0000 Subject: [PATCH 11/29] code cleanup --- test/gtest/conv_2d_implicit_gemm.cpp | 102 +++++++++++---------------- 1 file changed, 42 insertions(+), 60 deletions(-) diff --git a/test/gtest/conv_2d_implicit_gemm.cpp b/test/gtest/conv_2d_implicit_gemm.cpp index d72ddc1007..c206e5804b 100644 --- a/test/gtest/conv_2d_implicit_gemm.cpp +++ b/test/gtest/conv_2d_implicit_gemm.cpp @@ -7,6 +7,14 @@ using TestCase = std::tuple, std::string>; +enum class Precision +{ + Float, + Half, + Int8, + BFloat16 +}; + std::string GetFloatArg() { static const auto tmp = std::getenv("MIOPEN_TEST_FLOAT_ARG"); @@ -48,6 +56,35 @@ class Conv2dFloat : public testing::TestWithParam> { }; +void Run2dDriver(Precision prec) +{ + + std::vector params; + switch(prec) + { + case Precision::Float: params = Conv2dFloat::GetParam(); break; + case Precision::Half: params = Conv2dHalf::GetParam(); break; + case Precision::Int8: params = Conv2dInt8::GetParam(); break; + case Precision::BFloat16: params = Conv2dBFloat16::GetParam(); break; + default: params = Conv2dFloat::GetParam(); + } + + for(const auto& test_value : params) + { + std::vector tokens; + GetArgs(test_value, tokens); + std::vector ptrs; + + for(std::string const& str : tokens) + ptrs.push_back(str.data()); + + testing::internal::CaptureStderr(); + test_drive(ptrs.size(), ptrs.data()); + auto capture = testing::internal::GetCapturedStderr(); + EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); + } +}; + TEST_P(Conv2dFloat, FloatTest) { #if MIOPEN_EMBED_DB @@ -59,21 +96,7 @@ TEST_P(Conv2dFloat, FloatTest) } else { - auto params = GetParam(); - for(const auto& test_value : params) - { - std::vector tokens; - GetArgs(test_value, tokens); - std::vector ptrs; - - for(std::string const& str : tokens) - ptrs.push_back(str.data()); - - testing::internal::CaptureStderr(); - test_drive(ptrs.size(), ptrs.data()); - auto capture = testing::internal::GetCapturedStderr(); - EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); - } + Run2dDriver(Precision::Float); } #else @@ -92,21 +115,7 @@ TEST_P(Conv2dHalf, HalfTest) } else { - auto params = GetParam(); - for(const auto& test_value : params) - { - std::vector tokens; - GetArgs(test_value, tokens); - std::vector ptrs; - - for(std::string const& str : tokens) - ptrs.push_back(str.data()); - - testing::internal::CaptureStderr(); - test_drive(ptrs.size(), ptrs.data()); - auto capture = testing::internal::GetCapturedStderr(); - EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); - } + Run2dDriver(Precision::Half); } #else @@ -125,21 +134,7 @@ TEST_P(Conv2dInt8, Int8Test) } else { - auto params = GetParam(); - for(const auto& test_value : params) - { - std::vector tokens; - GetArgs(test_value, tokens); - std::vector ptrs; - - for(std::string const& str : tokens) - ptrs.push_back(str.data()); - - testing::internal::CaptureStderr(); - test_drive(ptrs.size(), ptrs.data()); - auto capture = testing::internal::GetCapturedStderr(); - EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); - } + Run2dDriver(Precision::Int8); } #else @@ -158,27 +153,14 @@ TEST_P(Conv2dBFloat16, BFloat16Test) } else { - auto params = GetParam(); - for(const auto& test_value : params) - { - std::vector tokens; - GetArgs(test_value, tokens); - std::vector ptrs; - - for(std::string const& str : tokens) - ptrs.push_back(str.data()); - - testing::internal::CaptureStderr(); - test_drive(ptrs.size(), ptrs.data()); - auto capture = testing::internal::GetCapturedStderr(); - EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); - } + Run2dDriver(Precision::BFloat16); } #else GTEST_SKIP(); #endif }; + std::vector GetTestCases(const std::string& precision) { const std::vector test_cases = { From ae29c5dc3656e1123e8068e26a8d1a1fc0676718 Mon Sep 17 00:00:00 2001 From: alecsandraBara Date: Tue, 30 May 2023 22:24:45 +0000 Subject: [PATCH 12/29] addressed reviews --- test/gtest/conv_2d.hpp | 2 +- test/gtest/conv_2d_implicit_gemm.cpp | 241 -------------------------- test/gtest/conv_embed_db.cpp | 243 +++++++++++++++++++++++++++ 3 files changed, 244 insertions(+), 242 deletions(-) delete mode 100644 test/gtest/conv_2d_implicit_gemm.cpp create mode 100644 test/gtest/conv_embed_db.cpp diff --git a/test/gtest/conv_2d.hpp b/test/gtest/conv_2d.hpp index add9d442a4..df73453ef2 100644 --- a/test/gtest/conv_2d.hpp +++ b/test/gtest/conv_2d.hpp @@ -2,7 +2,7 @@ * * MIT License * - * Copyright (c) 2019 Advanced Micro Devices, Inc. + * Copyright (c) 2023 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/test/gtest/conv_2d_implicit_gemm.cpp b/test/gtest/conv_2d_implicit_gemm.cpp deleted file mode 100644 index c206e5804b..0000000000 --- a/test/gtest/conv_2d_implicit_gemm.cpp +++ /dev/null @@ -1,241 +0,0 @@ -#include - -#include -#include -#include "conv_2d.hpp" -#include "get_handle.hpp" - -using TestCase = std::tuple, std::string>; - -enum class Precision -{ - Float, - Half, - Int8, - BFloat16 -}; - -std::string GetFloatArg() -{ - static const auto tmp = std::getenv("MIOPEN_TEST_FLOAT_ARG"); - if(tmp == nullptr) - { - return ""; - } - return tmp; -}; - -void GetArgs(const TestCase& param, std::vector& tokens) -{ - auto env_vars = std::get<0>(param); - for(auto& elem : env_vars) - { - std::cout << elem.data() << std::endl; - putenv(elem.data()); - } - - auto cmd = std::get<1>(param); - - std::stringstream ss(cmd); - std::istream_iterator begin(ss); - std::istream_iterator end; - while(begin != end) - tokens.push_back(*begin++); -} - -class Conv2dHalf : public testing::TestWithParam> -{ -}; -class Conv2dInt8 : public testing::TestWithParam> -{ -}; -class Conv2dBFloat16 : public testing::TestWithParam> -{ -}; -class Conv2dFloat : public testing::TestWithParam> -{ -}; - -void Run2dDriver(Precision prec) -{ - - std::vector params; - switch(prec) - { - case Precision::Float: params = Conv2dFloat::GetParam(); break; - case Precision::Half: params = Conv2dHalf::GetParam(); break; - case Precision::Int8: params = Conv2dInt8::GetParam(); break; - case Precision::BFloat16: params = Conv2dBFloat16::GetParam(); break; - default: params = Conv2dFloat::GetParam(); - } - - for(const auto& test_value : params) - { - std::vector tokens; - GetArgs(test_value, tokens); - std::vector ptrs; - - for(std::string const& str : tokens) - ptrs.push_back(str.data()); - - testing::internal::CaptureStderr(); - test_drive(ptrs.size(), ptrs.data()); - auto capture = testing::internal::GetCapturedStderr(); - EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); - } -}; - -TEST_P(Conv2dFloat, FloatTest) -{ -#if MIOPEN_EMBED_DB - - const auto& handle = get_handle(); - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--float") - { - GTEST_SKIP(); - } - else - { - Run2dDriver(Precision::Float); - } - -#else - GTEST_SKIP(); -#endif -}; - -TEST_P(Conv2dHalf, HalfTest) -{ -#if MIOPEN_EMBED_DB - - const auto& handle = get_handle(); - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--half") - { - GTEST_SKIP(); - } - else - { - Run2dDriver(Precision::Half); - } - -#else - GTEST_SKIP(); -#endif -}; - -TEST_P(Conv2dInt8, Int8Test) -{ -#if MIOPEN_EMBED_DB - - const auto& handle = get_handle(); - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--int8") - { - GTEST_SKIP(); - } - else - { - Run2dDriver(Precision::Int8); - } - -#else - GTEST_SKIP(); -#endif -}; - -TEST_P(Conv2dBFloat16, BFloat16Test) -{ -#if MIOPEN_EMBED_DB - - const auto& handle = get_handle(); - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--bfloat16") - { - GTEST_SKIP(); - } - else - { - Run2dDriver(Precision::BFloat16); - } - -#else - GTEST_SKIP(); -#endif -}; - -std::vector GetTestCases(const std::string& precision) -{ - const std::vector test_cases = { - // clang-format off - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - precision + " --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - precision + " --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}, - precision + " --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>( - {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0"}, - precision + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1") - // clang-format on - }; - - return test_cases; -} - -INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dFloat, testing::Values(GetTestCases("--float"))); -INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dHalf, testing::Values(GetTestCases("--half"))); -INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dInt8, testing::Values(GetTestCases("--int8"))); -INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dBFloat16, testing::Values(GetTestCases("--bfloat16"))); diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp new file mode 100644 index 0000000000..df2243c704 --- /dev/null +++ b/test/gtest/conv_embed_db.cpp @@ -0,0 +1,243 @@ +#include + +#include +#include +#include "conv_2d.hpp" +#include "get_handle.hpp" + +using TestCase = std::tuple, std::string>; + +enum class Precision +{ + Float, + Half, + Int8, + BFloat16 +}; + +std::string GetFloatArg() +{ + static const auto tmp = std::getenv("MIOPEN_TEST_FLOAT_ARG"); + if(tmp == nullptr) + { + return ""; + } + return tmp; +}; + +std::vector GetEnvVars(const std::vector& check_vars) +{ + std::vector vars = {}; + for(const auto& cvar : check_vars) + { + static const auto tmp = std::getenv(cvar.c_str()); + if(tmp != nullptr) + { + vars.push_back(cvar + "=0"); + } + } + return vars; +}; + +void GetArgs(const TestCase& param, std::vector& tokens) +{ + auto env_vars = std::get<0>(param); + for(auto& elem : env_vars) + { + putenv(elem.data()); + } + + auto cmd = std::get<1>(param); + + std::stringstream ss(cmd); + std::istream_iterator begin(ss); + std::istream_iterator end; + while(begin != end) + tokens.push_back(*begin++); +} + +class Conv2dHalf : public testing::TestWithParam> +{ +}; +class Conv2dInt8 : public testing::TestWithParam> +{ +}; +class Conv2dBFloat16 : public testing::TestWithParam> +{ +}; +class Conv2dFloat : public testing::TestWithParam> +{ +}; + +void Run2dDriver(Precision prec) +{ + + std::vector params; + switch(prec) + { + case Precision::Float: params = Conv2dFloat::GetParam(); break; + case Precision::Half: params = Conv2dHalf::GetParam(); break; + case Precision::Int8: params = Conv2dInt8::GetParam(); break; + case Precision::BFloat16: params = Conv2dBFloat16::GetParam(); break; + default: params = Conv2dFloat::GetParam(); + } + + for(const auto& test_value : params) + { + std::vector tokens; + GetArgs(test_value, tokens); + std::vector ptrs; + + std::transform(tokens.begin(), tokens.end(), std::back_inserter(ptrs), [](const auto& str) { + return str.data(); + }); + + testing::internal::CaptureStderr(); + test_drive(ptrs.size(), ptrs.data()); + auto capture = testing::internal::GetCapturedStderr(); + EXPECT_FALSE(capture.find("Perf Db: record not found") != std::string::npos); + } +}; + +TEST_P(Conv2dFloat, FloatTest) +{ +#if MIOPEN_EMBED_DB + + const auto& handle = get_handle(); + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--float") + { + GTEST_SKIP(); + } + else + { + Run2dDriver(Precision::Float); + } + +#else + GTEST_SKIP(); +#endif +}; + +TEST_P(Conv2dHalf, HalfTest) +{ +#if MIOPEN_EMBED_DB + + const auto& handle = get_handle(); + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--half") + { + GTEST_SKIP(); + } + else + { + Run2dDriver(Precision::Half); + } + +#else + GTEST_SKIP(); +#endif +}; + +TEST_P(Conv2dInt8, Int8Test) +{ +#if MIOPEN_EMBED_DB + + const auto& handle = get_handle(); + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--int8") + { + GTEST_SKIP(); + } + else + { + Run2dDriver(Precision::Int8); + } + +#else + GTEST_SKIP(); +#endif +}; + +TEST_P(Conv2dBFloat16, BFloat16Test) +{ +#if MIOPEN_EMBED_DB + + const auto& handle = get_handle(); + if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--bfloat16") + { + GTEST_SKIP(); + } + else + { + Run2dDriver(Precision::BFloat16); + } + +#else + GTEST_SKIP(); +#endif +}; + +std::vector GetTestCases(const std::string& precision) +{ + + std::vector winograd = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2"}; + std::vector igemm_wrw = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1"}; + std::vector igemm_fwd = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1"}; + std::vector igemm_fwd_wrw = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1"}; + + const std::vector test_cases = { + // clang-format off + std::make_tuple, std::string>(GetEnvVars(igemm_wrw), precision + + " --disable-validation --verbose --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_fwd), precision + + " --disable-validation --verbose --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_wrw), precision + + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>(GetEnvVars(winograd), precision + + " --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_wrw), precision + + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + + " --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + + " --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_fwd), precision + + " --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_wrw), precision + + " --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + + " --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>(GetEnvVars(winograd), precision + + " --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + + " --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>(GetEnvVars(winograd), precision + + " --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + + " --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + + " --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_fwd), precision + + " --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + + " --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_wrw), precision + + " --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + + " --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + std::make_tuple, std::string>(GetEnvVars(igemm_wrw), precision + + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1") + // clang-format on + }; + + return test_cases; +} + +INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dFloat, testing::Values(GetTestCases("--float"))); +INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dHalf, testing::Values(GetTestCases("--half"))); +INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dInt8, testing::Values(GetTestCases("--int8"))); +INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dBFloat16, testing::Values(GetTestCases("--bfloat16"))); From beb7fcb3847b8447e89d41dad86e6bea375d3de5 Mon Sep 17 00:00:00 2001 From: xinlipn Date: Fri, 2 Jun 2023 00:41:52 -0700 Subject: [PATCH 13/29] Cleaned up test case creation, skip tests for gfx908 and gfx90a, addressed other comments --- test/gtest/conv_embed_db.cpp | 145 ++++++++++++++--------------------- 1 file changed, 57 insertions(+), 88 deletions(-) diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index df2243c704..e294baa7a6 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -2,18 +2,12 @@ #include #include +#include #include "conv_2d.hpp" #include "get_handle.hpp" using TestCase = std::tuple, std::string>; - -enum class Precision -{ - Float, - Half, - Int8, - BFloat16 -}; +#define MAKE_TEST_CASE std::make_tuple, std::string> std::string GetFloatArg() { @@ -25,20 +19,6 @@ std::string GetFloatArg() return tmp; }; -std::vector GetEnvVars(const std::vector& check_vars) -{ - std::vector vars = {}; - for(const auto& cvar : check_vars) - { - static const auto tmp = std::getenv(cvar.c_str()); - if(tmp != nullptr) - { - vars.push_back(cvar + "=0"); - } - } - return vars; -}; - void GetArgs(const TestCase& param, std::vector& tokens) { auto env_vars = std::get<0>(param); @@ -69,16 +49,23 @@ class Conv2dFloat : public testing::TestWithParam> { }; -void Run2dDriver(Precision prec) +void Run2dDriver(miopenDataType_t prec) { std::vector params; switch(prec) { - case Precision::Float: params = Conv2dFloat::GetParam(); break; - case Precision::Half: params = Conv2dHalf::GetParam(); break; - case Precision::Int8: params = Conv2dInt8::GetParam(); break; - case Precision::BFloat16: params = Conv2dBFloat16::GetParam(); break; + case miopenFloat: params = Conv2dFloat::GetParam(); break; + case miopenHalf: params = Conv2dHalf::GetParam(); break; + case miopenInt8: params = Conv2dInt8::GetParam(); break; + case miopenBFloat16: params = Conv2dBFloat16::GetParam(); break; + case miopenInt8x4: + case miopenInt32: + case miopenDouble: + MIOPEN_THROW(miopenStatusBadParm, + "miopenInt8x4, miopenInt32, miopenDouble data type not supported by " + "conv_embed_db test"); + default: params = Conv2dFloat::GetParam(); } @@ -88,9 +75,8 @@ void Run2dDriver(Precision prec) GetArgs(test_value, tokens); std::vector ptrs; - std::transform(tokens.begin(), tokens.end(), std::back_inserter(ptrs), [](const auto& str) { - return str.data(); - }); + for(std::string const& str : tokens) + ptrs.push_back(str.data()); testing::internal::CaptureStderr(); test_drive(ptrs.size(), ptrs.data()); @@ -104,13 +90,14 @@ TEST_P(Conv2dFloat, FloatTest) #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--float") + if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || + miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || GetFloatArg() != "--float") { GTEST_SKIP(); } else { - Run2dDriver(Precision::Float); + Run2dDriver(miopenFloat); } #else @@ -123,13 +110,14 @@ TEST_P(Conv2dHalf, HalfTest) #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--half") + if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || + miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || GetFloatArg() != "--half") { GTEST_SKIP(); } else { - Run2dDriver(Precision::Half); + Run2dDriver(miopenHalf); } #else @@ -142,13 +130,14 @@ TEST_P(Conv2dInt8, Int8Test) #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--int8") + if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || + miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || GetFloatArg() != "--int8") { GTEST_SKIP(); } else { - Run2dDriver(Precision::Int8); + Run2dDriver(miopenInt8); } #else @@ -161,13 +150,14 @@ TEST_P(Conv2dBFloat16, BFloat16Test) #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(!miopen::StartsWith(handle.GetDeviceName(), "gfx906") || GetFloatArg() != "--bfloat16") + if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || + miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || GetFloatArg() != "--bfloat16") { GTEST_SKIP(); } else { - Run2dDriver(Precision::BFloat16); + Run2dDriver(miopenBFloat16); } #else @@ -178,59 +168,38 @@ TEST_P(Conv2dBFloat16, BFloat16Test) std::vector GetTestCases(const std::string& precision) { - std::vector winograd = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2"}; - std::vector igemm_wrw = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1"}; - std::vector igemm_fwd = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1"}; - std::vector igemm_fwd_wrw = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1"}; + std::vector winograd = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}; + std::vector igemm_wrw = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1=0"}; + std::vector igemm_fwd = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1=0"}; + std::vector igemm_fwd_wrw = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1=0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1=0"}; const std::vector test_cases = { // clang-format off - std::make_tuple, std::string>(GetEnvVars(igemm_wrw), precision + - " --disable-validation --verbose --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_fwd), precision + - " --disable-validation --verbose --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_wrw), precision + - " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>(GetEnvVars(winograd), precision + - " --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_wrw), precision + - " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + - " --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + - " --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_fwd), precision + - " --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_wrw), precision + - " --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + - " --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>(GetEnvVars(winograd), precision + - " --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + - " --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>(GetEnvVars(winograd), precision + - " --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + - " --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + - " --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_fwd), precision + - " --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + - " --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_wrw), precision + - " --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + - " --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_fwd_wrw), precision + - " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - std::make_tuple, std::string>(GetEnvVars(igemm_wrw), precision + - " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1") + MAKE_TEST_CASE(std::move(winograd), precision + " --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + MAKE_TEST_CASE(std::move(winograd), precision + " --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(std::move(winograd), precision + " --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(std::move(igemm_wrw), precision + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + MAKE_TEST_CASE(std::move(igemm_wrw), precision + " --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + MAKE_TEST_CASE(std::move(igemm_wrw), precision + " --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + MAKE_TEST_CASE(std::move(igemm_wrw), precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(std::move(igemm_wrw), precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(std::move(igemm_wrw), precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(std::move(igemm_fwd), precision + " --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(std::move(igemm_fwd), precision + " --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(std::move(igemm_fwd), precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1") // clang-format on }; From d86eb8d4e6ac40cdbc77c64ca30f676c60b9bad3 Mon Sep 17 00:00:00 2001 From: xinlipn Date: Sun, 4 Jun 2023 23:37:15 -0700 Subject: [PATCH 14/29] Bring back GetEnvVars(), removed duplicated wrw test --- test/gtest/conv_embed_db.cpp | 79 +++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 32 deletions(-) diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index e294baa7a6..6f922c7e5a 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "conv_2d.hpp" #include "get_handle.hpp" @@ -11,12 +12,26 @@ using TestCase = std::tuple, std::string>; std::string GetFloatArg() { - static const auto tmp = std::getenv("MIOPEN_TEST_FLOAT_ARG"); - if(tmp == nullptr) + static const auto tmp = miopen::GetEnv("MIOPEN_TEST_FLOAT_ARG"); + if(tmp.empty()) { return ""; } - return tmp; + return tmp.front(); +}; + +std::vector GetEnvVars(const std::vector& check_vars) +{ + std::vector vars = {}; + for(const auto& cvar : check_vars) + { + static const auto tmp = miopen::GetEnv(cvar.c_str()); + if(!tmp.empty()) + { + vars.push_back(cvar + "=0"); + } + } + return vars; }; void GetArgs(const TestCase& param, std::vector& tokens) @@ -168,38 +183,38 @@ TEST_P(Conv2dBFloat16, BFloat16Test) std::vector GetTestCases(const std::string& precision) { - std::vector winograd = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0"}; - std::vector igemm_wrw = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1=0"}; - std::vector igemm_fwd = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1=0"}; - std::vector igemm_fwd_wrw = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1=0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1=0"}; + std::vector winograd = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2"}; + std::vector igemm_wrw = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1"}; + std::vector igemm_fwd = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1"}; + std::vector igemm_fwd_wrw = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1"}; + std::string flags = " --disable-validation --verbose"; const std::vector test_cases = { // clang-format off - MAKE_TEST_CASE(std::move(winograd), precision + " --disable-validation --verbose --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - MAKE_TEST_CASE(std::move(winograd), precision + " --disable-validation --verbose --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(std::move(winograd), precision + " --disable-validation --verbose --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(std::move(igemm_wrw), precision + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - MAKE_TEST_CASE(std::move(igemm_wrw), precision + " --disable-validation --verbose --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - MAKE_TEST_CASE(std::move(igemm_wrw), precision + " --disable-validation --verbose --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - MAKE_TEST_CASE(std::move(igemm_wrw), precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(std::move(igemm_wrw), precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(std::move(igemm_wrw), precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(std::move(igemm_fwd), precision + " --disable-validation --verbose --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(std::move(igemm_fwd), precision + " --disable-validation --verbose --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(std::move(igemm_fwd), precision + " --disable-validation --verbose --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(std::move(igemm_fwd_wrw), precision + " --disable-validation --verbose --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1") + MAKE_TEST_CASE(GetEnvVars(winograd), precision + flags + " --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + MAKE_TEST_CASE(GetEnvVars(winograd), precision + flags + " --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(GetEnvVars(winograd), precision + flags + " --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_wrw), precision + flags + " --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_wrw), precision + flags + " --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_wrw), precision + flags + " --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_wrw), precision + flags + " --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_wrw), precision + flags + " --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_fwd), precision + flags + " --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_fwd), precision + flags + " --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_fwd), precision + flags + " --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), + MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1") // clang-format on }; From 4760a5a7717c96a0f52b23b1309defbeb4ec08d8 Mon Sep 17 00:00:00 2001 From: xinlipn Date: Mon, 5 Jun 2023 07:45:40 -0700 Subject: [PATCH 15/29] Replace trivial for loop with std::transform to fix hip tidy warning --- test/gtest/conv_embed_db.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index 6f922c7e5a..af5be84b18 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -90,8 +90,9 @@ void Run2dDriver(miopenDataType_t prec) GetArgs(test_value, tokens); std::vector ptrs; - for(std::string const& str : tokens) - ptrs.push_back(str.data()); + std::transform(tokens.begin(), tokens.end(), std::back_inserter(ptrs), [](const auto& str) { + return str.data(); + }); testing::internal::CaptureStderr(); test_drive(ptrs.size(), ptrs.data()); From 29afc6d0d4d98a2e821a420ac3613d74d51b9b9b Mon Sep 17 00:00:00 2001 From: xinlipn Date: Tue, 6 Jun 2023 00:39:57 -0700 Subject: [PATCH 16/29] Cleaned up code --- test/gtest/conv_embed_db.cpp | 62 +++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index af5be84b18..2c78879601 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -8,7 +8,6 @@ #include "get_handle.hpp" using TestCase = std::tuple, std::string>; -#define MAKE_TEST_CASE std::make_tuple, std::string> std::string GetFloatArg() { @@ -183,39 +182,42 @@ TEST_P(Conv2dBFloat16, BFloat16Test) std::vector GetTestCases(const std::string& precision) { - - std::vector winograd = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2"}; - std::vector igemm_wrw = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1"}; - std::vector igemm_fwd = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1"}; - std::vector igemm_fwd_wrw = {"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1"}; + std::vector winograd = { + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2"}; // WORKAROUND for issue #1008 when set to 0 + std::vector igemm_wrw = { + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", // WORKAROUND for issue #1008 when set to 0 + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1"}; // WORKAROUND for issue #874 when set to 0 + std::vector igemm_fwd = { + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", // WORKAROUND for issue #1008 when set to 0 + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1"}; // WORKAROUND for issue #874 when set to 0 + std::vector igemm_fwd_wrw = { + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", // WORKAROUND for issue #1008 when set to 0 + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1", // WORKAROUND for issue #874 when set to 0 + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1"}; // WORKAROUND for issue #874 when set to 0 std::string flags = " --disable-validation --verbose"; const std::vector test_cases = { // clang-format off - MAKE_TEST_CASE(GetEnvVars(winograd), precision + flags + " --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - MAKE_TEST_CASE(GetEnvVars(winograd), precision + flags + " --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(GetEnvVars(winograd), precision + flags + " --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_wrw), precision + flags + " --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_wrw), precision + flags + " --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_wrw), precision + flags + " --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_wrw), precision + flags + " --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_wrw), precision + flags + " --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_fwd), precision + flags + " --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_fwd), precision + flags + " --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_fwd), precision + flags + " --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"), - MAKE_TEST_CASE(GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1") + TestCase{GetEnvVars(winograd), precision + flags + " --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, + TestCase{GetEnvVars(winograd), precision + flags + " --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + TestCase{GetEnvVars(winograd), precision + flags + " --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"}, + TestCase{GetEnvVars(igemm_wrw), precision + flags + " --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, + TestCase{GetEnvVars(igemm_wrw), precision + flags + " --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, + TestCase{GetEnvVars(igemm_wrw), precision + flags + " --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, + TestCase{GetEnvVars(igemm_wrw), precision + flags + " --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + TestCase{GetEnvVars(igemm_wrw), precision + flags + " --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + TestCase{GetEnvVars(igemm_fwd), precision + flags + " --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + TestCase{GetEnvVars(igemm_fwd), precision + flags + " --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + TestCase{GetEnvVars(igemm_fwd), precision + flags + " --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"} // clang-format on }; From 2b656e53fd217526dab15e307f9e99c8dc045adb Mon Sep 17 00:00:00 2001 From: xinlipn Date: Thu, 8 Jun 2023 07:13:19 -0700 Subject: [PATCH 17/29] Remove WA per PR2179, preserved test name --- test/gtest/conv_embed_db.cpp | 161 ++++++++++++++++------------------- 1 file changed, 73 insertions(+), 88 deletions(-) diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index 2c78879601..2c4dcaea58 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -7,8 +7,6 @@ #include "conv_2d.hpp" #include "get_handle.hpp" -using TestCase = std::tuple, std::string>; - std::string GetFloatArg() { static const auto tmp = miopen::GetEnv("MIOPEN_TEST_FLOAT_ARG"); @@ -19,60 +17,38 @@ std::string GetFloatArg() return tmp.front(); }; -std::vector GetEnvVars(const std::vector& check_vars) +void GetArgs(const std::string& param, std::vector& tokens) { - std::vector vars = {}; - for(const auto& cvar : check_vars) - { - static const auto tmp = miopen::GetEnv(cvar.c_str()); - if(!tmp.empty()) - { - vars.push_back(cvar + "=0"); - } - } - return vars; -}; - -void GetArgs(const TestCase& param, std::vector& tokens) -{ - auto env_vars = std::get<0>(param); - for(auto& elem : env_vars) - { - putenv(elem.data()); - } - - auto cmd = std::get<1>(param); - - std::stringstream ss(cmd); + std::stringstream ss(param); std::istream_iterator begin(ss); std::istream_iterator end; while(begin != end) tokens.push_back(*begin++); } -class Conv2dHalf : public testing::TestWithParam> +class ConfigWithHalf : public testing::TestWithParam> { }; -class Conv2dInt8 : public testing::TestWithParam> +class ConfigWithInt8 : public testing::TestWithParam> { }; -class Conv2dBFloat16 : public testing::TestWithParam> +class ConfigWithBFloat16 : public testing::TestWithParam> { }; -class Conv2dFloat : public testing::TestWithParam> +class ConfigWithFloat : public testing::TestWithParam> { }; void Run2dDriver(miopenDataType_t prec) { - std::vector params; + std::vector params; switch(prec) { - case miopenFloat: params = Conv2dFloat::GetParam(); break; - case miopenHalf: params = Conv2dHalf::GetParam(); break; - case miopenInt8: params = Conv2dInt8::GetParam(); break; - case miopenBFloat16: params = Conv2dBFloat16::GetParam(); break; + case miopenFloat: params = ConfigWithFloat::GetParam(); break; + case miopenHalf: params = ConfigWithHalf::GetParam(); break; + case miopenInt8: params = ConfigWithInt8::GetParam(); break; + case miopenBFloat16: params = ConfigWithBFloat16::GetParam(); break; case miopenInt8x4: case miopenInt32: case miopenDouble: @@ -80,7 +56,7 @@ void Run2dDriver(miopenDataType_t prec) "miopenInt8x4, miopenInt32, miopenDouble data type not supported by " "conv_embed_db test"); - default: params = Conv2dFloat::GetParam(); + default: params = ConfigWithFloat::GetParam(); } for(const auto& test_value : params) @@ -100,13 +76,17 @@ void Run2dDriver(miopenDataType_t prec) } }; -TEST_P(Conv2dFloat, FloatTest) +TEST_P(ConfigWithFloat, FloatTest) { #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || - miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || GetFloatArg() != "--float") + if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || // Explicitly disabled + miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || // Explicitly disabled + miopen::StartsWith(handle.GetDeviceName(), "gfx94") || // Implicitly disabled by default + miopen::StartsWith(handle.GetDeviceName(), "gfx103") || // Implicitly disabled by default + miopen::StartsWith(handle.GetDeviceName(), "gfx110") || // Implicitly disabled by default + GetFloatArg() != "--float") { GTEST_SKIP(); } @@ -120,13 +100,17 @@ TEST_P(Conv2dFloat, FloatTest) #endif }; -TEST_P(Conv2dHalf, HalfTest) +TEST_P(ConfigWithHalf, HalfTest) { #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || - miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || GetFloatArg() != "--half") + if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || // Explicitly disabled + miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || // Explicitly disabled + miopen::StartsWith(handle.GetDeviceName(), "gfx94") || // Implicitly disabled by default + miopen::StartsWith(handle.GetDeviceName(), "gfx103") || // Implicitly disabled by default + miopen::StartsWith(handle.GetDeviceName(), "gfx110") || // Implicitly disabled by default + GetFloatArg() != "--half") { GTEST_SKIP(); } @@ -140,13 +124,17 @@ TEST_P(Conv2dHalf, HalfTest) #endif }; -TEST_P(Conv2dInt8, Int8Test) +TEST_P(ConfigWithInt8, Int8Test) { #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || - miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || GetFloatArg() != "--int8") + if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || // Explicitly disabled + miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || // Explicitly disabled + miopen::StartsWith(handle.GetDeviceName(), "gfx94") || // Implicitly disabled by default + miopen::StartsWith(handle.GetDeviceName(), "gfx103") || // Implicitly disabled by default + miopen::StartsWith(handle.GetDeviceName(), "gfx110") || // Implicitly disabled by default + GetFloatArg() != "--int8") { GTEST_SKIP(); } @@ -160,13 +148,17 @@ TEST_P(Conv2dInt8, Int8Test) #endif }; -TEST_P(Conv2dBFloat16, BFloat16Test) +TEST_P(ConfigWithBFloat16, BFloat16Test) { #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || - miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || GetFloatArg() != "--bfloat16") + if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || // Explicitly disabled + miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || // Explicitly disabled + miopen::StartsWith(handle.GetDeviceName(), "gfx94") || // Implicitly disabled by default + miopen::StartsWith(handle.GetDeviceName(), "gfx103") || // Implicitly disabled by default + miopen::StartsWith(handle.GetDeviceName(), "gfx110") || // Implicitly disabled by default + GetFloatArg() != "--bfloat16") { GTEST_SKIP(); } @@ -180,51 +172,44 @@ TEST_P(Conv2dBFloat16, BFloat16Test) #endif }; -std::vector GetTestCases(const std::string& precision) +std::vector GetTestCases(const std::string& precision) { - std::vector winograd = { - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2"}; // WORKAROUND for issue #1008 when set to 0 - std::vector igemm_wrw = { - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", // WORKAROUND for issue #1008 when set to 0 - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1"}; // WORKAROUND for issue #874 when set to 0 - std::vector igemm_fwd = { - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", // WORKAROUND for issue #1008 when set to 0 - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1"}; // WORKAROUND for issue #874 when set to 0 - std::vector igemm_fwd_wrw = { - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", // WORKAROUND for issue #1008 when set to 0 - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_4R1", // WORKAROUND for issue #874 when set to 0 - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_4R1"}; // WORKAROUND for issue #874 when set to 0 - - std::string flags = " --disable-validation --verbose"; - const std::vector test_cases = { +#if MIOPEN_EMBED_DB + std::string flags = " --disable-validation --verbose "; +#else + std::string flags = " "; +#endif + const std::vector test_cases = { // clang-format off - TestCase{GetEnvVars(winograd), precision + flags + " --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, - TestCase{GetEnvVars(winograd), precision + flags + " --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, - TestCase{GetEnvVars(winograd), precision + flags + " --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"}, - TestCase{GetEnvVars(igemm_wrw), precision + flags + " --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, - TestCase{GetEnvVars(igemm_wrw), precision + flags + " --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, - TestCase{GetEnvVars(igemm_wrw), precision + flags + " --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, - TestCase{GetEnvVars(igemm_wrw), precision + flags + " --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, - TestCase{GetEnvVars(igemm_wrw), precision + flags + " --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, - TestCase{GetEnvVars(igemm_fwd), precision + flags + " --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - TestCase{GetEnvVars(igemm_fwd), precision + flags + " --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, - TestCase{GetEnvVars(igemm_fwd), precision + flags + " --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, - TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, - TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - TestCase{GetEnvVars(igemm_fwd_wrw), precision + flags + " --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"} + {precision + flags + "--input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, + {precision + flags + "--input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + {precision + flags + "--input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"}, + {precision + flags + "--input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, + {precision + flags + "--input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, + {precision + flags + "--input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, + {precision + flags + "--input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + {precision + flags + "--input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + {precision + flags + "--input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {precision + flags + "--input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + {precision + flags + "--input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {precision + flags + "--input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {precision + flags + "--input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {precision + flags + "--input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {precision + flags + "--input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + {precision + flags + "--input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {precision + flags + "--input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + {precision + flags + "--input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {precision + flags + "--input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {precision + flags + "--input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"} // clang-format on }; return test_cases; } -INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dFloat, testing::Values(GetTestCases("--float"))); -INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dHalf, testing::Values(GetTestCases("--half"))); -INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dInt8, testing::Values(GetTestCases("--int8"))); -INSTANTIATE_TEST_SUITE_P(Conv2dGroup, Conv2dBFloat16, testing::Values(GetTestCases("--bfloat16"))); +INSTANTIATE_TEST_SUITE_P(ConvEmbedDB, ConfigWithFloat, testing::Values(GetTestCases("--float"))); +INSTANTIATE_TEST_SUITE_P(ConvEmbedDB, ConfigWithHalf, testing::Values(GetTestCases("--half"))); +INSTANTIATE_TEST_SUITE_P(ConvEmbedDB, ConfigWithInt8, testing::Values(GetTestCases("--int8"))); +INSTANTIATE_TEST_SUITE_P(ConvEmbedDB, + ConfigWithBFloat16, + testing::Values(GetTestCases("--bfloat16"))); From 77dc83dd96cfe1c2dcee11214c87b0b000ef9c23 Mon Sep 17 00:00:00 2001 From: xinlipn Date: Fri, 9 Jun 2023 00:35:59 -0700 Subject: [PATCH 18/29] Refactor duplicated code --- test/conv2d.cpp | 40 ---------------------- test/conv_common.hpp | 40 ++++++++++++++++++++++ test/gtest/conv_2d.hpp | 66 ------------------------------------ test/gtest/conv_embed_db.cpp | 2 +- 4 files changed, 41 insertions(+), 107 deletions(-) delete mode 100644 test/gtest/conv_2d.hpp diff --git a/test/conv2d.cpp b/test/conv2d.cpp index f781f1c653..2aee7f8449 100644 --- a/test/conv2d.cpp +++ b/test/conv2d.cpp @@ -25,44 +25,4 @@ *******************************************************************************/ #include "conv_common.hpp" -template -struct conv2d_driver : conv_driver -{ - conv2d_driver() : conv_driver() - { - this->add(this->input_dims, "input"); - this->add(this->weight_tensor_dims, "weights"); - this->add(this->batch_size, - "batch_size", - this->generate_data_limited(this->get_batch_sizes(), 1)); - this->add(this->input_channels, - "input_channels", - this->generate_data_limited(this->get_input_channels(), 1, {32})); - this->add(this->output_channels, - "output_channels", - this->generate_data_limited(this->get_output_channels(), 1, {64})); - this->add(this->spatial_dim_elements, - "spatial_dim_elements", - this->generate_data_limited(this->get_2d_spatial_dims(), 1, {28, 28})); - this->add(this->filter_dims, - "filter_dims", - this->generate_data_limited(this->get_2d_filter_dims(), 2, {3, 3})); - this->add(this->pads_strides_dilations, - "pads_strides_dilations", - this->generate_data_limited(this->get_2d_pads_strides_dilations(), 2)); - this->add(this->trans_output_pads, - "trans_output_pads", - this->generate_data(this->get_2d_trans_output_pads())); - this->add(this->in_layout, "in_layout", this->generate_data({"NCHW"})); - this->add(this->fil_layout, "fil_layout", this->generate_data({"NCHW"})); - this->add(this->out_layout, "out_layout", this->generate_data({"NCHW"})); - this->add(this->deterministic, "deterministic", this->generate_data({false})); - this->add(this->tensor_vect, "tensor_vect", this->generate_data({0})); - this->add(this->vector_length, "vector_length", this->generate_data({1})); - // Only valid for int8 input and weights - this->add(this->output_type, "output_type", this->generate_data({"int32"})); - this->add(this->int8_vectorize, "int8_vectorize", this->generate_data({false})); - } -}; - int main(int argc, const char* argv[]) { test_drive(argc, argv); } diff --git a/test/conv_common.hpp b/test/conv_common.hpp index 6d665e0845..519d5ace96 100644 --- a/test/conv_common.hpp +++ b/test/conv_common.hpp @@ -2466,6 +2466,46 @@ struct conv_driver : test_driver } }; +template +struct conv2d_driver : conv_driver +{ + conv2d_driver() : conv_driver() + { + this->add(this->input_dims, "input"); + this->add(this->weight_tensor_dims, "weights"); + this->add(this->batch_size, + "batch_size", + this->generate_data_limited(this->get_batch_sizes(), 1)); + this->add(this->input_channels, + "input_channels", + this->generate_data_limited(this->get_input_channels(), 1, {32})); + this->add(this->output_channels, + "output_channels", + this->generate_data_limited(this->get_output_channels(), 1, {64})); + this->add(this->spatial_dim_elements, + "spatial_dim_elements", + this->generate_data_limited(this->get_2d_spatial_dims(), 1, {28, 28})); + this->add(this->filter_dims, + "filter_dims", + this->generate_data_limited(this->get_2d_filter_dims(), 2, {3, 3})); + this->add(this->pads_strides_dilations, + "pads_strides_dilations", + this->generate_data_limited(this->get_2d_pads_strides_dilations(), 2)); + this->add(this->trans_output_pads, + "trans_output_pads", + this->generate_data(this->get_2d_trans_output_pads())); + this->add(this->in_layout, "in_layout", this->generate_data({"NCHW"})); + this->add(this->fil_layout, "fil_layout", this->generate_data({"NCHW"})); + this->add(this->out_layout, "out_layout", this->generate_data({"NCHW"})); + this->add(this->deterministic, "deterministic", this->generate_data({false})); + this->add(this->tensor_vect, "tensor_vect", this->generate_data({0})); + this->add(this->vector_length, "vector_length", this->generate_data({1})); + // Only valid for int8 input and weights + this->add(this->output_type, "output_type", this->generate_data({"int32"})); + this->add(this->int8_vectorize, "int8_vectorize", this->generate_data({false})); + } +}; + // CONV BIAS //========================== template diff --git a/test/gtest/conv_2d.hpp b/test/gtest/conv_2d.hpp deleted file mode 100644 index df73453ef2..0000000000 --- a/test/gtest/conv_2d.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * - * MIT License - * - * Copyright (c) 2023 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - *******************************************************************************/ -#include "conv_common.hpp" - -template -struct conv2d_driver : conv_driver -{ - conv2d_driver() : conv_driver() - { - this->add(this->input_dims, "input"); - this->add(this->weight_tensor_dims, "weights"); - this->add(this->batch_size, - "batch_size", - this->generate_data_limited(this->get_batch_sizes(), 1)); - this->add(this->input_channels, - "input_channels", - this->generate_data_limited(this->get_input_channels(), 1, {32})); - this->add(this->output_channels, - "output_channels", - this->generate_data_limited(this->get_output_channels(), 1, {64})); - this->add(this->spatial_dim_elements, - "spatial_dim_elements", - this->generate_data_limited(this->get_2d_spatial_dims(), 1, {28, 28})); - this->add(this->filter_dims, - "filter_dims", - this->generate_data_limited(this->get_2d_filter_dims(), 2, {3, 3})); - this->add(this->pads_strides_dilations, - "pads_strides_dilations", - this->generate_data_limited(this->get_2d_pads_strides_dilations(), 2)); - this->add(this->trans_output_pads, - "trans_output_pads", - this->generate_data(this->get_2d_trans_output_pads())); - this->add(this->in_layout, "in_layout", this->generate_data({"NCHW"})); - this->add(this->fil_layout, "fil_layout", this->generate_data({"NCHW"})); - this->add(this->out_layout, "out_layout", this->generate_data({"NCHW"})); - this->add(this->deterministic, "deterministic", this->generate_data({false})); - this->add(this->tensor_vect, "tensor_vect", this->generate_data({0})); - this->add(this->vector_length, "vector_length", this->generate_data({1})); - // Only valid for int8 input and weights - this->add(this->output_type, "output_type", this->generate_data({"int32"})); - this->add(this->int8_vectorize, "int8_vectorize", this->generate_data({false})); - } -}; diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index 2c4dcaea58..71d6073840 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -4,7 +4,7 @@ #include #include #include -#include "conv_2d.hpp" +#include "conv_common.hpp" #include "get_handle.hpp" std::string GetFloatArg() From 70d1d9ceb64f5fe47f00c221a5141c2fbe8d62bd Mon Sep 17 00:00:00 2001 From: xinlipn Date: Fri, 9 Jun 2023 00:48:15 -0700 Subject: [PATCH 19/29] Remove conditional compilation --- test/gtest/conv_embed_db.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index 71d6073840..d46a5f7308 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -174,11 +174,8 @@ TEST_P(ConfigWithBFloat16, BFloat16Test) std::vector GetTestCases(const std::string& precision) { -#if MIOPEN_EMBED_DB std::string flags = " --disable-validation --verbose "; -#else - std::string flags = " "; -#endif + const std::vector test_cases = { // clang-format off {precision + flags + "--input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, From d087a00396879dededb1bc0b13409d85060e7fc7 Mon Sep 17 00:00:00 2001 From: xinlipn Date: Fri, 9 Jun 2023 08:49:56 -0700 Subject: [PATCH 20/29] Revert and refactor conv2d_driver changes --- test/conv2d.cpp | 2 +- test/conv_common.hpp | 40 ---------------------- test/gtest/conv_2d.hpp | 66 ++++++++++++++++++++++++++++++++++++ test/gtest/conv_embed_db.cpp | 2 +- 4 files changed, 68 insertions(+), 42 deletions(-) create mode 100644 test/gtest/conv_2d.hpp diff --git a/test/conv2d.cpp b/test/conv2d.cpp index 2aee7f8449..e35c797031 100644 --- a/test/conv2d.cpp +++ b/test/conv2d.cpp @@ -23,6 +23,6 @@ * SOFTWARE. * *******************************************************************************/ -#include "conv_common.hpp" +#include "gtest/conv_2d.hpp" int main(int argc, const char* argv[]) { test_drive(argc, argv); } diff --git a/test/conv_common.hpp b/test/conv_common.hpp index 519d5ace96..6d665e0845 100644 --- a/test/conv_common.hpp +++ b/test/conv_common.hpp @@ -2466,46 +2466,6 @@ struct conv_driver : test_driver } }; -template -struct conv2d_driver : conv_driver -{ - conv2d_driver() : conv_driver() - { - this->add(this->input_dims, "input"); - this->add(this->weight_tensor_dims, "weights"); - this->add(this->batch_size, - "batch_size", - this->generate_data_limited(this->get_batch_sizes(), 1)); - this->add(this->input_channels, - "input_channels", - this->generate_data_limited(this->get_input_channels(), 1, {32})); - this->add(this->output_channels, - "output_channels", - this->generate_data_limited(this->get_output_channels(), 1, {64})); - this->add(this->spatial_dim_elements, - "spatial_dim_elements", - this->generate_data_limited(this->get_2d_spatial_dims(), 1, {28, 28})); - this->add(this->filter_dims, - "filter_dims", - this->generate_data_limited(this->get_2d_filter_dims(), 2, {3, 3})); - this->add(this->pads_strides_dilations, - "pads_strides_dilations", - this->generate_data_limited(this->get_2d_pads_strides_dilations(), 2)); - this->add(this->trans_output_pads, - "trans_output_pads", - this->generate_data(this->get_2d_trans_output_pads())); - this->add(this->in_layout, "in_layout", this->generate_data({"NCHW"})); - this->add(this->fil_layout, "fil_layout", this->generate_data({"NCHW"})); - this->add(this->out_layout, "out_layout", this->generate_data({"NCHW"})); - this->add(this->deterministic, "deterministic", this->generate_data({false})); - this->add(this->tensor_vect, "tensor_vect", this->generate_data({0})); - this->add(this->vector_length, "vector_length", this->generate_data({1})); - // Only valid for int8 input and weights - this->add(this->output_type, "output_type", this->generate_data({"int32"})); - this->add(this->int8_vectorize, "int8_vectorize", this->generate_data({false})); - } -}; - // CONV BIAS //========================== template diff --git a/test/gtest/conv_2d.hpp b/test/gtest/conv_2d.hpp new file mode 100644 index 0000000000..df73453ef2 --- /dev/null +++ b/test/gtest/conv_2d.hpp @@ -0,0 +1,66 @@ +/******************************************************************************* + * + * MIT License + * + * Copyright (c) 2023 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + *******************************************************************************/ +#include "conv_common.hpp" + +template +struct conv2d_driver : conv_driver +{ + conv2d_driver() : conv_driver() + { + this->add(this->input_dims, "input"); + this->add(this->weight_tensor_dims, "weights"); + this->add(this->batch_size, + "batch_size", + this->generate_data_limited(this->get_batch_sizes(), 1)); + this->add(this->input_channels, + "input_channels", + this->generate_data_limited(this->get_input_channels(), 1, {32})); + this->add(this->output_channels, + "output_channels", + this->generate_data_limited(this->get_output_channels(), 1, {64})); + this->add(this->spatial_dim_elements, + "spatial_dim_elements", + this->generate_data_limited(this->get_2d_spatial_dims(), 1, {28, 28})); + this->add(this->filter_dims, + "filter_dims", + this->generate_data_limited(this->get_2d_filter_dims(), 2, {3, 3})); + this->add(this->pads_strides_dilations, + "pads_strides_dilations", + this->generate_data_limited(this->get_2d_pads_strides_dilations(), 2)); + this->add(this->trans_output_pads, + "trans_output_pads", + this->generate_data(this->get_2d_trans_output_pads())); + this->add(this->in_layout, "in_layout", this->generate_data({"NCHW"})); + this->add(this->fil_layout, "fil_layout", this->generate_data({"NCHW"})); + this->add(this->out_layout, "out_layout", this->generate_data({"NCHW"})); + this->add(this->deterministic, "deterministic", this->generate_data({false})); + this->add(this->tensor_vect, "tensor_vect", this->generate_data({0})); + this->add(this->vector_length, "vector_length", this->generate_data({1})); + // Only valid for int8 input and weights + this->add(this->output_type, "output_type", this->generate_data({"int32"})); + this->add(this->int8_vectorize, "int8_vectorize", this->generate_data({false})); + } +}; diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index d46a5f7308..e797ede7b9 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -4,7 +4,7 @@ #include #include #include -#include "conv_common.hpp" +#include "conv_2d.hpp" #include "get_handle.hpp" std::string GetFloatArg() From 6abced77b144b06bebc85a7899a8d1952d608f25 Mon Sep 17 00:00:00 2001 From: xinlipn Date: Fri, 9 Jun 2023 13:57:50 -0700 Subject: [PATCH 21/29] Refactor code, specify relative path to make it pass static check --- test/gtest/conv_2d.hpp | 2 +- test/gtest/conv_embed_db.cpp | 48 ++++++++++++------------------------ 2 files changed, 17 insertions(+), 33 deletions(-) diff --git a/test/gtest/conv_2d.hpp b/test/gtest/conv_2d.hpp index df73453ef2..05ad1792cd 100644 --- a/test/gtest/conv_2d.hpp +++ b/test/gtest/conv_2d.hpp @@ -23,7 +23,7 @@ * SOFTWARE. * *******************************************************************************/ -#include "conv_common.hpp" +#include "../conv_common.hpp" template struct conv2d_driver : conv_driver diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index e797ede7b9..f23082165d 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -81,18 +81,14 @@ TEST_P(ConfigWithFloat, FloatTest) #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || // Explicitly disabled - miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || // Explicitly disabled - miopen::StartsWith(handle.GetDeviceName(), "gfx94") || // Implicitly disabled by default - miopen::StartsWith(handle.GetDeviceName(), "gfx103") || // Implicitly disabled by default - miopen::StartsWith(handle.GetDeviceName(), "gfx110") || // Implicitly disabled by default - GetFloatArg() != "--float") + if((handle.GetDeviceName() == "gfx900" || handle.GetDeviceName() == "gfx906") && + GetFloatArg() == "--float") { - GTEST_SKIP(); + Run2dDriver(miopenFloat); } else { - Run2dDriver(miopenFloat); + GTEST_SKIP(); } #else @@ -105,18 +101,14 @@ TEST_P(ConfigWithHalf, HalfTest) #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || // Explicitly disabled - miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || // Explicitly disabled - miopen::StartsWith(handle.GetDeviceName(), "gfx94") || // Implicitly disabled by default - miopen::StartsWith(handle.GetDeviceName(), "gfx103") || // Implicitly disabled by default - miopen::StartsWith(handle.GetDeviceName(), "gfx110") || // Implicitly disabled by default - GetFloatArg() != "--half") + if((handle.GetDeviceName() == "gfx900" || handle.GetDeviceName() == "gfx906") && + GetFloatArg() == "--half") { - GTEST_SKIP(); + Run2dDriver(miopenHalf); } else { - Run2dDriver(miopenHalf); + GTEST_SKIP(); } #else @@ -129,18 +121,14 @@ TEST_P(ConfigWithInt8, Int8Test) #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || // Explicitly disabled - miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || // Explicitly disabled - miopen::StartsWith(handle.GetDeviceName(), "gfx94") || // Implicitly disabled by default - miopen::StartsWith(handle.GetDeviceName(), "gfx103") || // Implicitly disabled by default - miopen::StartsWith(handle.GetDeviceName(), "gfx110") || // Implicitly disabled by default - GetFloatArg() != "--int8") + if((handle.GetDeviceName() == "gfx900" || handle.GetDeviceName() == "gfx906") && + GetFloatArg() == "--int8") { - GTEST_SKIP(); + Run2dDriver(miopenInt8); } else { - Run2dDriver(miopenInt8); + GTEST_SKIP(); } #else @@ -153,18 +141,14 @@ TEST_P(ConfigWithBFloat16, BFloat16Test) #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if(miopen::StartsWith(handle.GetDeviceName(), "gfx908") || // Explicitly disabled - miopen::StartsWith(handle.GetDeviceName(), "gfx90a") || // Explicitly disabled - miopen::StartsWith(handle.GetDeviceName(), "gfx94") || // Implicitly disabled by default - miopen::StartsWith(handle.GetDeviceName(), "gfx103") || // Implicitly disabled by default - miopen::StartsWith(handle.GetDeviceName(), "gfx110") || // Implicitly disabled by default - GetFloatArg() != "--bfloat16") + if((handle.GetDeviceName() == "gfx900" || handle.GetDeviceName() == "gfx906") && + GetFloatArg() == "--bfloat16") { - GTEST_SKIP(); + Run2dDriver(miopenBFloat16); } else { - Run2dDriver(miopenBFloat16); + GTEST_SKIP(); } #else From da3594eed5d60fa44121274cee7a9b89a27a5bc5 Mon Sep 17 00:00:00 2001 From: xinlipn Date: Wed, 14 Jun 2023 17:32:42 -0700 Subject: [PATCH 22/29] Resolve test CMakeLists.txt conflicts --- test/CMakeLists.txt | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7a3dae6025..f1f6fe5e5f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -760,40 +760,6 @@ if(${MIOPEN_TEST_WITH_MIOPENDRIVER}) ) endif() -# ./bin/MIOpenDriver conv -n 128 -c 1024 -H 14 -W 14 -k 2048 -y 1 -x 1 -p 0 -q 0 -u 2 -v 2 -l 1 -j 1 -m conv -g 1 -F 1 -t 1 -# MIOPEN_DEBUG_CONV_IMMED_FALLBACK=0 -if(MIOPEN_EMBED_DB) - set(MIOPEN_EMBED_TEST_ARG ${MIOPEN_TEST_FLOAT_ARG} --disable-validation --verbose) - # WORKAROUND for issue #874 - set(MIOPEN_WA_ISSUE_874_F MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0) - set(MIOPEN_WA_ISSUE_874_W MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0) - set(MIOPEN_WA_ISSUE_874_FW MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1=0 MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1=0) - # WORKAROUND for issue #1008 - set(MIOPEN_WA_ISSUE_1008 MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2=0) -add_custom_test(test_conv_embed_db TEST_PERF_DB_RECORD_NOT_FOUND GFX908_DISABLED GFX90A_DISABLED - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_W} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_F} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_W} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_F} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_W} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_W} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_FW} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1 - COMMAND ${MIOPEN_WA_ISSUE_1008} ${MIOPEN_WA_ISSUE_874_W} $ ${MIOPEN_EMBED_TEST_ARG} --input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1 -) -endif() - set(IMPLICITGEMM_MLIR_ENV_BASE MIOPEN_FIND_MODE=normal) set(IMPLICITGEMM_MLIR_ENV_F ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmFwd) set(IMPLICITGEMM_MLIR_ENV_B ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmBwd) From 0979c73ea6976a5b295dcfaeafa6d3174e858b0e Mon Sep 17 00:00:00 2001 From: xinlipn Date: Fri, 23 Jun 2023 10:11:13 -0700 Subject: [PATCH 23/29] Refactored code eg reusing existing API --- test/gtest/conv_2d.hpp | 2 + test/gtest/conv_embed_db.cpp | 111 +++++++++++++++++++++++------------ 2 files changed, 74 insertions(+), 39 deletions(-) diff --git a/test/gtest/conv_2d.hpp b/test/gtest/conv_2d.hpp index 05ad1792cd..8d10f55902 100644 --- a/test/gtest/conv_2d.hpp +++ b/test/gtest/conv_2d.hpp @@ -23,6 +23,8 @@ * SOFTWARE. * *******************************************************************************/ +#pragma once + #include "../conv_common.hpp" template diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index f23082165d..ade8de1c31 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -1,3 +1,28 @@ +/******************************************************************************* + * + * MIT License + * + * Copyright (c) 2023 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + *******************************************************************************/ #include #include @@ -7,16 +32,6 @@ #include "conv_2d.hpp" #include "get_handle.hpp" -std::string GetFloatArg() -{ - static const auto tmp = miopen::GetEnv("MIOPEN_TEST_FLOAT_ARG"); - if(tmp.empty()) - { - return ""; - } - return tmp.front(); -}; - void GetArgs(const std::string& param, std::vector& tokens) { std::stringstream ss(param); @@ -76,13 +91,23 @@ void Run2dDriver(miopenDataType_t prec) } }; +bool IsTestSupportedForDevice(const miopen::Handle& handle) +{ + std::string devName = handle.GetDeviceName(); + if(devName == "gfx900" || devName == "gfx906") + return true; + else + return false; +} + TEST_P(ConfigWithFloat, FloatTest) { #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if((handle.GetDeviceName() == "gfx900" || handle.GetDeviceName() == "gfx906") && - GetFloatArg() == "--float") + const auto& envVar = miopen::GetEnv("MIOPEN_TEST_FLOAT_ARG"); + + if(IsTestSupportedForDevice(handle) && (!envVar.empty() && envVar.front() == "--float")) { Run2dDriver(miopenFloat); } @@ -101,8 +126,9 @@ TEST_P(ConfigWithHalf, HalfTest) #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if((handle.GetDeviceName() == "gfx900" || handle.GetDeviceName() == "gfx906") && - GetFloatArg() == "--half") + const auto& envVar = miopen::GetEnv("MIOPEN_TEST_FLOAT_ARG"); + + if(IsTestSupportedForDevice(handle) && (!envVar.empty() && envVar.front() == "--half")) { Run2dDriver(miopenHalf); } @@ -121,8 +147,9 @@ TEST_P(ConfigWithInt8, Int8Test) #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if((handle.GetDeviceName() == "gfx900" || handle.GetDeviceName() == "gfx906") && - GetFloatArg() == "--int8") + const auto& envVar = miopen::GetEnv("MIOPEN_TEST_FLOAT_ARG"); + + if(IsTestSupportedForDevice(handle) && (!envVar.empty() && envVar.front() == "--int8")) { Run2dDriver(miopenInt8); } @@ -141,8 +168,9 @@ TEST_P(ConfigWithBFloat16, BFloat16Test) #if MIOPEN_EMBED_DB const auto& handle = get_handle(); - if((handle.GetDeviceName() == "gfx900" || handle.GetDeviceName() == "gfx906") && - GetFloatArg() == "--bfloat16") + const auto& envVar = miopen::GetEnv("MIOPEN_TEST_FLOAT_ARG"); + + if(IsTestSupportedForDevice(handle) && (!envVar.empty() && envVar.front() == "--bfloat16")) { Run2dDriver(miopenBFloat16); } @@ -158,30 +186,35 @@ TEST_P(ConfigWithBFloat16, BFloat16Test) std::vector GetTestCases(const std::string& precision) { - std::string flags = " --disable-validation --verbose "; + std::string flags = " --disable-validation --verbose "; + const auto& envVar = miopen::GetEnv("MIOPEN_TEST_FLOAT_ARG"); + + // If precision env var is not set + if(envVar.empty()) + flags.insert(0, precision); const std::vector test_cases = { // clang-format off - {precision + flags + "--input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, - {precision + flags + "--input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, - {precision + flags + "--input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"}, - {precision + flags + "--input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, - {precision + flags + "--input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, - {precision + flags + "--input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, - {precision + flags + "--input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, - {precision + flags + "--input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, - {precision + flags + "--input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - {precision + flags + "--input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, - {precision + flags + "--input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - {precision + flags + "--input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - {precision + flags + "--input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - {precision + flags + "--input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - {precision + flags + "--input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, - {precision + flags + "--input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - {precision + flags + "--input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, - {precision + flags + "--input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - {precision + flags + "--input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, - {precision + flags + "--input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"} + {flags + "--input 128 128 28 28 --weights 128 128 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, + {flags + "--input 128 256 56 56 --weights 512 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + {flags + "--input 128 3 230 230 --weights 64 3 7 7 --pads_strides_dilations 0 0 2 2 1 1"}, + {flags + "--input 128 64 56 56 --weights 64 64 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, + {flags + "--input 128 256 14 14 --weights 256 256 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, + {flags + "--input 128 512 7 7 --weights 512 512 3 3 --pads_strides_dilations 1 1 1 1 1 1"}, + {flags + "--input 128 1024 14 14 --weights 512 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + {flags + "--input 128 1024 14 14 --weights 2048 1024 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + {flags + "--input 128 256 14 14 --weights 1024 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {flags + "--input 128 512 28 28 --weights 256 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + {flags + "--input 128 1024 14 14 --weights 256 1024 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {flags + "--input 128 64 56 56 --weights 256 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {flags + "--input 128 64 56 56 --weights 64 64 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {flags + "--input 128 128 28 28 --weights 512 128 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {flags + "--input 128 256 56 56 --weights 128 256 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + {flags + "--input 128 256 56 56 --weights 64 256 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {flags + "--input 128 512 28 28 --weights 1024 512 1 1 --pads_strides_dilations 0 0 2 2 1 1"}, + {flags + "--input 128 512 28 28 --weights 128 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {flags + "--input 128 512 7 7 --weights 2048 512 1 1 --pads_strides_dilations 0 0 1 1 1 1"}, + {flags + "--input 128 2048 7 7 --weights 512 2048 1 1 --pads_strides_dilations 0 0 1 1 1 1"} // clang-format on }; From c987d64201219b69387918a603b1b025e2ab2dc7 Mon Sep 17 00:00:00 2001 From: xinlipn Date: Tue, 27 Jun 2023 12:54:47 -0700 Subject: [PATCH 24/29] Replace GetEnv() witn GetStringEnv(), MIOPEN_THROW() with FAIL() --- test/gtest/conv_embed_db.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index ade8de1c31..53cc013677 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -32,6 +32,8 @@ #include "conv_2d.hpp" #include "get_handle.hpp" +MIOPEN_DECLARE_ENV_VAR(MIOPEN_TEST_FLOAT_ARG) + void GetArgs(const std::string& param, std::vector& tokens) { std::stringstream ss(param); @@ -67,9 +69,8 @@ void Run2dDriver(miopenDataType_t prec) case miopenInt8x4: case miopenInt32: case miopenDouble: - MIOPEN_THROW(miopenStatusBadParm, - "miopenInt8x4, miopenInt32, miopenDouble data type not supported by " - "conv_embed_db test"); + FAIL() << "miopenInt8x4, miopenInt32, miopenDouble data type not supported by " + "conv_embed_db test"; default: params = ConfigWithFloat::GetParam(); } @@ -104,10 +105,11 @@ TEST_P(ConfigWithFloat, FloatTest) { #if MIOPEN_EMBED_DB - const auto& handle = get_handle(); - const auto& envVar = miopen::GetEnv("MIOPEN_TEST_FLOAT_ARG"); + const auto& handle = get_handle(); + const char* const p_envVar = miopen::GetStringEnv(MIOPEN_TEST_FLOAT_ARG{}); - if(IsTestSupportedForDevice(handle) && (!envVar.empty() && envVar.front() == "--float")) + if(IsTestSupportedForDevice(handle) && + (p_envVar != nullptr && std::strcmp(p_envVar, "--float") == 0)) { Run2dDriver(miopenFloat); } @@ -125,10 +127,11 @@ TEST_P(ConfigWithHalf, HalfTest) { #if MIOPEN_EMBED_DB - const auto& handle = get_handle(); - const auto& envVar = miopen::GetEnv("MIOPEN_TEST_FLOAT_ARG"); + const auto& handle = get_handle(); + const char* const p_envVar = miopen::GetStringEnv(MIOPEN_TEST_FLOAT_ARG{}); - if(IsTestSupportedForDevice(handle) && (!envVar.empty() && envVar.front() == "--half")) + if(IsTestSupportedForDevice(handle) && + (p_envVar != nullptr && std::strcmp(p_envVar, "--half") == 0)) { Run2dDriver(miopenHalf); } @@ -146,10 +149,11 @@ TEST_P(ConfigWithInt8, Int8Test) { #if MIOPEN_EMBED_DB - const auto& handle = get_handle(); - const auto& envVar = miopen::GetEnv("MIOPEN_TEST_FLOAT_ARG"); + const auto& handle = get_handle(); + const char* const p_envVar = miopen::GetStringEnv(MIOPEN_TEST_FLOAT_ARG{}); - if(IsTestSupportedForDevice(handle) && (!envVar.empty() && envVar.front() == "--int8")) + if(IsTestSupportedForDevice(handle) && + (p_envVar != nullptr && std::strcmp(p_envVar, "--int8") == 0)) { Run2dDriver(miopenInt8); } @@ -167,10 +171,11 @@ TEST_P(ConfigWithBFloat16, BFloat16Test) { #if MIOPEN_EMBED_DB - const auto& handle = get_handle(); - const auto& envVar = miopen::GetEnv("MIOPEN_TEST_FLOAT_ARG"); + const auto& handle = get_handle(); + const char* const p_envVar = miopen::GetStringEnv(MIOPEN_TEST_FLOAT_ARG{}); - if(IsTestSupportedForDevice(handle) && (!envVar.empty() && envVar.front() == "--bfloat16")) + if(IsTestSupportedForDevice(handle) && + (p_envVar != nullptr && std::strcmp(p_envVar, "--bfloat16") == 0)) { Run2dDriver(miopenBFloat16); } From 20532ed32950b6612ac29159fe14f50fcc5ad797 Mon Sep 17 00:00:00 2001 From: xinlipn Date: Tue, 27 Jun 2023 22:56:12 -0700 Subject: [PATCH 25/29] Refactor code by creating IsTestRunWith() --- test/gtest/conv_embed_db.cpp | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index 53cc013677..9f8903df86 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -34,6 +34,13 @@ MIOPEN_DECLARE_ENV_VAR(MIOPEN_TEST_FLOAT_ARG) +static bool IsTestRunWith(const char* float_arg) +{ + assert(float_arg != nullptr); + const char* const p_envVar = miopen::GetStringEnv(MIOPEN_TEST_FLOAT_ARG{}); + return (p_envVar != nullptr && std::strcmp(p_envVar, float_arg) == 0); +} + void GetArgs(const std::string& param, std::vector& tokens) { std::stringstream ss(param); @@ -105,11 +112,8 @@ TEST_P(ConfigWithFloat, FloatTest) { #if MIOPEN_EMBED_DB - const auto& handle = get_handle(); - const char* const p_envVar = miopen::GetStringEnv(MIOPEN_TEST_FLOAT_ARG{}); - - if(IsTestSupportedForDevice(handle) && - (p_envVar != nullptr && std::strcmp(p_envVar, "--float") == 0)) + const auto& handle = get_handle(); + if(IsTestSupportedForDevice(handle) && IsTestRunWith("--float")) { Run2dDriver(miopenFloat); } @@ -127,11 +131,8 @@ TEST_P(ConfigWithHalf, HalfTest) { #if MIOPEN_EMBED_DB - const auto& handle = get_handle(); - const char* const p_envVar = miopen::GetStringEnv(MIOPEN_TEST_FLOAT_ARG{}); - - if(IsTestSupportedForDevice(handle) && - (p_envVar != nullptr && std::strcmp(p_envVar, "--half") == 0)) + const auto& handle = get_handle(); + if(IsTestSupportedForDevice(handle) && IsTestRunWith("--half")) { Run2dDriver(miopenHalf); } @@ -149,11 +150,8 @@ TEST_P(ConfigWithInt8, Int8Test) { #if MIOPEN_EMBED_DB - const auto& handle = get_handle(); - const char* const p_envVar = miopen::GetStringEnv(MIOPEN_TEST_FLOAT_ARG{}); - - if(IsTestSupportedForDevice(handle) && - (p_envVar != nullptr && std::strcmp(p_envVar, "--int8") == 0)) + const auto& handle = get_handle(); + if(IsTestSupportedForDevice(handle) && IsTestRunWith("--int8")) { Run2dDriver(miopenInt8); } @@ -171,11 +169,8 @@ TEST_P(ConfigWithBFloat16, BFloat16Test) { #if MIOPEN_EMBED_DB - const auto& handle = get_handle(); - const char* const p_envVar = miopen::GetStringEnv(MIOPEN_TEST_FLOAT_ARG{}); - - if(IsTestSupportedForDevice(handle) && - (p_envVar != nullptr && std::strcmp(p_envVar, "--bfloat16") == 0)) + const auto& handle = get_handle(); + if(IsTestSupportedForDevice(handle) && IsTestRunWith("--bfloat16")) { Run2dDriver(miopenBFloat16); } From 45e89caae18e858d62bd1b6f10ed3ca9a8727f58 Mon Sep 17 00:00:00 2001 From: xinlipn Date: Wed, 5 Jul 2023 11:31:16 -0700 Subject: [PATCH 26/29] Moved and renamed conv_2d.hpp in gtest folder one level up --- test/gtest/conv_2d.hpp => conv2d.hpp | 2 +- test/conv2d.cpp | 2 +- test/gtest/conv_embed_db.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename test/gtest/conv_2d.hpp => conv2d.hpp (99%) diff --git a/test/gtest/conv_2d.hpp b/conv2d.hpp similarity index 99% rename from test/gtest/conv_2d.hpp rename to conv2d.hpp index 8d10f55902..9a4e8a73c5 100644 --- a/test/gtest/conv_2d.hpp +++ b/conv2d.hpp @@ -25,7 +25,7 @@ *******************************************************************************/ #pragma once -#include "../conv_common.hpp" +#include "conv_common.hpp" template struct conv2d_driver : conv_driver diff --git a/test/conv2d.cpp b/test/conv2d.cpp index e35c797031..6b2ecfd063 100644 --- a/test/conv2d.cpp +++ b/test/conv2d.cpp @@ -23,6 +23,6 @@ * SOFTWARE. * *******************************************************************************/ -#include "gtest/conv_2d.hpp" +#include "conv2d.hpp" int main(int argc, const char* argv[]) { test_drive(argc, argv); } diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index 9f8903df86..64dc1c02b2 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -29,7 +29,7 @@ #include #include #include -#include "conv_2d.hpp" +#include "../conv2d.hpp" #include "get_handle.hpp" MIOPEN_DECLARE_ENV_VAR(MIOPEN_TEST_FLOAT_ARG) From a6e6f1a11ac01765dbacfd17049fcd9904f03c38 Mon Sep 17 00:00:00 2001 From: xinlipn Date: Wed, 5 Jul 2023 16:18:38 -0700 Subject: [PATCH 27/29] Relocate conv2d.hpp --- conv2d.hpp => test/conv2d.hpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename conv2d.hpp => test/conv2d.hpp (100%) diff --git a/conv2d.hpp b/test/conv2d.hpp similarity index 100% rename from conv2d.hpp rename to test/conv2d.hpp From 444ee2b645abe0d5cb2ba65bf5fc377fad9ddc3b Mon Sep 17 00:00:00 2001 From: xinlipn Date: Wed, 5 Jul 2023 22:09:42 -0700 Subject: [PATCH 28/29] Fix static check error --- test/gtest/conv_embed_db.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/gtest/conv_embed_db.cpp b/test/gtest/conv_embed_db.cpp index 64dc1c02b2..ba9889dfd7 100644 --- a/test/gtest/conv_embed_db.cpp +++ b/test/gtest/conv_embed_db.cpp @@ -186,11 +186,11 @@ TEST_P(ConfigWithBFloat16, BFloat16Test) std::vector GetTestCases(const std::string& precision) { - std::string flags = " --disable-validation --verbose "; - const auto& envVar = miopen::GetEnv("MIOPEN_TEST_FLOAT_ARG"); + std::string flags = " --disable-validation --verbose "; // If precision env var is not set - if(envVar.empty()) + if(!(IsTestRunWith("--float") || IsTestRunWith("--half") || IsTestRunWith("--int8") || + IsTestRunWith("--bfloat16"))) flags.insert(0, precision); const std::vector test_cases = { From 35f72a888d375b6bca9cb5285e164d10b7a155fd Mon Sep 17 00:00:00 2001 From: xinlipn Date: Thu, 13 Jul 2023 09:50:05 -0700 Subject: [PATCH 29/29] Fix Read the Docs build failed error in CI --- docs/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 49392ad63f..64a3fea064 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -6,6 +6,8 @@ from rocm_docs import ROCmDocs +external_projects_current_project = "miopen" + docs_core = ROCmDocs("MIOpen Documentation") docs_core.run_doxygen() docs_core.setup()