Skip to content

Commit 958cd79

Browse files
author
Vasilii Filippov
committed
Changed find test in test_cba_find2_infer to actually test solutions produced by find rather than be marked as skipped due to arbitrary solver inapplicability
1 parent 762659a commit 958cd79

File tree

2 files changed

+43
-15
lines changed

2 files changed

+43
-15
lines changed

test/gtest/cba_find2.hpp

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,22 @@ struct ConvBiasActivInferFind2Test
111111

112112
void TearDown() override
113113
{
114-
if(test_skipped)
114+
if(test_skipped || checks_ran)
115115
return;
116-
conv_stats stats;
117-
cfsb::TearDownConv();
118-
// cpu_bias_forward(cfsb::ref_out, bias);
116+
ValidateResult();
117+
}
119118

120-
activationHostInfer(activ_mode,
121-
activ_gamma,
122-
activ_beta,
123-
activ_alpha,
124-
cfsb::ref_out.data,
125-
cfsb::ref_out.data);
119+
void ValidateResult()
120+
{
121+
checks_ran = true;
122+
CalculateCPUValuesIfNeeded();
126123
cfsb::ThresholdChecks();
127124
}
128125

129126
private:
127+
bool cpu_values_calculated = false;
128+
bool checks_ran = false;
129+
130130
[[nodiscard]] miopen::Problem MakeConvProblem() const
131131
{
132132
auto problem = miopen::Problem{};
@@ -167,4 +167,21 @@ struct ConvBiasActivInferFind2Test
167167
},
168168
params);
169169
}
170+
171+
void CalculateCPUValuesIfNeeded()
172+
{
173+
if(cpu_values_calculated)
174+
return;
175+
176+
cpu_values_calculated = true;
177+
cfsb::TearDownConv();
178+
// cpu_bias_forward(cfsb::ref_out, bias);
179+
180+
activationHostInfer(activ_mode,
181+
activ_gamma,
182+
activ_beta,
183+
activ_alpha,
184+
cfsb::ref_out.data,
185+
cfsb::ref_out.data);
186+
}
170187
};

test/gtest/cba_find2_infer.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,25 @@ TEST_P(ConvBiasActivFind2InferTestHalf, ConvCKIgemmFwdBiasActivFind2Fused)
142142
}
143143

144144
#if MIOPEN_BACKEND_HIP
145-
TEST_P(ConvBiasActivFind2InferTestFloatFusionFind, ConvBiasActivAsm1x1UFind2Float_testFind)
145+
TEST_P(ConvBiasActivFind2InferTestFloatFusionFind, ConvBiasActivFind2Float_testFind)
146146
{
147147
setEnvironmentVariable("MIOPEN_FIND_ENFORCE", "SEARCH_DB_UPDATE");
148148
setEnvironmentVariable("MIOPEN_DEBUG_TUNING_ITERATIONS_MAX", "5");
149-
const auto options = miopen::FindOptions{};
150-
auto solutions = fused_problem.FindSolutions(get_handle(), options, 1);
151-
RunTunableSolver<miopen::solver::fusion::ConvBiasActivAsm1x1U>(
152-
fused_problem, invoke_params, conv_config, test_skipped);
149+
std::vector<miopen::Solution> solutions;
150+
151+
ASSERT_NO_THROW(solutions = fused_problem.FindSolutions(get_handle(), {}, 10));
152+
153+
auto tensors = std::unordered_map<miopenTensorArgumentId_t, miopen::Solution::RunInput>{
154+
{miopenTensorConvolutionX, in_dev.get()},
155+
{miopenTensorConvolutionW, wei_dev.get()},
156+
{miopenTensorActivationY, out_dev.get()},
157+
};
158+
159+
for(auto& solution : solutions)
160+
{
161+
ASSERT_NO_THROW(solution.Run(get_handle(), tensors, nullptr, 0));
162+
ValidateResult();
163+
}
153164
}
154165

155166
INSTANTIATE_TEST_SUITE_P(CBAFind2InferSolverTest,

0 commit comments

Comments
 (0)