From c94ffff003bb4dcfb96ef10db1cc07ec9fe284f3 Mon Sep 17 00:00:00 2001 From: Hari Seshadri Date: Wed, 1 Apr 2026 12:09:31 -0700 Subject: [PATCH 1/2] Disable 4-D MVN tests for DirectML --- onnxruntime/test/contrib_ops/tensor_op_test.cc | 10 ++++++++-- .../cpu/tensor/mean_variance_normalization_test.cc | 13 +++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/onnxruntime/test/contrib_ops/tensor_op_test.cc b/onnxruntime/test/contrib_ops/tensor_op_test.cc index bc2ff5f4f724d..790afb827999d 100644 --- a/onnxruntime/test/contrib_ops/tensor_op_test.cc +++ b/onnxruntime/test/contrib_ops/tensor_op_test.cc @@ -121,7 +121,10 @@ void MeanVarianceNormalizationAcrossChannels(bool across_channels, bool normaliz test.AddAttribute("normalize_variance", normalize_variance ? one : zero); test.AddInput("input", {N, C, H, W}, X); test.AddOutput("output", {N, C, H, W}, result); - test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kOpenVINOExecutionProvider, kTensorrtExecutionProvider}); // OpenVINO doesn't support MVN operator below opset 9. TensorRT doesn't support opset 8 of MVN operator. + // DML currently has known failures in this 4D MVN coverage. + // OpenVINO does not support MVN below opset 9. TensorRT does not support MVN opset 8. + test.Run(OpTester::ExpectResult::kExpectSuccess, "", + {kDmlExecutionProvider, kOpenVINOExecutionProvider, kTensorrtExecutionProvider}); } void MeanVarianceNormalizationPerChannel(bool across_channels, bool normalize_variance) { @@ -188,7 +191,10 @@ void MeanVarianceNormalizationPerChannel(bool across_channels, bool normalize_va test.AddAttribute("normalize_variance", normalize_variance ? one : zero); test.AddInput("input", {N, C, H, W}, X); test.AddOutput("output", {N, C, H, W}, result); - test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kOpenVINOExecutionProvider, kTensorrtExecutionProvider}); // OpenVINO doesn't support MVN operator below opset 9. TensorRT doesn't support opset 8 of MVN operator. + // DML currently has known failures in this 4D MVN coverage. + // OpenVINO does not support MVN below opset 9. TensorRT does not support MVN opset 8. + test.Run(OpTester::ExpectResult::kExpectSuccess, "", + {kDmlExecutionProvider, kOpenVINOExecutionProvider, kTensorrtExecutionProvider}); } TEST(MVNContribOpTest, MeanVarianceNormalizationCPUTest_Version1_TO_8) { diff --git a/onnxruntime/test/providers/cpu/tensor/mean_variance_normalization_test.cc b/onnxruntime/test/providers/cpu/tensor/mean_variance_normalization_test.cc index 8dcb15cbc6926..8181e45ee04cf 100644 --- a/onnxruntime/test/providers/cpu/tensor/mean_variance_normalization_test.cc +++ b/onnxruntime/test/providers/cpu/tensor/mean_variance_normalization_test.cc @@ -69,7 +69,9 @@ TEST(MeanVarianceNormalizationTest, DefaultAxes) { OpTester test("MeanVarianceNormalization", 9); test.AddInput("input", {N, C, H, W}, X); test.AddOutput("output", {N, C, H, W}, result); - test.Run(); + // DML currently has known failures in this 4D default-axes MVN coverage. Keep coverage on + // CPU/other EPs while the DML-specific issue is investigated. + test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kDmlExecutionProvider}); } static void TestMeanVarianceNormalizationOverAllAxes(const std::vector& shape) { @@ -90,7 +92,12 @@ static void TestMeanVarianceNormalizationOverAllAxes(const std::vector& test.AddInput("input", shape, X); test.AddOutput("output", shape, Y); - test.Run(); + if (shape.size() == 4) { + // Restrict the DML exclusion to the known failing 4D all-axes coverage. + test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kDmlExecutionProvider}); + } else { + test.Run(); + } } TEST(MeanVarianceNormalizationTest, AllAxes) { @@ -157,6 +164,8 @@ TEST(MeanVarianceNormalizationTest, AxesSubsets5D) { test.AddOutput("output", shape, Y.data(), Y.size()); if (DefaultDmlExecutionProvider().get() != nullptr) { + // 5D subset-axis coverage stays enabled for DML. Use a small tolerance to account for + // expected numeric drift without masking the separate 4D DML-specific failures. test.SetOutputTolerance(0.001f); } From 6844c45a4448819b7f9f53fd6dee3e8008f2e180 Mon Sep 17 00:00:00 2001 From: Hari Seshadri Date: Wed, 1 Apr 2026 14:06:48 -0700 Subject: [PATCH 2/2] Address copilot comments --- onnxruntime/test/contrib_ops/tensor_op_test.cc | 8 ++++++-- .../cpu/tensor/mean_variance_normalization_test.cc | 10 ++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/onnxruntime/test/contrib_ops/tensor_op_test.cc b/onnxruntime/test/contrib_ops/tensor_op_test.cc index 790afb827999d..2922e6517943e 100644 --- a/onnxruntime/test/contrib_ops/tensor_op_test.cc +++ b/onnxruntime/test/contrib_ops/tensor_op_test.cc @@ -122,7 +122,9 @@ void MeanVarianceNormalizationAcrossChannels(bool across_channels, bool normaliz test.AddInput("input", {N, C, H, W}, X); test.AddOutput("output", {N, C, H, W}, result); // DML currently has known failures in this 4D MVN coverage. - // OpenVINO does not support MVN below opset 9. TensorRT does not support MVN opset 8. + // See https://github.com/microsoft/onnxruntime/issues/27933 and remove this exclusion once + // that issue is fixed. OpenVINO does not support MVN below opset 9. TensorRT does not + // support MVN opset 8. test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kDmlExecutionProvider, kOpenVINOExecutionProvider, kTensorrtExecutionProvider}); } @@ -191,8 +193,10 @@ void MeanVarianceNormalizationPerChannel(bool across_channels, bool normalize_va test.AddAttribute("normalize_variance", normalize_variance ? one : zero); test.AddInput("input", {N, C, H, W}, X); test.AddOutput("output", {N, C, H, W}, result); - // DML currently has known failures in this 4D MVN coverage. // OpenVINO does not support MVN below opset 9. TensorRT does not support MVN opset 8. + // DML currently has known failures in this 4D MVN coverage. + // See https://github.com/microsoft/onnxruntime/issues/27933 and remove this exclusion once + // that issue is fixed. test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kDmlExecutionProvider, kOpenVINOExecutionProvider, kTensorrtExecutionProvider}); } diff --git a/onnxruntime/test/providers/cpu/tensor/mean_variance_normalization_test.cc b/onnxruntime/test/providers/cpu/tensor/mean_variance_normalization_test.cc index 8181e45ee04cf..2d688dc32299e 100644 --- a/onnxruntime/test/providers/cpu/tensor/mean_variance_normalization_test.cc +++ b/onnxruntime/test/providers/cpu/tensor/mean_variance_normalization_test.cc @@ -69,8 +69,9 @@ TEST(MeanVarianceNormalizationTest, DefaultAxes) { OpTester test("MeanVarianceNormalization", 9); test.AddInput("input", {N, C, H, W}, X); test.AddOutput("output", {N, C, H, W}, result); - // DML currently has known failures in this 4D default-axes MVN coverage. Keep coverage on - // CPU/other EPs while the DML-specific issue is investigated. + // DML currently has known failures in this 4D default-axes MVN coverage. + // See https://github.com/microsoft/onnxruntime/issues/27933 and remove this exclusion once + // that issue is fixed. test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kDmlExecutionProvider}); } @@ -94,6 +95,8 @@ static void TestMeanVarianceNormalizationOverAllAxes(const std::vector& if (shape.size() == 4) { // Restrict the DML exclusion to the known failing 4D all-axes coverage. + // See https://github.com/microsoft/onnxruntime/issues/27933 and remove this exclusion once + // that issue is fixed. test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kDmlExecutionProvider}); } else { test.Run(); @@ -164,8 +167,7 @@ TEST(MeanVarianceNormalizationTest, AxesSubsets5D) { test.AddOutput("output", shape, Y.data(), Y.size()); if (DefaultDmlExecutionProvider().get() != nullptr) { - // 5D subset-axis coverage stays enabled for DML. Use a small tolerance to account for - // expected numeric drift without masking the separate 4D DML-specific failures. + // 5D subset-axis coverage stays enabled for DML. test.SetOutputTolerance(0.001f); }