Skip to content

Commit 645e1bd

Browse files
committed
Fallback to the previous threshold for some sensitive test cases after we updated the 'inference_precision' method of 'SubgraphTest', which may have made the threshold stricter
1 parent 6ca7720 commit 645e1bd

File tree

7 files changed

+29
-9
lines changed

7 files changed

+29
-9
lines changed

src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/conversion.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ void ConvertCPULayerTest::SetUp() {
145145
auto conversion = std::make_shared<ov::op::v0::Convert>(params.front(), outPrc);
146146

147147
function = makeNgraphFunction(inPrc, params, conversion, "ConversionCPU");
148+
149+
if (special_value == ov::test::SpecialValue::none && outPrc == ov::element::f8e4m3) {
150+
abs_threshold = 0.0078125f;
151+
rel_threshold = 1e-2f;
152+
}
148153
}
149154

150155
void ConvertCPULayerTest::generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) {

src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/eltwise.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,15 @@ void EltwiseLayerCPUTest::SetUp() {
158158
std::tie(inFmts, outFmts, priority, selectedType) = cpuParams;
159159
std::tie(postOpMgrPtr, fusedOps) = fusingParams;
160160

161+
// issue 163147
162+
if (ElementType::f16 == netType && enforceSnippets) {
163+
auto fusedOpsNames = postOpMgrPtr ? postOpMgrPtr->getFusedOpsNames() : "";
164+
if (fusedOpsNames.find("PerChannel") != std::string::npos) {
165+
rel_threshold = 0.01f;
166+
abs_threshold = 0.0078125f;
167+
}
168+
}
169+
161170
shapes.resize(2);
162171
switch (opType) {
163172
case ov::test::utils::OpType::SCALAR: {

src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/interaction.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ TEST_P(IntertactionCPUTest_FP16, CompareWithRefs) {
177177
GTEST_SKIP() << "Skipping test, platform don't support precision f16";
178178
}
179179
configuration.insert({ov::hint::inference_precision.name(), ov::element::f16});
180+
rel_threshold = 0.01;
181+
abs_threshold = 0.0078125;
180182

181183
run();
182184
CheckNumberOfNodesWithType(compiledModel, "Interaction", 1);

src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -656,9 +656,6 @@ std::vector<std::string> disabledTestPatterns() {
656656
retVector.emplace_back(
657657
R"(smoke_GroupConv_.*D_Gemm_BF16/GroupConvolutionLayerCPUTest.CompareWithRefs.*primitive=jit_gemm.*)");
658658
retVector.emplace_back(R"(smoke_.*MatMulLayerCPUTest.*INFERENCE_PRECISION_HINT=bf16.*_primitive=jit_gemm.*)");
659-
// Issue: 163147
660-
retVector.emplace_back(
661-
R"(smoke_CompareWithRefs_4D.*[Ff]using.*EltwiseLayerCPUTest\.CompareWithRefs.*INFERENCE_PRECISION_HINT=f16.*enforceSnippets=1.*)");
662659
}
663660

664661
return retVector;

src/tests/functional/plugin/shared/include/snippets/mha.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class MHA : public testing::WithParamInterface<ov::test::snippets::MHAParams>,
5858
protected:
5959
std::shared_ptr<SnippetsFunctionBase> get_subgraph() const override;
6060
void init_params(std::vector<InputShape>& input_shapes, ov::element::Type& prc, ov::AnyMap& additional_config) override;
61+
void init_thresholds() override;
6162

6263
bool m_with_mul = false;
6364
};

src/tests/functional/plugin/shared/src/snippets/mha.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,17 @@ std::shared_ptr<SnippetsFunctionBase> MHA::get_subgraph() const {
153153
return std::make_shared<ov::test::snippets::MHAFunction>(inputDynamicShapes, m_input_types, m_with_mul, is_with_reshape);
154154
}
155155

156+
void MHA::init_thresholds() {
157+
MHABase::init_thresholds();
158+
auto precision_hint = configuration.count(ov::hint::inference_precision.name())
159+
? configuration.at(ov::hint::inference_precision.name())
160+
: ov::element::f32;
161+
if (m_input_types[0] == ov::element::bf16 && precision_hint == ov::element::f32) {
162+
rel_threshold = 0.01f;
163+
abs_threshold = 0.0078125f;
164+
}
165+
}
166+
156167
void MHASelect::generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) {
157168
inputs.clear();
158169
auto model_inputs = function->inputs();

src/tests/functional/shared_test_classes/src/base/ov_subgraph.cpp

+1-6
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,7 @@ void SubgraphBaseTest::compile_model() {
306306
std::cout << "[ PLUGIN ] `SubgraphBaseTest::compile_model()` is finished successfully. Duration is " << duration.count() << "s" << std::endl;
307307
}
308308
try {
309-
// TODO: use this compiledModel property for all platforms when the new failed testcases are fixed
310-
if (ov::with_cpu_x86_avx2_vnni()) {
311-
inference_precision = compiledModel.get_property(ov::hint::inference_precision);
312-
} else {
313-
inference_precision = core->get_property(targetDevice, ov::hint::inference_precision);
314-
}
309+
inference_precision = compiledModel.get_property(ov::hint::inference_precision);
315310
} catch (std::exception& e) {
316311
std::cout << "[ WARNING ] Impossible to get Inference Precision with exception: " << e.what() << std::endl;
317312
}

0 commit comments

Comments
 (0)