Skip to content

Commit f386f4b

Browse files
committed
Fix ConfigEps execution provider ordering in test files
1 parent 3874516 commit f386f4b

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

onnxruntime/test/contrib_ops/skiplayernorm_op_test.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,14 @@ static void RunOneTest(
9494
sum_output_data);
9595
}
9696

97-
if (cpu_ep != nullptr) {
98-
execution_providers.push_back(DefaultCpuExecutionProvider());
99-
}
97+
// Add WebGPU EP first so it gets tested before CPU EP
98+
// (ConfigEps runs the first available EP for the operator)
10099
if (webgpu_ep != nullptr) {
101100
execution_providers.push_back(DefaultWebGpuExecutionProvider());
102101
}
102+
if (cpu_ep != nullptr) {
103+
execution_providers.push_back(DefaultCpuExecutionProvider());
104+
}
103105

104106
test.Run(OpTester::ExpectResult::kExpectSuccess, "", {}, nullptr, &execution_providers);
105107
} else if (CudaHasBF16Support() && use_bfloat16) {

onnxruntime/test/providers/cpu/tensor/gather_op_test.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,12 @@ TEST(GatherOpTest, Gather_axis1_scalar_indices) {
440440

441441
TEST(ShrunkenGatherOpTest, ShrunkenGather_PositiveAxis) {
442442
std::vector<std::unique_ptr<IExecutionProvider>> execution_providers;
443-
execution_providers.emplace_back(DefaultCpuExecutionProvider());
443+
// Add CUDA EP first so it gets tested before CPU EP
444+
// (ConfigEps runs the first available EP for the operator)
444445
#ifdef USE_CUDA
445446
execution_providers.emplace_back(DefaultCudaExecutionProvider());
446447
#endif
448+
execution_providers.emplace_back(DefaultCpuExecutionProvider());
447449

448450
OpTester test("ShrunkenGather", 1, onnxruntime::kMSDomain);
449451
test.AddAttribute<int64_t>("axis", 0LL);
@@ -461,10 +463,12 @@ TEST(ShrunkenGatherOpTest, ShrunkenGather_PositiveAxis) {
461463

462464
TEST(ShrunkenGatherOpTest, ShrunkenGather_NegativeAxis) {
463465
std::vector<std::unique_ptr<IExecutionProvider>> execution_providers;
464-
execution_providers.emplace_back(DefaultCpuExecutionProvider());
466+
// Add CUDA EP first so it gets tested before CPU EP
467+
// (ConfigEps runs the first available EP for the operator)
465468
#ifdef USE_CUDA
466469
execution_providers.emplace_back(DefaultCudaExecutionProvider());
467470
#endif
471+
execution_providers.emplace_back(DefaultCpuExecutionProvider());
468472

469473
OpTester test("ShrunkenGather", 1, onnxruntime::kMSDomain);
470474
test.AddAttribute<int64_t>("axis", -1LL);
@@ -482,10 +486,12 @@ TEST(ShrunkenGatherOpTest, ShrunkenGather_NegativeAxis) {
482486

483487
TEST(ShrunkenGatherOpTest, ShrunkenGather_InvalidIndicesRank) {
484488
std::vector<std::unique_ptr<IExecutionProvider>> execution_providers;
485-
execution_providers.emplace_back(DefaultCpuExecutionProvider());
489+
// Add CUDA EP first so it gets tested before CPU EP
490+
// (ConfigEps runs the first available EP for the operator)
486491
#ifdef USE_CUDA
487492
execution_providers.emplace_back(DefaultCudaExecutionProvider());
488493
#endif
494+
execution_providers.emplace_back(DefaultCpuExecutionProvider());
489495

490496
OpTester test("ShrunkenGather", 1, onnxruntime::kMSDomain);
491497
test.AddAttribute<int64_t>("axis", 0LL);
@@ -503,10 +509,12 @@ TEST(ShrunkenGatherOpTest, ShrunkenGather_InvalidIndicesRank) {
503509

504510
TEST(ShrunkenGatherOpTest, ShrunkenGather_InvalidInputRank) {
505511
std::vector<std::unique_ptr<IExecutionProvider>> execution_providers;
506-
execution_providers.emplace_back(DefaultCpuExecutionProvider());
512+
// Add CUDA EP first so it gets tested before CPU EP
513+
// (ConfigEps runs the first available EP for the operator)
507514
#ifdef USE_CUDA
508515
execution_providers.emplace_back(DefaultCudaExecutionProvider());
509516
#endif
517+
execution_providers.emplace_back(DefaultCpuExecutionProvider());
510518

511519
OpTester test("ShrunkenGather", 1, onnxruntime::kMSDomain);
512520
test.AddAttribute<int64_t>("axis", 0LL);

0 commit comments

Comments
 (0)