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

[gTests]Fix GTEST_SKIP kills all gtests in miopen_gtest #3220

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Changes from all commits
Commits
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
39 changes: 20 additions & 19 deletions test/gtest/api_convbiasactiv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include "tensor_util.hpp"
#include "get_handle.hpp"
#include "gtest_common.hpp"

struct CBATestCase
{
Expand Down Expand Up @@ -64,13 +65,29 @@ struct CBATestCase
}
};

bool IsTestSupportedForDevice()
{
#if WORKAROUND_ISSUE_2212
using namespace miopen::debug;
using e_mask = enabled<Gpu::gfx900, Gpu::gfx906, Gpu::gfx908, Gpu::gfx90A, Gpu::gfx103X>;
using d_mask = disabled<Gpu::gfx110X, Gpu::gfx94X>;
return ::IsTestSupportedForDevMask<d_mask, e_mask>();
#else
return true;
#endif
}

GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GPU_ConvBiasActivFwd_FP32);
struct GPU_ConvBiasActivFwd_FP32
: public ::testing::TestWithParam<std::tuple<miopenConvFwdAlgorithm_t, CBATestCase>>
{
protected:
void SetUp() override
{
if(!IsTestSupportedForDevice())
{
GTEST_SKIP();
}
std::tie(algo, cba_config) = GetParam();
const double double_zero = 0.0f;
input = tensor<float>{cba_config.N, cba_config.C, cba_config.H, cba_config.W};
Expand Down Expand Up @@ -151,6 +168,7 @@ struct GPU_ConvBiasActivFwd_FP32

TEST_P(GPU_ConvBiasActivFwd_FP32, DISABLED_DriveAPI)
{

tensor<float> z{};
const float alpha = 1.0f;
const auto status = miopenConvolutionBiasActivationForward(&get_handle(),
Expand All @@ -174,28 +192,11 @@ TEST_P(GPU_ConvBiasActivFwd_FP32, DISABLED_DriveAPI)
EXPECT_EQ(status, miopenStatusSuccess);
}

void GatherCBATestCases(std::vector<CBATestCase>& cba_test_cases)
{
const auto dev_name = get_handle().GetDeviceName();
#if WORKAROUND_ISSUE_2212
if(!miopen::StartsWith(dev_name, "gfx11") && !miopen::StartsWith(dev_name, "gfx94"))
#endif
{
cba_test_cases.push_back(CBATestCase{
16, 128, 16, 16, 128, 3, 3, 0, 0, 1, 1, 1, 1, miopenActivationRELU, miopenConvolution});
}
else
{
GTEST_SKIP() << " Skipping fusion test on unsupported ASIC";
}
}

// Extra layer of indirection introduced since GTEST_SKIP() cannot be called from non-void function.
std::vector<CBATestCase> GetTestValues()
{
std::vector<CBATestCase> cba_test_cases;
GatherCBATestCases(cba_test_cases);
return cba_test_cases;
return {
{16, 128, 16, 16, 128, 3, 3, 0, 0, 1, 1, 1, 1, miopenActivationRELU, miopenConvolution}};
}
INSTANTIATE_TEST_SUITE_P(Full,
GPU_ConvBiasActivFwd_FP32,
Expand Down