Skip to content

Commit

Permalink
Enable tests for Loop and Scan
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhan authored Oct 9, 2023
1 parent 00944f4 commit f3e251b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 6 additions & 2 deletions onnxruntime/test/providers/cpu/controlflow/loop_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,11 @@ void RunTest(int64_t max_iterations,
// we want the CUDA provider to be first, and the CPU provider second. all except the Loop node should run on
// CUDA given that, which creates the scenario where we need to copy to/from CPU to execute the Loop node correctly.
std::vector<std::unique_ptr<IExecutionProvider>> execution_providers;
#if defined(USE_CUDA)
execution_providers.push_back(DefaultCudaExecutionProvider());
#elif defined(USE_ROCM)
execution_providers.push_back(DefaultRocmExecutionProvider());
#endif
execution_providers.push_back(DefaultCpuExecutionProvider());

test.Run(expect_result, failure_message, {kTensorrtExecutionProvider}, nullptr, &execution_providers);
Expand Down Expand Up @@ -1038,8 +1042,8 @@ TEST(Loop, IterationCountAsOutput) {
test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kTensorrtExecutionProvider});
}

#ifdef USE_CUDA
// test that when part of the subgraph run on CUDA it executes successfully
#if defined(USE_CUDA) || defined(USE_ROCM)
// test that when part of the subgraph run on CUDA/ROCm it executes successfully
TEST(Loop, MixedExecutionProviders) {
RunOptions options{};
options.mixed_execution_providers = true;
Expand Down
10 changes: 9 additions & 1 deletion onnxruntime/test/providers/cpu/controlflow/scan_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,11 @@ static void RunTest_v9(const std::string test_name, int64_t sequence_len, int64_
// we want the CUDA provider to be first, and the CPU provider second. all except the Scan node should run on
// CUDA given that, which creates the scenario where we need to copy to/from CPU to execute the Scan node correctly.
std::vector<std::unique_ptr<IExecutionProvider>> execution_providers;
#if defined(USE_CUDA)
execution_providers.push_back(DefaultCudaExecutionProvider());
#elif defined(USE_ROCM)
execution_providers.push_back(DefaultRocmExecutionProvider());
#endif
execution_providers.push_back(DefaultCpuExecutionProvider());

test.Run(expect_result, failure_message, options.excluded_provider_types, nullptr, &execution_providers);
Expand Down Expand Up @@ -1162,7 +1166,11 @@ void UnknownDimInSubgraphOutput(bool is_v8, bool mixed_execution_providers = fal
// we want the CUDA provider to be first, and the CPU provider second. all except the Scan node should run on
// CUDA given that, which creates the scenario where we need to copy to/from CPU to execute the Scan node correctly.
std::vector<std::unique_ptr<IExecutionProvider>> execution_providers;
#if defined(USE_CUDA)
execution_providers.push_back(DefaultCudaExecutionProvider());
#elif defined(USE_ROCM)
execution_providers.push_back(DefaultRocmExecutionProvider());
#endif
execution_providers.push_back(DefaultCpuExecutionProvider());

test.Run(OpTester::ExpectResult::kExpectSuccess, "", RunOptions().excluded_provider_types, nullptr,
Expand All @@ -1174,7 +1182,7 @@ void UnknownDimInSubgraphOutput(bool is_v8, bool mixed_execution_providers = fal

TEST_8_AND_9(UnknownDimInSubgraphOutput);

#ifdef USE_CUDA
#if defined(USE_CUDA) || defined(USE_ROCM)
TEST(Scan, MixedExecutionProviders) {
RunOptions options{};
options.is_v8 = false;
Expand Down

0 comments on commit f3e251b

Please sign in to comment.