Skip to content

Support lazy initialization for empty_xpu#1115

Merged
guangyey merged 1 commit into
mainfrom
guangyey/empty_xpu
Nov 25, 2024
Merged

Support lazy initialization for empty_xpu#1115
guangyey merged 1 commit into
mainfrom
guangyey/empty_xpu

Conversation

@guangyey

@guangyey guangyey commented Nov 22, 2024

Copy link
Copy Markdown
Contributor

Motivation

Fix pytorch/pytorch#140877
Some PyTorch C++ users could call empty op directly. In this situation, lazy initialization would not have been triggered. So we have to add lazyInitDevice here, which also aligns with CUDA convention.

@guangyey

Copy link
Copy Markdown
Contributor Author

XPU build pass and lint is green. Unrelated failures.

@guangyey guangyey added this pull request to the merge queue Nov 25, 2024
Merged via the queue into main with commit 3af6f73 Nov 25, 2024
@guangyey guangyey deleted the guangyey/empty_xpu branch November 25, 2024 01:35
@guangyey guangyey added the bug Something isn't working label Nov 25, 2024
ZhiweiYan-96 pushed a commit that referenced this pull request Dec 2, 2024
# Motivation
Fix pytorch/pytorch#140877
Some PyTorch C++ users could call empty op directly. In this situation,
lazy initialization would not have been triggered. So we have to add
`lazyInitDevice` here, which also aligns with CUDA
[convention](https://github.com/pytorch/pytorch/blob/150ffb6e07f3802f8d0d3e843486e77a872803cf/aten/src/ATen/cuda/EmptyTensor.cpp#L13).
ZhiweiYan-96 pushed a commit that referenced this pull request Dec 3, 2024
# Motivation
Fix pytorch/pytorch#140877
Some PyTorch C++ users could call empty op directly. In this situation,
lazy initialization would not have been triggered. So we have to add
`lazyInitDevice` here, which also aligns with CUDA
[convention](https://github.com/pytorch/pytorch/blob/150ffb6e07f3802f8d0d3e843486e77a872803cf/aten/src/ATen/cuda/EmptyTensor.cpp#L13).
toyxu added a commit that referenced this pull request Dec 3, 2024
#### Bugfix

- [add lazy init for
empty_xpu](#1115)
- [nan propagation for
soft_shrink](https://github.com/intel/torch-xpu-ops/pull/1116/files#diff-b7cb5876d000db957286c8b0e72badb2b7502402c8955334f1cc21c34c98a5b9)

---------

Co-authored-by: Yu, Guangye <106960996+guangyey@users.noreply.github.com>
Co-authored-by: ZhiweiYan-96 <zhiwei.yan@intel.com>
ZhiweiYan-96 pushed a commit that referenced this pull request Jan 16, 2025
# Motivation
Fix pytorch/pytorch#140877
Some PyTorch C++ users could call empty op directly. In this situation,
lazy initialization would not have been triggered. So we have to add
`lazyInitDevice` here, which also aligns with CUDA
[convention](https://github.com/pytorch/pytorch/blob/150ffb6e07f3802f8d0d3e843486e77a872803cf/aten/src/ATen/cuda/EmptyTensor.cpp#L13).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[XPU] Failed to build libtorch program with XPUs

2 participants