KEMBAR78
Export XPU libs to be public by guangyey · Pull Request #136974 · pytorch/pytorch · GitHub
Skip to content

Conversation

@guangyey
Copy link
Collaborator

@guangyey guangyey commented Sep 30, 2024

Stack from ghstack (oldest at bottom):

Motivation

Export XPU-related libs to be public. Now they are included in TORCH_LIBRARIES

@pytorch-bot
Copy link

pytorch-bot bot commented Sep 30, 2024

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit 20e71fd with merge base 5c3ba6f (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

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

@guangyey guangyey added topic: not user facing topic category ciflow/xpu Run XPU CI tasks labels Sep 30, 2024
if(@BUILD_SHARED_LIBS@)
find_library(C10_CUDA_LIBRARY c10_cuda PATHS "${TORCH_INSTALL_PREFIX}/lib")
list(APPEND TORCH_CUDA_LIBRARIES ${C10_CUDA_LIBRARY} ${Caffe2_PUBLIC_CUDA_DEPENDENCY_LIBS})
append_torchlib_if_found(c10_cuda torch_cuda)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Previously here miss libtorch_cuda.so

@guangyey guangyey requested a review from malfet September 30, 2024 03:15
guangyey added a commit that referenced this pull request Sep 30, 2024
ghstack-source-id: 53b0007
Pull Request resolved: #136974
find_library(C10_CUDA_LIBRARY c10_cuda PATHS "${TORCH_INSTALL_PREFIX}/lib")
list(APPEND TORCH_CUDA_LIBRARIES ${C10_CUDA_LIBRARY} ${Caffe2_PUBLIC_CUDA_DEPENDENCY_LIBS})
find_library(TORCH_CUDA_LIBRARY c10_cuda PATHS "${TORCH_INSTALL_PREFIX}/lib")
list(APPEND TORCH_CUDA_LIBRARIES ${C10_CUDA_LIBRARY} ${TORCH_CUDA_LIBRARY} ${Caffe2_PUBLIC_CUDA_DEPENDENCY_LIBS})
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To keep TORCH_CUDA_LIBRARIES BC, here doesn't directly use append_torchlib_if_found. Because append_torchlib_if_found doesn't update TORCH_CUDA_LIBRARIES.

Copy link
Contributor

Choose a reason for hiding this comment

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

This change seems unrelated to the PR title. Do you mind proposing it in separate PR (and posting some sort of examples of what behavior it fixes)

[ghstack-poisoned]
[ghstack-poisoned]
@guangyey
Copy link
Collaborator Author

guangyey commented Oct 2, 2024

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

[ghstack-poisoned]
@pytorchmergebot
Copy link
Collaborator

Successfully rebased gh/guangyey/70/orig onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via ghstack checkout https://github.com/pytorch/pytorch/pull/136974)

pytorchmergebot pushed a commit that referenced this pull request Oct 2, 2024
ghstack-source-id: ce7560b
Pull Request resolved: #136974
@albanD albanD removed their request for review October 2, 2024 15:22
@guangyey
Copy link
Collaborator Author

guangyey commented Oct 9, 2024

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

[ghstack-poisoned]
@pytorchmergebot
Copy link
Collaborator

Successfully rebased gh/guangyey/70/orig onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via ghstack checkout https://github.com/pytorch/pytorch/pull/136974)

pytorchmergebot pushed a commit that referenced this pull request Oct 9, 2024
ghstack-source-id: 9fcf121
Pull Request resolved: #136974
@guangyey
Copy link
Collaborator Author

@malfet @atalman May I know if you could help review this RP?
The CI failure is unrelated to this PR.

Copy link
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

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

Can you please help me understand why find_library(TORCH_CUDA_LIBRARY is needed?

@gujinghui
Copy link
Collaborator

Can you please help me understand why find_library(TORCH_CUDA_LIBRARY is needed?

@malfet Good catch! It should be a typo? @guangyey pls. fix it.

guangyey added a commit that referenced this pull request Oct 10, 2024
ghstack-source-id: 1ad886e
Pull Request resolved: #136974
@guangyey
Copy link
Collaborator Author

Can you please help me understand why find_library(TORCH_CUDA_LIBRARY is needed?

Sorry about that. Previously, libtorch_cuda.so was neither added to TORCH_CUDA_LIBRARIES nor exported in TORCH_LIBRARIES. find_library(TORCH_CUDA_LIBRARY intends to export libtorch_cuda.so to TORCH_LIBRARIES.
Why do we prefer find_library(TORCH_CUDA_LIBRARY instead of append_torchlib_if_found?
append_torchlib_if_found doesn't update TORCH_CUDA_LIBRARIES. And we expect libtorch_cuda.so to be added to TORCH_CUDA_LIBRARIES to facilitate user experience.
Is it reasonable to you?

@guangyey guangyey requested a review from malfet October 10, 2024 06:08
Copy link
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

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

XPU changes looks ok to me, please make changes to TORCH_CUDA_LIBRARIES in separate PR (and perhaps create an issue to explain what problem does it solve)

find_library(C10_CUDA_LIBRARY c10_cuda PATHS "${TORCH_INSTALL_PREFIX}/lib")
list(APPEND TORCH_CUDA_LIBRARIES ${C10_CUDA_LIBRARY} ${Caffe2_PUBLIC_CUDA_DEPENDENCY_LIBS})
find_library(TORCH_CUDA_LIBRARY c10_cuda PATHS "${TORCH_INSTALL_PREFIX}/lib")
list(APPEND TORCH_CUDA_LIBRARIES ${C10_CUDA_LIBRARY} ${TORCH_CUDA_LIBRARY} ${Caffe2_PUBLIC_CUDA_DEPENDENCY_LIBS})
Copy link
Contributor

Choose a reason for hiding this comment

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

This change seems unrelated to the PR title. Do you mind proposing it in separate PR (and posting some sort of examples of what behavior it fixes)

[ghstack-poisoned]
@guangyey
Copy link
Collaborator Author

XPU changes looks ok to me, please make changes to TORCH_CUDA_LIBRARIES in separate PR (and perhaps create an issue to explain what problem does it solve)

I would be happy to separate PR. I file an issue to explain the problem in #137694 and fix it in #137693.

@guangyey guangyey added the release notes: xpu release notes category label Oct 10, 2024
[ghstack-poisoned]
@guangyey
Copy link
Collaborator Author

@malfet May I know if I have addressed your comments?

@guangyey guangyey added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 15, 2024
[ghstack-poisoned]
Copy link
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

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

Looks good to me

@malfet
Copy link
Contributor

malfet commented Oct 16, 2024

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

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

@guangyey
Copy link
Collaborator Author

Looks good to me

Thanks very much for your approval.

@github-actions github-actions bot deleted the gh/guangyey/70/head branch November 16, 2024 02:07
Esquains pushed a commit to Esquains/study1 that referenced this pull request Dec 15, 2024
ghstack-source-id: a4a9966
Pull Request resolved: pytorch/pytorch#136974
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 ciflow/xpu Run XPU CI tasks Merged open source release notes: xpu release notes category topic: not user facing topic category

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants