Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/linux_x64_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ jobs:
cmake --build out/build -j `nproc`
cmake --install out/build

# Copy test binary to install directory for artifact upload
# Copy test binary and testdata to install directory for artifact upload
cp out/build/trt_ep_tests out/${ARTIFACT_NAME}/bin/ 2>/dev/null || true
cp -r out/build/testdata out/${ARTIFACT_NAME}/bin/testdata 2>/dev/null || true

- name: Upload artifacts
uses: actions/upload-artifact@v7
Expand Down Expand Up @@ -374,17 +375,18 @@ jobs:
"$GITHUB_WORKSPACE/onnxruntime/onnxruntime_provider_test" \
"${{ env.ARTIFACT_NAME }}"

- name: Run CUDA graph tests
- name: Run unit tests
env:
TRT_EP_LIBRARY_PATH: ${{ env.TRTEP_LIBRARY_PATH }}
TESTDATA_DIR: "${{ github.workspace }}/orttrtep/bin/testdata"
LD_LIBRARY_PATH: "${{ github.workspace }}/onnxruntime:${{ github.workspace }}/orttrtep/lib:$LD_LIBRARY_PATH"
run: |
TEST_EXE="$GITHUB_WORKSPACE/orttrtep/bin/trt_ep_tests"
if [ -f "$TEST_EXE" ]; then
chmod +x "$TEST_EXE"
"$TEST_EXE" --gtest_output=xml:cuda_graph_test_results.xml
"$TEST_EXE" --gtest_output=xml:trt_ep_unit_test_results.xml
else
echo "WARNING: trt_ep_tests not found, skipping CUDA graph tests"
echo "WARNING: trt_ep_tests not found, skipping unit tests"
fi

- name: Upload build artifacts
Expand All @@ -395,4 +397,4 @@ jobs:
path: |
${{ env.ARTIFACT_NAME }}.xml
${{ env.ARTIFACT_NAME }}.log
cuda_graph_test_results.xml
trt_ep_unit_test_results.xml
15 changes: 10 additions & 5 deletions .github/workflows/windows_x64_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,13 @@ jobs:
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --install out/build

:: Copy test binary to install directory for artifact upload
:: Copy test binary and testdata to install directory for artifact upload
copy out\build\trt_ep_tests.exe out\%ARTIFACT_NAME%\bin\ 2>nul || (
copy out\build\%BUILD_TYPE%\trt_ep_tests.exe out\%ARTIFACT_NAME%\bin\ 2>nul
)
xcopy out\build\testdata out\%ARTIFACT_NAME%\bin\testdata\ /E /I /Q 2>nul || (
xcopy out\build\%BUILD_TYPE%\testdata out\%ARTIFACT_NAME%\bin\testdata\ /E /I /Q 2>nul
)

- name: Upload artifacts
uses: actions/upload-artifact@v7
Expand Down Expand Up @@ -333,22 +336,24 @@ jobs:
exit $lastExitCode
}

- name: Run CUDA graph tests
- name: Run unit tests
shell: pwsh
env:
TRT_EP_LIBRARY_PATH: ${{ env.TRTEP_LIBRARY_PATH }}
TESTDATA_DIR: '${{ github.workspace }}\orttrtep\bin\testdata'
run: |
$testExe = "${{ github.workspace }}\orttrtep\bin\trt_ep_tests.exe"
if (Test-Path $testExe) {
# Copy onnxruntime.dll to same directory as test exe so it's found
Copy-Item "${{ github.workspace }}\onnxruntime\onnxruntime.dll" `
"${{ github.workspace }}\orttrtep\bin\onnxruntime.dll" -ErrorAction SilentlyContinue
& $testExe --gtest_output=xml:cuda_graph_test_results.xml

& $testExe --gtest_output=xml:trt_ep_unit_test_results.xml
if ($lastExitCode -ne 0) {
exit $lastExitCode
}
} else {
Write-Warning "trt_ep_tests.exe not found, skipping CUDA graph tests"
Write-Warning "trt_ep_tests.exe not found, skipping unit tests"
}

- name: Upload build artifacts
Expand All @@ -359,4 +364,4 @@ jobs:
path: |
${{ env.ARTIFACT_NAME }}.xml
${{ env.ARTIFACT_NAME }}.log
cuda_graph_test_results.xml
trt_ep_unit_test_results.xml
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ if(ORTTensorRTEp_BUILD_TESTS)

add_executable(trt_ep_tests
tests/cuda_graph_test.cc
tests/tensorrt_basic_test.cc
)
target_compile_definitions(trt_ep_tests PRIVATE
-DONNX_NAMESPACE=onnx
Expand All @@ -247,8 +248,20 @@ if(ORTTensorRTEp_BUILD_TESTS)
GTest::gtest_main
)

# Copy testdata to the build directory so tests can find it
if(EXISTS "${CMAKE_SOURCE_DIR}/tests/testdata")
add_custom_command(TARGET trt_ep_tests POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/tests/testdata"
"$<TARGET_FILE_DIR:trt_ep_tests>/testdata"
COMMENT "Copying testdata to build output directory"
)
endif()

include(GoogleTest)
gtest_discover_tests(trt_ep_tests)
gtest_discover_tests(trt_ep_tests
PROPERTIES ENVIRONMENT "TESTDATA_DIR=$<TARGET_FILE_DIR:trt_ep_tests>/testdata"
)
endif()

if(ORTTensorRTEp_INSTALL)
Expand Down
4 changes: 4 additions & 0 deletions src/tensorrt_execution_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3661,6 +3661,10 @@ OrtStatus* TRTEpNodeComputeInfo::ComputeImpl(OrtNodeComputeInfo* this_ptr, void*
return ep.ort_api.CreateStatus(ORT_EP_FAIL, err_msg.c_str());
}
trt_context = trt_state->context->get();

// Clear DDS output allocator map since the old allocators were registered on
// the previous context. They need to be re-registered on the new context.
dds_output_allocator_map.clear();
}

// Check before using trt_engine
Expand Down
Loading
Loading