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 1 commit
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
55 changes: 28 additions & 27 deletions test/gtest/api_convbiasactiv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,46 +150,47 @@ 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(),
&alpha,
&input.desc,
in_dev.get(),
&weights.desc,
wei_dev.get(),
conv_desc,
algo,
nullptr,
0,
&alpha,
&z.desc,
nullptr,
&bias.desc,
bias_dev.get(),
activ_desc,
&output.desc,
out_dev.get());
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"))
Copy link
Contributor

@BrianHarrisonAMD BrianHarrisonAMD Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move the skip to the start of SetUp(), and use the device flags for skipping instead?

void SetUp() override
{
    if(!IsTestSupportedForDevice())
    {
         GTEST_SKIP();
    }

   // remaining Setup
}



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
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a part of overall gtest improvements https://github.com/ROCm/MIOpen/wiki/GTest-development#early-skip
Probably we should add some tickets here #3140

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move the skip to the start of SetUp(), and use the device flags for skipping instead?

void SetUp() override
{
    if(!IsTestSupportedForDevice())
    {
         GTEST_SKIP();
    }

   // remaining Setup
}



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
}

@BrianHarrisonAMD , thanks for the comments. Code updated

#endif
{
cba_test_cases.push_back(CBATestCase{
16, 128, 16, 16, 128, 3, 3, 0, 0, 1, 1, 1, 1, miopenActivationRELU, miopenConvolution});

tensor<float> z{};
const float alpha = 1.0f;
const auto status = miopenConvolutionBiasActivationForward(&get_handle(),
&alpha,
&input.desc,
in_dev.get(),
&weights.desc,
wei_dev.get(),
conv_desc,
algo,
nullptr,
0,
&alpha,
&z.desc,
nullptr,
&bias.desc,
bias_dev.get(),
activ_desc,
&output.desc,
out_dev.get());
EXPECT_EQ(status, miopenStatusSuccess);
}
else
{
GTEST_SKIP() << " Skipping fusion test on unsupported ASIC";
}
}

void GatherCBATestCases(std::vector<CBATestCase>& cba_test_cases)
{
cba_test_cases.push_back(CBATestCase{
16, 128, 16, 16, 128, 3, 3, 0, 0, 1, 1, 1, 1, miopenActivationRELU, miopenConvolution});
}

// Extra layer of indirection introduced since GTEST_SKIP() cannot be called from non-void function.
std::vector<CBATestCase> GetTestValues()
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could combine these into a single method that returns the testcases, and I think the comment isn't applicable anymore with this fix.

std::vector<CBATestCase> GetTestValues()
{
    return {{ 16, 128, 16, 16, 128, 3, 3, 0, 0, 1, 1, 1, 1, miopenActivationRELU, miopenConvolution }};
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could combine these into a single method that returns the testcases, and I think the comment isn't applicable anymore with this fix.

std::vector<CBATestCase> GetTestValues()
{
    return {{ 16, 128, 16, 16, 128, 3, 3, 0, 0, 1, 1, 1, 1, miopenActivationRELU, miopenConvolution }};
}

@BrianHarrisonAMD , thanks for the comments. Cleaned up code

Expand Down