Skip to content

[ROCm] enable test_api (test_libtorch) cpp unit tests - #106712

Closed
hongxiayang wants to merge 1 commit into
pytorch:mainfrom
hongxiayang:enable_rocm_cpp_test_libtorch
Closed

hongxiayang wants to merge 1 commit into
pytorch:mainfrom
hongxiayang:enable_rocm_cpp_test_libtorch

Conversation

@hongxiayang

@hongxiayang hongxiayang commented Aug 7, 2023 •

Copy link
Copy Markdown
Collaborator

This is part of effort to enable missed cpp tests for ROCm platform.
In this change,

  • enabled test_libtorch cpp tests (more than 3107 tests)
  • fixed missing dependency: libcaffe2_nvrtc.so required by FunctionalTest.Conv1d
  • test_api binary is changed to exclude failed tests InitTest and IntegrationTest - to revisit later

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @dllehr-amd @jataylo

@pytorch-bot

pytorch-bot Bot commented Aug 7, 2023 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/106712

Note: Links to docs will display an error until the docs builds have been completed.

✅ 6 Unrelated Failures

As of commit 6019bd7:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added the module: rocm AMD GPU support for Pytorch label Aug 7, 2023
@hongxiayang

Copy link
Copy Markdown
Collaborator Author

@pytorchbot label ciflow/trunk

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Aug 7, 2023
@hongxiayang

Copy link
Copy Markdown
Collaborator Author

@pytorchbot label "topic: not user facing"

@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Aug 7, 2023
@hongxiayang

Copy link
Copy Markdown
Collaborator Author

test_api tests are enabled and running in the ci. For example, from the log:
https://pipelines.actions.githubusercontent.com/serviceHosts/7d146c05-69c3-4c20-a0e7-818111670117/_apis/pipelines/1/runs/3233749/signedlogcontent/207?urlExpires=2023-08-07T21%3A50%3A13.1259313Z&urlSigningMethod=HMACV1&urlSignature=jdUjBAwmHfu5neJyGDB3sFcQYysnNdeOE%2Fx5nww9Ofw%3D

023-08-07T20:35:29.2175588Z scheduling tests via LoadScheduling
2023-08-07T20:35:29.2176079Z 
2023-08-07T20:35:29.2178054Z ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::AutogradAPITests::RegisterHookVoidReturnAcceptsUndefinedTensor 
2023-08-07T20:35:29.2180217Z ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::AnyModuleTest::WrongNumberOfArguments 
2023-08-07T20:35:29.2182589Z ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::DataTest::DataShuttlePopResultTimesOut 
2023-08-07T20:35:29.2184379Z ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::FunctionalTest::Conv1d 
2023-08-07T20:35:29.2187000Z [gw0] [  0%] PASSED [0.9947s] ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::AutogradAPITests::RegisterHookVoidReturnAcceptsUndefinedTensor 
2023-08-07T20:35:29.2189425Z ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::AutogradAPITests::RegisterHookTensorReturnAcceptsUndefinedTensor 
2023-08-07T20:35:29.2191745Z [gw1] [  0%] PASSED [1.0265s] ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::AnyModuleTest::WrongNumberOfArguments 
2023-08-07T20:35:29.2194271Z ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::AnyModuleTest::PassingArgumentsToModuleWithDefaultArgumentsInForwardMethod 
2023-08-07T20:35:29.2196727Z [gw3] [  0%] PASSED [1.0370s] ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::FunctionalTest::Conv1d 
2023-08-07T20:35:29.2198599Z ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::FunctionalTest::Conv2dEven 
2023-08-07T20:35:29.2200657Z [gw2] [  0%] PASSED [1.0659s] ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::DataTest::DataShuttlePopResultTimesOut 
2023-08-07T20:35:29.2202711Z ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::DataTest::SharedBatchDatasetReallyIsShared 
2023-08-07T20:35:29.2205078Z [gw0] [  0%] PASSED [1.0149s] ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::AutogradAPITests::RegisterHookTensorReturnAcceptsUndefinedTensor 
2023-08-07T20:35:29.2207253Z ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::AutogradAPITests::BackwardSimpleTest 
2023-08-07T20:35:29.2210107Z [gw1] [  0%] PASSED [1.0090s] ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::AnyModuleTest::PassingArgumentsToModuleWithDefaultArgumentsInForwardMethod 
2023-08-07T20:35:29.2212465Z ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::AnyModuleTest::GetWithCorrectTypeSucceeds 
2023-08-07T20:35:29.2214614Z [gw2] [  0%] PASSED [0.9825s] ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::DataTest::SharedBatchDatasetReallyIsShared 
2023-08-07T20:35:29.2216994Z ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::DataTest::SharedBatchDatasetDoesNotIncurCopyWhenPassedDatasetObject 
2023-08-07T20:35:29.2219460Z [gw3] [  0%] PASSED [1.0508s] ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::FunctionalTest::Conv2dEven 
2023-08-07T20:35:29.2221505Z ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::FunctionalTest::Conv2dUneven 
2023-08-07T20:35:29.2223669Z [gw1] [  0%] PASSED [0.9461s] ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::AnyModuleTest::GetWithCorrectTypeSucceeds 
2023-08-07T20:35:29.2225671Z ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::AnyModuleTest::GetWithIncorrectTypeThrows 
2023-08-07T20:35:29.2229717Z [gw2] [  0%] PASSED [0.9715s] ../../../../../opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/bin/test_api::DataTest::SharedBatchDatasetDoesNotIncurCopyWhenPassedDatasetObject 

