Skip to content

Conversation

EikanWang
Copy link
Collaborator

@EikanWang EikanWang commented Oct 11, 2024

Stack from ghstack (oldest at bottom):

Intel GPU aten library(libtorch_xpu) utilizes torchgen to generate structure kernels. Currently, the generated structure kernels are decorated by TORCH_API to control the visibility, while TORCH_API is controlled by the CAFFE2_BUILD_MAIN_LIB macro. However, we cannot enable CAFFE2_BUILD_MAIN_LIB for the Intel GPU ATen library naively. Because the macro not only serves for the TORCH_API semantic. It means that the semantic of TORCH_API is symbol hidden.

https://github.com/pytorch/pytorch/blob/main/c10/macros/Export.h#L95-L99

Therefore, we need to use TORCH_XPU_API to decorate the produced structure kernels.

cc @voznesenskym @penguinwu @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire @chauhang

…nerated kernels are decorated by TORCH_API to control the visibility, while TORCH_API is controled by the CAFFE2_BUILD_MAIN_LIB macro. Intel GPU requires the generated structure kernels to be visible for linking. Therefore, we need to define CAFFE2_BUILD_MAIN_LIB macro to enable it.

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Oct 11, 2024

🔗 Helpful Links

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

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 9361b5a with merge base 41977a0 (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.

@pytorch-bot pytorch-bot bot added topic: not user facing topic category labels Oct 11, 2024
EikanWang added a commit that referenced this pull request Oct 11, 2024
…nerated kernels are decorated by TORCH_API to control the visibility, while TORCH_API is controled by the CAFFE2_BUILD_MAIN_LIB macro. Intel GPU requires the generated structure kernels to be visible for linking. Therefore, we need to define CAFFE2_BUILD_MAIN_LIB macro to enable it.

ghstack-source-id: ef0ca21
Pull Request resolved: #137794
@EikanWang EikanWang changed the title Intel GPU utilizes torchgen to generate structure kernels. And the generated kernels are decorated by TORCH_API to control the visibility, while TORCH_API is controled by the CAFFE2_BUILD_MAIN_LIB macro. Intel GPU requires the generated structure kernels to be visible for linking. Therefore, we need to define CAFFE2_BUILD_MAIN_LIB macro to enable it. [Intel GPU] Fix linking issue due to invisible structured kernel symbols Oct 11, 2024
@EikanWang EikanWang changed the title [Intel GPU] Fix linking issue due to invisible structured kernel symbols [Intel GPU] Fix linkage issue due to invisible structured kernel symbols Oct 11, 2024
@EikanWang EikanWang added the ciflow/xpu Run XPU CI tasks label Oct 11, 2024
@EikanWang EikanWang requested a review from atalman October 11, 2024 17:41
@EikanWang EikanWang changed the title [Intel GPU] Fix linkage issue due to invisible structured kernel symbols [Intel GPU] Fix Windows linkage issue due to invisible structured kernel symbols Oct 11, 2024
@EikanWang EikanWang removed the request for review from atalman October 11, 2024 18:27
@EikanWang EikanWang added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Oct 11, 2024
@EikanWang EikanWang marked this pull request as draft October 11, 2024 18:39
@EikanWang EikanWang changed the title [Intel GPU] Fix Windows linkage issue due to invisible structured kernel symbols [WIP][Intel GPU] Fix Windows linkage issue due to invisible structured kernel symbols Oct 11, 2024
…e structured kernel symbols"


Intel GPU aten library(libtorch_xpu) utilizes `torchgen` to generate structure kernels. And the generated structure kernels are decorated by `TORCH_API` to control the visibility, while `TORCH_API` is controlled by the `CAFFE2_BUILD_MAIN_LIB` macro. 

https://github.com/pytorch/pytorch/blob/main/c10/macros/Export.h#L95-L99

Intel GPU requires the generated structure kernels to be visible for linking. Therefore, we need to define` CAFFE2_BUILD_MAIN_LIB` macro to enable it.


[ghstack-poisoned]
…e structured kernel symbols"


Intel GPU aten library(libtorch_xpu) utilizes `torchgen` to generate structure kernels. And the generated structure kernels are decorated by `TORCH_API` to control the visibility, while `TORCH_API` is controlled by the `CAFFE2_BUILD_MAIN_LIB` macro. 

https://github.com/pytorch/pytorch/blob/main/c10/macros/Export.h#L95-L99

Intel GPU requires the generated structure kernels to be visible for linking. Therefore, we need to define` CAFFE2_BUILD_MAIN_LIB` macro to enable it.


[ghstack-poisoned]
…e structured kernel symbols"


Intel GPU aten library(libtorch_xpu) utilizes `torchgen` to generate structure kernels. Currently, the generated structure kernels are decorated by `TORCH_API` to control the visibility, while `TORCH_API` is controlled by the `CAFFE2_BUILD_MAIN_LIB` macro. However, we cannot enable `CAFFE2_BUILD_MAIN_LIB` for the Intel GPU ATen library naively. Because the macro not only serves for the `TORCH_API` semantic. It means that the semantic of `TORCH_API` is symbol `hidden`.

https://github.com/pytorch/pytorch/blob/main/c10/macros/Export.h#L95-L99

Therefore, we need to use ` TORCH_XPU_API` to decorate the produced structure kernels.


[ghstack-poisoned]
EikanWang added a commit that referenced this pull request Oct 12, 2024
…nerated kernels are decorated by TORCH_API to control the visibility, while TORCH_API is controled by the CAFFE2_BUILD_MAIN_LIB macro. Intel GPU requires the generated structure kernels to be visible for linking. Therefore, we need to define CAFFE2_BUILD_MAIN_LIB macro to enable it.

ghstack-source-id: c153216
Pull Request resolved: #137794
EikanWang added a commit that referenced this pull request Oct 12, 2024
…nerated kernels are decorated by TORCH_API to control the visibility, while TORCH_API is controled by the CAFFE2_BUILD_MAIN_LIB macro. Intel GPU requires the generated structure kernels to be visible for linking. Therefore, we need to define CAFFE2_BUILD_MAIN_LIB macro to enable it.

ghstack-source-id: 3628a5e
Pull Request resolved: #137794
…e structured kernel symbols"


Intel GPU aten library(libtorch_xpu) utilizes `torchgen` to generate structure kernels. Currently, the generated structure kernels are decorated by `TORCH_API` to control the visibility, while `TORCH_API` is controlled by the `CAFFE2_BUILD_MAIN_LIB` macro. However, we cannot enable `CAFFE2_BUILD_MAIN_LIB` for the Intel GPU ATen library naively. Because the macro not only serves for the `TORCH_API` semantic. It means that the semantic of `TORCH_API` is symbol `hidden`.

https://github.com/pytorch/pytorch/blob/main/c10/macros/Export.h#L95-L99

Therefore, we need to use ` TORCH_XPU_API` to decorate the produced structure kernels.


[ghstack-poisoned]
EikanWang added a commit that referenced this pull request Oct 12, 2024
…nerated kernels are decorated by TORCH_API to control the visibility, while TORCH_API is controled by the CAFFE2_BUILD_MAIN_LIB macro. Intel GPU requires the generated structure kernels to be visible for linking. Therefore, we need to define CAFFE2_BUILD_MAIN_LIB macro to enable it.

ghstack-source-id: 8714c7c
Pull Request resolved: #137794
@EikanWang EikanWang changed the title [WIP][Intel GPU] Fix Windows linkage issue due to invisible structured kernel symbols [Intel GPU] Fix Windows linkage issue due to invisible structured kernel symbols Oct 12, 2024
@EikanWang EikanWang requested review from atalman and malfet October 12, 2024 14:02
@EikanWang EikanWang marked this pull request as ready for review October 12, 2024 14:02
@EikanWang EikanWang requested a review from gujinghui as a code owner October 12, 2024 14:02
…uctured kernel symbols"


Intel GPU aten library(libtorch_xpu) utilizes `torchgen` to generate structure kernels. Currently, the generated structure kernels are decorated by `TORCH_API` to control the visibility, while `TORCH_API` is controlled by the `CAFFE2_BUILD_MAIN_LIB` macro. However, we cannot enable `CAFFE2_BUILD_MAIN_LIB` for the Intel GPU ATen library naively. Because the macro not only serves for the `TORCH_API` semantic. It means that the semantic of `TORCH_API` is symbol `hidden`.

https://github.com/pytorch/pytorch/blob/main/c10/macros/Export.h#L95-L99

Therefore, we need to use ` TORCH_XPU_API` to decorate the produced structure kernels.


[ghstack-poisoned]
EikanWang added a commit that referenced this pull request Oct 14, 2024
…nerated kernels are decorated by TORCH_API to control the visibility, while TORCH_API is controled by the CAFFE2_BUILD_MAIN_LIB macro. Intel GPU requires the generated structure kernels to be visible for linking. Therefore, we need to define CAFFE2_BUILD_MAIN_LIB macro to enable it.

ghstack-source-id: 8714c7c
Pull Request resolved: #137794
Comment on lines 359 to 360
# not implemented for 'Boolean'
"nn.functiona.unfold": {b8},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The latest torch-xpu-ops has supported boolean for unfolad. Therefore, we update this case for the sake of CI.

…uctured kernel symbols"


Intel GPU aten library(libtorch_xpu) utilizes `torchgen` to generate structure kernels. Currently, the generated structure kernels are decorated by `TORCH_API` to control the visibility, while `TORCH_API` is controlled by the `CAFFE2_BUILD_MAIN_LIB` macro. However, we cannot enable `CAFFE2_BUILD_MAIN_LIB` for the Intel GPU ATen library naively. Because the macro not only serves for the `TORCH_API` semantic. It means that the semantic of `TORCH_API` is symbol `hidden`.

https://github.com/pytorch/pytorch/blob/main/c10/macros/Export.h#L95-L99

Therefore, we need to use ` TORCH_XPU_API` to decorate the produced structure kernels.


cc voznesenskym penguinwu jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy yf225 chenyang78 kadeng muchulee8 ColinPeppler amjames desertfire chauhang

[ghstack-poisoned]
EikanWang added a commit that referenced this pull request Oct 14, 2024
…nerated kernels are decorated by TORCH_API to control the visibility, while TORCH_API is controled by the CAFFE2_BUILD_MAIN_LIB macro. Intel GPU requires the generated structure kernels to be visible for linking. Therefore, we need to define CAFFE2_BUILD_MAIN_LIB macro to enable it.

ghstack-source-id: de0471e
Pull Request resolved: #137794
Copy link
Contributor

@atalman atalman left a comment

Choose a reason for hiding this comment

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

lgtm

@EikanWang
Copy link
Collaborator Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 15, 2024
@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

jackzhxng pushed a commit that referenced this pull request Oct 16, 2024
…nel symbols (#137794)

Intel GPU aten library(libtorch_xpu) utilizes `torchgen` to generate structure kernels. Currently, the generated structure kernels are decorated by `TORCH_API` to control the visibility, while `TORCH_API` is controlled by the `CAFFE2_BUILD_MAIN_LIB` macro. However, we cannot enable `CAFFE2_BUILD_MAIN_LIB` for the Intel GPU ATen library naively. Because the macro not only serves for the `TORCH_API` semantic. It means that the semantic of `TORCH_API` is symbol `hidden`.

https://github.com/pytorch/pytorch/blob/main/c10/macros/Export.h#L95-L99

Therefore, we need to use ` TORCH_XPU_API` to decorate the produced structure kernels.

Pull Request resolved: #137794
Approved by: https://github.com/atalman
ghstack dependencies: #137873
@github-actions github-actions bot deleted the gh/EikanWang/74/head branch November 15, 2024 02:09
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 module: inductor open source topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants