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

[HOTFIX][tests] Limit applicability of ConvFwdBiasActivAPI/ConvFwdBiasResAddActivTest.ConvFusedAPI #2635

Merged
merged 1 commit into from
Dec 22, 2023
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
81 changes: 61 additions & 20 deletions test/gtest/fused_conv_bias_res_add_activ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,44 @@
*******************************************************************************/
#include <gtest/gtest.h>
#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"

#include "conv3d_test_case.hpp"

MIOPEN_DECLARE_ENV_VAR_BOOL(MIOPEN_TEST_ALL)
MIOPEN_DECLARE_ENV_VAR_STR(MIOPEN_TEST_FLOAT_ARG)

#if MIOPEN_USE_COMPOSABLEKERNEL
Copy link
Contributor

Choose a reason for hiding this comment

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

This switch does not seem useful given how we rely heavily on CK and that we don't have (to my knowledge) alternatives to CK that intend to replace it. Do we expect to ship/deploy MIOpen in a setting where CK is absent or does not work?

CC: @JehandadKhan , @junliume

Copy link
Contributor Author

@atamazov atamazov Jan 2, 2024

Choose a reason for hiding this comment

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

@amberhassaan This is for CI stage 'Fp32 Hip Debug NOCK AnyGPU Build-Only' to pass.

#define WORAROUND_ISSUE_2533 1
#endif

namespace conv_bias_act_res_add_fwd {

bool TestIsApplicable()
{
#if MIOPEN_USE_COMPOSABLEKERNEL
const auto float_arg = miopen::GetStringEnv(ENV(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.
&& !miopen::IsDisabled(
ENV(MIOPEN_TEST_ALL)); // Not disabled when gtest is run without parameters.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to remove this dependence on environment variables like MIOPEN_TEST_ALL or MIOPEN_TEST_FLOAT_ARG for new tests. All new tests should have unit tests methods for all the supported types.

CC: @JehandadKhan , @junliume

Copy link
Contributor Author

@atamazov atamazov Jan 2, 2024

Choose a reason for hiding this comment

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

@amberhassaan I'm second to this. We will remove this when possible. However, for now we need to handle MIOPEN_TEST_FLOAT_ARG to support the existing Jenkinsfile, which distributes testing of different datatypes on different nodes (for the sake of faster CI turnaround). See #1843.

Ditto MIOPEN_TEST_ALL because we still want to have smoke tests in our CI.

#else
return false;
#endif
}

std::vector<Conv3DTestCase> ConvTestConfigs()
{ // g, n, c, d, h, w, k, z, y, x, pad_x pad_y pad_z stri_x stri_y stri_z dia_x dia_y
// dia_z
Expand All @@ -57,6 +87,8 @@ struct ConvFwdBiasResAddFixture
protected:
void SetUp() override
{
if(!TestIsApplicable())
return;

std::tie(algo, conv_config, alpha1, alpha2, tensor_layout) = GetParam();

Expand Down Expand Up @@ -94,6 +126,8 @@ struct ConvFwdBiasResAddFixture
}
void TearDown() override
{
if(!TestIsApplicable())
return;

miopenDestroyActivationDescriptor(activ_desc);

Expand Down Expand Up @@ -163,26 +197,33 @@ using namespace conv_bias_act_res_add_fwd;

TEST_P(ConvFwdBiasResAddActivTest, ConvFusedAPI)
{
auto status = miopenConvolutionBiasActivationForward(&get_handle(),
&alpha1,
&input.desc,
in_dev.get(),
&weights.desc,
wei_dev.get(),
&conv_desc,
algo,
nullptr, // workspace
0ull, // workspace size
&alpha2,
&z.desc,
z_dev.get(),
&bias.desc,
bias_dev.get(),
activ_desc,
&output.desc,
out_dev.get());

EXPECT_EQ(status, miopenStatusSuccess);
if(TestIsApplicable())
{
auto status = miopenConvolutionBiasActivationForward(&get_handle(),
&alpha1,
&input.desc,
in_dev.get(),
&weights.desc,
wei_dev.get(),
&conv_desc,
algo,
nullptr, // workspace
0ull, // workspace size
&alpha2,
&z.desc,
z_dev.get(),
&bias.desc,
bias_dev.get(),
activ_desc,
&output.desc,
out_dev.get());

EXPECT_EQ(status, miopenStatusSuccess);
}
else
{
GTEST_SKIP();
}
}

INSTANTIATE_TEST_SUITE_P(ConvFwdBiasActivAPI,
Expand Down