Skip to content

Commit

Permalink
Fix ConvBiasResAddActivation_fwd tests failing on Navi (#3239)
Browse files Browse the repository at this point in the history
* Fix ConvBiasResAddActivation_fwd tests failing on Navi

* Update to use IsTestSupportedByDevice instead

* Update test to have it's own supported device check

* Fix clang-format-12 issue

---------

Co-authored-by: Jun Liu <[email protected]>
  • Loading branch information
BrianHarrisonAMD and junliume authored Sep 8, 2024
1 parent 21569c0 commit 539b60a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 23 deletions.
24 changes: 5 additions & 19 deletions test/gtest/fused_conv_bias_res_add_activ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
*
*******************************************************************************/
#include <gtest/gtest.h>
#include <gtest/gtest_ck_common.hpp>
#include <miopen/miopen.h>
#include <miopen/env.hpp>
#if MIOPEN_USE_COMPOSABLEKERNEL
#include <miopen/solver/ck_utility_common.hpp>
#endif

#include "tensor_util.hpp"
#include "get_handle.hpp"
Expand All @@ -38,28 +36,16 @@
MIOPEN_DECLARE_ENV_VAR_BOOL(MIOPEN_TEST_ALL)
MIOPEN_DECLARE_ENV_VAR_STR(MIOPEN_TEST_FLOAT_ARG)

#if MIOPEN_USE_COMPOSABLEKERNEL
#define WORAROUND_ISSUE_2533 1
#endif

namespace conv_bias_act_res_add_fwd {

bool TestIsApplicable()
{
#if MIOPEN_USE_COMPOSABLEKERNEL
const auto float_arg = env::value(MIOPEN_TEST_FLOAT_ARG);
return
#if WORAROUND_ISSUE_2533
miopen::solver::ck_utility::is_ck_whitelist(get_handle().GetDeviceName()) //
#else
/// \todo Check against specific ASCIs.
#endif
&& (float_arg == "--half" // So far only test for fp16 is implemented.
|| float_arg.empty()) // Empty when gtest is run without parameters.
&& !env::disabled(MIOPEN_TEST_ALL); // Not disabled when gtest is run without parameters.
#else
return false;
#endif
return ::IsDeviceSupportedForCK() &&
(float_arg == "--half" // So far only test for fp16 is implemented.
|| float_arg.empty()) // Empty when gtest is run without parameters.
&& !env::disabled(MIOPEN_TEST_ALL); // Not disabled when gtest is run without parameters.
}

std::vector<Conv3DTestCase> ConvTestConfigs()
Expand Down
5 changes: 1 addition & 4 deletions test/gtest/graphapi_conv_bias_res_add_activ_fwd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ namespace conv_graph_api_test {

bool IsTestSupportedForDevice()
{
using e_mask = enabled<Gpu::gfx94X, Gpu::gfx103X, Gpu::gfx110X>;
// gfx120X is not enabled due to WORKAROUND_SWDEV_479810
using d_mask = disabled<Gpu::None>;
return ::IsTestSupportedForDevMask<d_mask, e_mask>();
return IsTestSupportedByDevice(Gpu::gfx908 | Gpu::gfx90A | Gpu::gfx94X);
}

static bool TestIsApplicable() { return true; }
Expand Down
46 changes: 46 additions & 0 deletions test/gtest/gtest_ck_common.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*******************************************************************************
*
* MIT License
*
* Copyright (c) 2024 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 <gtest/gtest_common.hpp>

#if MIOPEN_USE_COMPOSABLEKERNEL
#define WORAROUND_ISSUE_2533 1
#endif

// MI100 : gfx908
// MI200 : gfx90a
// MI300 : gfx940, gfx941, gfx942
static inline bool IsDeviceSupportedForCK()
{
#if MIOPEN_USE_COMPOSABLEKERNEL
#if WORAROUND_ISSUE_2533
return IsTestSupportedByDevice(Gpu::gfx908 | Gpu::gfx90A | Gpu::gfx94X);
#else
return true;
#endif
#else
return false;
#endif
}

0 comments on commit 539b60a

Please sign in to comment.