-
Notifications
You must be signed in to change notification settings - Fork 1.8k
test: Add Torch AOTI Tests #8771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
whoisj
wants to merge
7
commits into
main
Choose a base branch
from
jwyman/pt2-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+816
−87
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8b32cc1
test: Add Torch AOTI Tests
whoisj 76f247c
Potential fix for pull request finding 'CodeQL / Unused import'
whoisj 726fdc3
test: Add Torch AOTI Tests
whoisj 676e7f9
remove gitignore
whoisj 48a3375
adopt recommended changes from CoPilot
whoisj 4c94fa7
Potential fix for pull request finding 'CodeQL / Unused import'
whoisj 891098d
adopt changes requested by @yingeeh.
whoisj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| #!/bin/bash | ||
| # Copyright 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # Redistribution and use in source and binary forms, with or without | ||
| # modification, are permitted provided that the following conditions | ||
| # are met: | ||
| # * Redistributions of source code must retain the above copyright | ||
| # notice, this list of conditions and the following disclaimer. | ||
| # * Redistributions in binary form must reproduce the above copyright | ||
| # notice, this list of conditions and the following disclaimer in the | ||
| # documentation and/or other materials provided with the distribution. | ||
| # * Neither the name of NVIDIA CORPORATION nor the names of its | ||
| # contributors may be used to endorse or promote products derived | ||
| # from this software without specific prior written permission. | ||
| # | ||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY | ||
| # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
| # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
| # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
| # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
| # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
| # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
|
||
| source ../common/util.sh | ||
|
|
||
| if [[ "${DEBUG}" == "true" ]]; then | ||
| set -x | ||
| else | ||
| set +x | ||
| fi | ||
|
|
||
| COLOR_DARK="\033[90m" | ||
| COLOR_ERROR="\033[31m" | ||
| COLOR_INFO="\033[94m" | ||
| COLOR_RESET="\033[0m" | ||
| COLOR_STATUS="\033[36m" | ||
| COLOR_SUCCESS="\033[32m" | ||
| COLOR_WARNING="\033[33m" | ||
| RET=0 | ||
|
|
||
| REPO_VERSION=${NVIDIA_TRITON_SERVER_VERSION} | ||
| if [[ "$#" -ge 1 ]]; then | ||
| REPO_VERSION=$1 | ||
| fi | ||
| if [[ -z "$REPO_VERSION" ]]; then | ||
| echo -e "${COLOR_ERROR}Repository version must be specified${COLOR_RESET}" 1>&2 | ||
| echo -e "${COLOR_ERROR}\n***\n*** Test Failed\n***${COLOR_RESET}" 1>&2 | ||
| exit 1 | ||
| fi | ||
| if [[ ! -z "$TEST_REPO_ARCH" ]]; then | ||
| REPO_VERSION=${REPO_VERSION}_${TEST_REPO_ARCH} | ||
| fi | ||
|
|
||
| export CUDA_VISIBLE_DEVICES=0 | ||
|
|
||
| MODELDIR=${MODELDIR:=`pwd`/models} | ||
| DATADIR=${DATADIR:="/data/inferenceserver/${REPO_VERSION}"} | ||
| TRITON_DIR=${TRITON_DIR:="/opt/tritonserver"} | ||
| SERVER=${TRITON_DIR}/bin/tritonserver | ||
| BACKEND_DIR=${TRITON_DIR}/backends | ||
|
|
||
| # PyTorch on SBSA requires libgomp to be loaded first. See the following | ||
| # GitHub issue for more information: | ||
| # https://github.com/pytorch/pytorch/issues/2575 | ||
| arch=`uname -m` | ||
| echo -e "${COLOR_DARK}Detected architecture: ${arch}${COLOR_RESET}" | ||
| if [[ "${arch}" == "aarch64" ]]; then | ||
| SERVER_LD_PRELOAD=/usr/lib/$(uname -m)-linux-gnu/libgomp.so.1 | ||
| echo -e "${COLOR_DARK}SERVER_LD_PRELOAD=${SERVER_LD_PRELOAD}${COLOR_RESET}" | ||
| fi | ||
|
|
||
| # If BACKENDS not specified, set to all | ||
| BACKENDS=${BACKENDS:="pytorch"} | ||
| export BACKENDS | ||
|
|
||
| # Copy the models into the model repository | ||
| echo -e "${COLOR_DARK}Setting up model repository in ${MODELDIR}${COLOR_RESET}" | ||
| rm -rf ${MODELDIR} && mkdir -p ${MODELDIR} | ||
| models=( | ||
| "torch_aoti_complex_index" | ||
| "torch_aoti_complex_named" | ||
| "torch_aoti_int8_int8" | ||
| "torch_aoti_int16_int16" | ||
| "torch_aoti_int32_int32" | ||
| "torch_aoti_int64_int64" | ||
| "torch_aoti_float16_float16" | ||
| "torch_aoti_float32_float32" | ||
| "torchvision_aoti" | ||
| ) | ||
| for model in "${models[@]}"; do | ||
| cp -r ${DATADIR}/qa_model_repository/${model} ${MODELDIR}/${model} | ||
| echo -e "${COLOR_DARK}ls ${MODELDIR}/${model}${COLOR_RESET}" | ||
| ls -lha ${MODELDIR}/${model} | ||
| done | ||
| echo -e "${COLOR_DARK}ls ${MODELDIR}${COLOR_RESET}" | ||
| ls -lha ${MODELDIR} | ||
|
|
||
| SERVER_ARGS="--model-repository=${MODELDIR} --log-verbose=1" | ||
| SERVER_LOG="./torch_aoti_complex_named-server.log" | ||
| CLIENT_LOG="./torch_aoti_complex_named-client.log" | ||
|
|
||
| echo -e "${COLOR_DARK}Running ${SERVER} with model repository ${MODELDIR}${COLOR_RESET}" | ||
| run_server | ||
| if [[ "${SERVER_PID}" -eq 0 ]]; then | ||
| echo -e "${COLOR_ERROR}\n***\n*** Failed to start ${SERVER}\n***${COLOR_RESET}" &1>2 | ||
| cat ${SERVER_LOG} &1>2 | ||
| echo -e "\n" &1>2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Install torch framework | ||
| echo -e "${COLOR_DARK}Installing PyTorch framework required by tests${COLOR_RESET}" | ||
| pip install torch | ||
|
|
||
| # Run the Tests | ||
| TEST_NAME="torch_aoti_infer_test" | ||
| python3 ./${TEST_NAME}.py >> ${CLIENT_LOG} 2>&1 | ||
| EXIT_CODE=$? | ||
| if [[ ${EXIT_CODE} -ne 0 ]]; then | ||
| echo -e "${COLOR_ERROR}\n***\n*** Test '${TEST_NAME}' Failed with exit code ${EXIT_CODE}\n***${COLOR_RESET}" &1>2 | ||
| cat ${CLIENT_LOG} &1>2 | ||
| echo -e "\n" &1>2 | ||
| RET=1 | ||
| else | ||
| echo -e "${COLOR_INFO}\n***\n*** Test '${TEST_NAME}' Passed\n***${COLOR_RESET}" | ||
| fi | ||
|
|
||
| # Cleanup | ||
| echo -e "${COLOR_DARK}Killing server (pid: ${SERVER_PID})${COLOR_RESET}" | ||
| kill -s SIGINT ${SERVER_PID} | ||
|
whoisj marked this conversation as resolved.
|
||
| wait ${SERVER_PID} || true | ||
| echo -e "${COLOR_DARK}Removing model repository${COLOR_RESET}" | ||
| for model in "${models[@]}"; do | ||
| rm -rf ${MODELDIR}/${model} | ||
| done | ||
|
|
||
| # Report results and exit. | ||
| if [[ ${RET} -ne 0 ]]; then | ||
| echo -e "${COLOR_ERROR}\n***\n*** Test Suite FAILED\n***${COLOR_RESET}" &1>2 | ||
| else | ||
| echo -e "${COLOR_SUCCESS}\n***\n*** Test Suite PASSED\n***${COLOR_RESET}" | ||
| fi | ||
|
|
||
| exit ${RET} | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.