Comment thread .ci/pytorch/test.sh
echo "Testing libtorch"
ln -sf "$TORCH_LIB_DIR"/libbackend_with_compiler.so "$TORCH_BIN_DIR"
ln -sf "$TORCH_LIB_DIR"/libjitbackend_test.so "$TORCH_BIN_DIR"
ln -sf "$TORCH_LIB_DIR"/libcaffe2_nvrtc.so "$TORCH_BIN_DIR"

@jithunnair-amd jithunnair-amd Aug 7, 2023 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes me wonder how that library was being installed for CUDA builds

@hongxiayang

Copy link
Copy Markdown
Collaborator Author

rocm5.6 tests are successful.
trunk / linux-focal-rocm5.6-py3.8 / test (default, 1, 3, linux.rocm.gpu, unstable)
trunk / linux-focal-rocm5.6-py3.8 / test (default, 2, 3, linux.rocm.gpu, unstable) (push)
trunk / linux-focal-rocm5.6-py3.8 / test (default, 3, 3, linux.rocm.gpu, unstable) (push)
.

@jithunnair-amd
jithunnair-amd marked this pull request as ready for review August 8, 2023 01:22
@hongxiayang

Copy link
Copy Markdown
Collaborator Author

@malfet @kit1980 Can you please help review and merge please? Thanks!

@jithunnair-amd jithunnair-amd added the rocm priority high priority ROCm PRs from performance or other aspects label Aug 9, 2023
@jithunnair-amd

Copy link
Copy Markdown
Collaborator

@malfet @kit1980 This will provide a good bump in our UT parity efforts. Please review and merge.

@jithunnair-amd

Copy link
Copy Markdown
Collaborator

@pytorchbot merge -f "Unrelated CI failures"

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

jeffdaily added a commit to ROCm/pytorch that referenced this pull request Oct 2, 2026
On ROCm, test_api, test_jit and test_cpp_rpc fail `--help` with "libaotriton_v2.so.0.14.1: cannot open shared object file". test.sh symlinks libtorch* into torch/bin, so the test binary loads libtorch_hip.so through that symlink, glibc sets its $ORIGIN to torch/bin, and its own dependencies in torch/lib (AOTriton, and before that libcaffe2_nvrtc.so, which pytorch#106712 patched with one more symlink) are not found.

The symlinks were added in pytorch#62797 because the installed test binaries had no RUNPATH; pytorch#136627 gave them $ORIGIN/../lib, so they are no longer needed. This removes them for test_libtorch, the distributed C++ tests and test_rpc. test_aot_compilation and test_vulkan keep theirs: test_mobile_nnc, aot_model_compiler_test and the vulkan tests never got that RUNPATH.

Test Plan:

With the torch/bin and torch/lib from this PR's mi350 wheel and CI's LD_LIBRARY_PATH: with the symlinks, `test_api --help` exits 127 with the CI error; without them, test_api, test_jit, test_lazy, test_cpp_rpc and the c10d store and process-group tests start, pytest-cpp collects 1024 and 588 tests from test_api and test_jit, and FunctionalTest.Conv1d (the libcaffe2_nvrtc.so case) passes on gfx950:

```
torch/bin/test_api --gtest_filter='FunctionalTest.Conv1d*'
python -m pytest torch/bin/test_api --collect-only -q
```

This change was developed with the assistance of an AI assistant (Claude).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged module: rocm AMD GPU support for Pytorch open source rocm priority high priority ROCm PRs from performance or other aspects topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants