Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] Added smoke tests for conv solvers (ConvAsmBwdWrW1x1 and more). Some fixes. #1906

Merged
merged 79 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from 67 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
122de35
ata-test-solver-02(01) [NFC] Typo in the error message in ConvAsmImpl…
atamazov Nov 17, 2022
36ad705
ata-test-solver-02(02) [tests] Added smoke test for solvers ConvAsmIm…
atamazov Nov 17, 2022
fa5c77c
ata-test-solver-02(03) [tests] Added smoke test for ConvBinWinograd3x3U
atamazov Nov 18, 2022
a5d96c1
ata-test-solver-02(04) [tests] Added smoke test for ConvBinWinogradRxS
atamazov Nov 19, 2022
6d0721e
ata-test-solver-02(05) [tests] Added smoke test for ConvOclBwdWrW53
atamazov Nov 19, 2022
e6ff153
ata-test-solver-02(06) [HOTFIX][tests] Fixed defect in #1844 which re…
atamazov Nov 19, 2022
a3266e7
ata-test-solver-02(07) [tests] Added smoke test for ConvOclBwdWrW1x1
atamazov Nov 20, 2022
b8fca13
ata-test-solver-02(08) [tests] Added smoke test for fft
atamazov Nov 20, 2022
8a3b199
ata-test-solver-02(09) [tests] Added smoke test for ConvDirectNaiveConv
atamazov Nov 20, 2022
69c0063
ata-test-solver-02(10) [tests] Print datatype used for testing
atamazov Nov 20, 2022
cf8788f
ata-test-solver-02(11) [tests] Added smoke test for ConvAsm1x1U (no t…
atamazov Nov 20, 2022
5b92535
ata-test-solver-02(12) [NFC][tuning] Factor out some inline functions…
atamazov Nov 21, 2022
076fe70
ata-test-solver-02(13) [tuning] Add support for MIOPEN_DEBUG_TUNING_I…
atamazov Nov 21, 2022
a81434e
ata-test-solver-02(14) [tuning] Cleaner logging during tuning
atamazov Nov 21, 2022
049514d
ata-test-solver-02(15) [tests] Added tuning to smoke test for ConvAsm…
atamazov Nov 21, 2022
ef476c0
ata-test-solver-02(16) [NFC] Removed excessive IsGfx90aFp16altRequire…
atamazov Nov 23, 2022
0637230
ata-test-solver-02(17) [tests] Added smoke test for ConvAsm1x1UV2 (wi…
atamazov Nov 23, 2022
daa7a0f
ata-test-solver-02(18) [tests] Use MIOPEN_USER_DB_PATH instead of DB_…
atamazov Nov 23, 2022
094cbaf
ata-test-solver-02(19) [tests] Added smoke test for ConvWinograd3x3Mu…
atamazov Nov 23, 2022
f557eea
ata-test-solver-02(20) [Fix][tests] Use MIOPEN_USER_DB_PATH to preven…
atamazov Nov 28, 2022
5e1bc85
ata-test-solver-02(21) Merge branch 'develop' into ata-test-solver-02
atamazov Dec 8, 2022
f9ce39f
ata-test-solver-02(22) [tests] Added smoke test for ConvAsm3x3U (with…
atamazov Dec 8, 2022
c12b4aa
ata-test-solver-03(01) [tests] Added smoke test for ConvAsmBwdWrW1x1
atamazov Dec 12, 2022
831d6cf
ata-test-solver-03(02) [tests] Added smoke test for ConvAsmBwdWrW3x3
atamazov Dec 12, 2022
3d86427
ata-test-solver-03(03) [tests] Added smoke test for ConvAsmImplicitGe…
atamazov Dec 12, 2022
30911f2
ata-test-solver-03(04) [tests] Added smoke test for ConvAsmImplicitGe…
atamazov Dec 12, 2022
7058fbf
ata-test-solver-03(05) [tests] Added smoke test for ConvAsmImplicitGe…
atamazov Dec 12, 2022
cda245c
ata-test-solver-03(06) [tests] Added smoke test for ConvAsmImplicitGe…
atamazov Dec 12, 2022
eaf9db0
ata-test-solver-03(07) [tests] Added missing TEST_ANY_ERROR to tuning…
atamazov Dec 12, 2022
c3daed0
ata-test-solver-03(08) [tests] TEST_ANY_ERROR -> TEST_TUNING
atamazov Dec 12, 2022
76e6402
ata-test-solver-03(09) [tests] Added smoke test for ConvCkIgemmFwdV6r…
atamazov Dec 13, 2022
476f12a
ata-test-solver-03(10) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 13, 2022
3631c7c
ata-test-solver-03(11) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 13, 2022
020957a
ata-test-solver-03(12) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 13, 2022
ea55432
ata-test-solver-03(13) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 13, 2022
bda93ce
ata-test-solver-03(14) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 13, 2022
7d2c55c
ata-test-solver-03(15) [NFC] ConvHipImplicitGemmBwdDataV1R1: Improve …
atamazov Dec 13, 2022
9b713e9
ata-test-solver-03(16) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 13, 2022
f808666
ata-test-solver-03(17) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 13, 2022
af93f6a
ata-test-solver-03(18) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 14, 2022
7adeb51
ata-test-solver-03(19) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 14, 2022
6a0a046
ata-test-solver-03(20) [tests][NFC] smoke_conv_solver_Conv* -> smoke_…
atamazov Dec 14, 2022
450d8c1
ata-test-solver-03(21) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 14, 2022
a853d8b
ata-test-solver-03(22) [tests] Added SKIP_UNLESS_COMPOSABLEKERNEL opt…
atamazov Dec 14, 2022
2153fa6
ata-test-solver-03(23) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 14, 2022
a8eca64
ata-test-solver-03(24) [CMake][Fix] Fix issue in set_var_to_condition…
atamazov Dec 14, 2022
c12d0d5
ata-test-solver-03(25) [tests] Added support for the "--output_type" …
atamazov Dec 14, 2022
a136e04
ata-test-solver-03(26) [tests][NFC] Rename variable for clarity
atamazov Dec 14, 2022
e6ddb11
ata-test-solver-03(27) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 15, 2022
6badec2
ata-test-solver-03(28) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 15, 2022
b80aa65
ata-test-solver-03(29) [tests] Added smoke test for ConvHipImplicitGe…
atamazov Dec 15, 2022
9a185e6
ata-test-solver-03(30) [tests] Remove unnecessary MIOPEN_TEST_FLOAT_A…
atamazov Dec 16, 2022
b3a4917
ata-test-solver-03(31) [tests] Added smoke test for ConvMlirIgemmFwd/…
atamazov Dec 16, 2022
826b9e2
ata-test-solver-03(32) [tests] Added smoke test for ConvMlirIgemmFwd/…
atamazov Dec 17, 2022
3e45f91
ata-test-solver-03(33) [tests] Added smoke test for ConvBinWinogradRx…
atamazov Dec 17, 2022
ad70061
ata-test-solver-03(34) [tests] Rename couple of tests for clarity. Sm…
atamazov Dec 17, 2022
8834f72
ata-test-solver-03(35) [tests] Added smoke test for ConvBinWinogradRx…
atamazov Dec 17, 2022
0665cc8
ata-test-solver-03(36) [tests] Added smoke test for ConvBinWinogradRx…
atamazov Dec 17, 2022
6cdc8f3
ata-test-solver-03(37) [tests] Added smoke test for ConvBinWinogradRx…
atamazov Dec 18, 2022
bf0172f
ata-test-solver-03(38) [tests] Rework test for ConvBinWinogradRxSf2x3
atamazov Dec 18, 2022
3d4399e
ata-test-solver-03(39) Fix bug in commit ata-test-solver-03(25)
atamazov Dec 23, 2022
8def845
ata-test-solver-03(40) Formatting
atamazov Dec 23, 2022
36827ac
ata-test-solver-02(23) Merge branch 'develop' into ata-test-solver-02
atamazov Jan 11, 2023
c6da438
ata-test-solver-02(24) Added GFX110X_ENABLED where necessary
atamazov Jan 13, 2023
8cf5340
ata-test-solver-02(25) Merge branch 'develop' into ata-test-solver-02
atamazov Jan 13, 2023
b8ac150
ata-test-solver-03(41) Merge branch 'ata-test-solver-02' into ata-tes…
atamazov Jan 13, 2023
7c6a571
ata-test-solver-03(42) Merge branch 'develop' into ata-test-solver-03
atamazov Jan 13, 2023
cee5255
ata-test-solver-02(25) Fixed cppcheck issue
atamazov Jan 16, 2023
14ca75e
ata-test-solver-02(27) Merge branch 'develop' into ata-test-solver-02
atamazov Jan 16, 2023
cab2b9c
ata-test-solver-03(43) Merge branch 'ata-test-solver-02' into ata-tes…
atamazov Jan 17, 2023
fbfcc1b
ata-test-solver-03(44) Merge branch 'develop' into ata-test-solver-03
atamazov Jan 17, 2023
04ee871
ata-test-solver-03(45) Merge branch 'develop' into ata-test-solver-03
atamazov Jan 30, 2023
3000004
ata-test-solver-03(46) Merge branch 'develop' into ata-test-solver-03
atamazov Feb 2, 2023
9199882
ata-test-solver-03(47) Merge branch 'develop' into ata-test-solver-03
atamazov Feb 10, 2023
a3401a2
ata-test-solver-03(48) Merge branch 'develop' into ata-test-solver-03
atamazov Feb 19, 2023
9b30926
ata-test-solver-03(49) [tests][NFC] more smoke_conv_solver_Conv* -> s…
atamazov Feb 19, 2023
775b2ad
ata-test-solver-03(50) [tests] More removals of unnecessary MIOPEN_TE…
atamazov Feb 19, 2023
47d3496
ata-test-solver-03(51) Merge branch 'develop' into ata-test-solver-03
atamazov Mar 2, 2023
eab21d1
ata-test-solver-03(52) Explicitly enable ConvHipImplicitGemmV4R1Fwd t…
atamazov Mar 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ macro(set_var_to_condition var)
if(${ARGN})
set(${var} TRUE)
else()
set(${name} FALSE)
set(${var} FALSE)
endif()
endmacro()

Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ set( MIOpen_Source
find_db.cpp
fused_api.cpp
fusion.cpp
generic_search.cpp
handle_api.cpp
invoker_cache.cpp
kernel_build_params.cpp
Expand Down
44 changes: 44 additions & 0 deletions src/generic_search.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*******************************************************************************
*
* 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 <miopen/env.hpp>
#include <miopen/generic_search.hpp>

#include <cstddef>
#include <limits>

namespace miopen {
namespace solver {

MIOPEN_DECLARE_ENV_VAR(MIOPEN_DEBUG_TUNING_ITERATIONS_MAX)

std::size_t GetTuningIterationsMax()
{
return Value(MIOPEN_DEBUG_TUNING_ITERATIONS_MAX{}, std::numeric_limits<std::size_t>::max());
}

} // namespace solver
} // namespace miopen
40 changes: 14 additions & 26 deletions src/include/miopen/generic_search.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <miopen/timer.hpp>
#include <miopen/type_traits.hpp>

#include <algorithm>
#include <vector>
#include <cstdlib>
#include <limits>
Expand Down Expand Up @@ -211,30 +212,6 @@ class HeartBeat
}
};

inline void InitRandomly(std::vector<float>& vec, const double offset, const double factor)
{
float* p = vec.data();
for(unsigned long i = 0; i < vec.size(); ++i)
*p++ = static_cast<float>(
(rand() * (1.0 / RAND_MAX) + offset) * // NOLINT (concurrency-mt-unsafe)
factor);
}

inline void InitRandomly(std::vector<float>& vec)
{
float* p = vec.data();
for(unsigned long i = 0; i < vec.size(); ++i)
*p++ = static_cast<float>(rand() * (1.0 / RAND_MAX)); // NOLINT (concurrency-mt-unsafe)
}

inline size_t divide_round_plus_inf(const size_t x, const unsigned y)
{
assert(y > 0);
if(x % y != 0)
return x / y + 1;
return x / y;
}

/// Solver member function requirements:
/// * GetDefaultPerformanceConfig shall be implemented.
/// - Its return type shall be suitable for instantiation of the ComputedContainer.
Expand Down Expand Up @@ -320,6 +297,8 @@ auto GenericSearch(const Solver s,
return GenericSearch(s, ctx, invoke_ctx);
}

std::size_t GetTuningIterationsMax();

template <class Solver, class Context>
auto GenericSearch(const Solver s, const Context& context_, const AnyInvokeParams& invoke_ctx_)
-> decltype(s.GetDefaultPerformanceConfig(context_))
Expand All @@ -344,8 +323,10 @@ auto GenericSearch(const Solver s, const Context& context_, const AnyInvokeParam
auto& profile_h = context.GetStream();
AutoEnableProfiling enableProfiling{profile_h};

auto all_configs = GetAllConfigs(s, context);
const int n_runs_total = std::distance(all_configs.begin(), all_configs.end());
auto all_configs = GetAllConfigs(s, context);
const std::size_t n_runs_total =
std::min(static_cast<std::size_t>(std::distance(all_configs.begin(), all_configs.end())),
GetTuningIterationsMax());

bool is_passed = false; // left false only if all iterations failed.
float best_time = std::numeric_limits<float>::max();
Expand All @@ -357,15 +338,19 @@ auto GenericSearch(const Solver s, const Context& context_, const AnyInvokeParam
if(!miopen::IsCacheDisabled()) // Otherwise precompilation is useless.
{
std::vector<KernelInfo> kernels;
size_t n_current = 0;
for(const auto& current_config : all_configs)
{
if(n_current >= n_runs_total)
break;
ConvSolution current_solution = s.GetSolution(context, current_config);
for(auto&& kernel : current_solution.construction_params)
{
if(profile_h.HasProgram(kernel.kernel_file, kernel.comp_options))
continue;
kernels.push_back(kernel);
}
++n_current;
}
std::ignore = PrecompileKernels(profile_h, kernels);
}
Expand All @@ -375,6 +360,9 @@ auto GenericSearch(const Solver s, const Context& context_, const AnyInvokeParam
size_t n_current = 0;
for(const auto& current_config : all_configs)
{
if(n_current >= n_runs_total)
break;

float elapsed_time = 0.0f;
int ret = 0;
MIOPEN_LOG_I2('#' << n_current << '/' << n_failed << '/' << n_runs_total << ' '
Expand Down
11 changes: 8 additions & 3 deletions src/solver/conv_asm_1x1u_stride2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ inline static bool IsLinear(const int v)
return L <= v && v <= H;
}

static inline size_t divide_round_plus_inf(const size_t x, const unsigned y)
{
assert(x >= 0 && y > 0);
junliume marked this conversation as resolved.
Show resolved Hide resolved
if(x % y != 0)
return x / y + 1;
return x / y;
}

enum class MemLayout : int
{
NCHW = 0,
Expand Down Expand Up @@ -497,9 +505,6 @@ bool ConvAsm1x1UV2::IsApplicable(const ConvolutionContext& ctx,
return false;
}

if(name == "gfx90a" && problem.conv_problem.IsGfx90aFp16altRequired())
return false;

const auto elements_in_dword = 4 / GetTypeSize(problem.in_data_type);
// clang-format off
const auto img_hw = problem.out_height * problem.out_width;
Expand Down
2 changes: 1 addition & 1 deletion src/solver/conv_asm_implicit_gemm_gtc_wrw_nhwc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ ConvSolution ConvAsmImplicitGemmGTCDynamicWrwXdlopsNHWC::GetSolution(

if(workSpace == nullptr || workSpaceSize < required_workspace_size)
MIOPEN_THROW("Not enough workspace has been provided for "
"ConvAsmImplicitGemmGTCDynamicWrwXdlops with fp16 and atomic "
"ConvAsmImplicitGemmGTCDynamicWrwXdlopsNHWC with fp16 and atomic "
"add.");
auto trans_input_buf =
trans_input_size == 0
Expand Down
9 changes: 3 additions & 6 deletions src/solver/conv_hip_implicit_gemm_bwd_v1r1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,19 +644,16 @@ bool ConvHipImplicitGemmBwdDataV1R1::IsApplicable(const ConvolutionContext& ctx,
if(!problem.Is2d() && !(problem.Is3d() && problem.IsFp32()))
return false;

// TBD Renable fp16 once the root cause of
// fp16 failures, observed in CI, is resolved.
if(!(problem.IsFp32() || problem.IsBfp16()))
return false;
if(problem.group_counts != 1)
return false;

#if WORKAROUND_ISSUE_309
if(problem.IsBfp16())
return false;
if(!miopen::IsEnabled(MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1{}))
return false;
#endif
if(ctx.GetStream().GetDeviceName() == "gfx90a" &&
problem.conv_problem.IsGfx90aFp16altRequired())
return false;

const auto k = ProblemInterpreter::GetOutputChannelK(problem);
if(k % GetEPackLength(ctx, problem, false) != 0)
Expand Down
Loading