-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Enable support for Intel XPU devices (AKA Intel GPUs) #19443
Draft
coreyjadams
wants to merge
40
commits into
Lightning-AI:master
Choose a base branch
from
argonne-lcf:master
base: master
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.
+346
−24
Conversation
This file contains 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
…ed a bit, mpi environment seems to be broken
…broadcasting strings isn't working. This commit includes a workaround for that case.
Syncronize xpu devices
Add xpu warning
Include XPU in on-gpu check.
Include XPU in map location
coreyjadams
requested review from
awaelchli,
carmocca,
justusschock,
tchaton and
williamFalcon
as code owners
February 9, 2024 22:32
github-actions
bot
added
fabric
lightning.fabric.Fabric
pl
Generic label for PyTorch Lightning package
data (external)
litdata package
labels
Feb 9, 2024
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…rride decorator in line with other accelerators.
for more information, see https://pre-commit.ci
Hi @coreyjadams , there is a long standing PR for XPU support from us - #17700 which we are planning to integrate soon. We are already in discussions regarding this and would appreciate using the branch for the time being until this gets merged. Please also feel free to set up an offline discussion with us ( I work with Venkat /Sam and others regarding LLMs from Intel) |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
data (external)
litdata package
fabric
lightning.fabric.Fabric
pl
Generic label for PyTorch Lightning package
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.
What does this PR do?
This PR extends pytorch_lighting with support for Intel GPUs, as enabled with
intel_extension_for_pytorch
. With Intel's module, pytorch gains thetorch.xpu
module which is equivalent totorch.cuda
.Throughout the pytorch_lightning repository, in places where
cuda
is explicitly mentioned I tried to include equivalent functionality forxpu
. In some cases, I declined to extend support toxpu
where I was not sure it would work / be worth it: for example, there isBitsAndBytes
which I know very little about, and I decided not to addxpu
. The main enablements areXPUAccelerator
and including logic to managexpu
s in pytorch DDP.In the distributed case, instead of
nccl
Intel provides theccl
backend for collective communications. There is a known bug that I encountered when testing, if one calls torch.distributed.broadcast with a list of strings it will induce a hang. I currently wrapped that call with an explicit check against this which isn't ideal, but it does enable DDP in XPUs.Both
xpu
andccl
are currently extensions to pytorch and must be loaded dynamically.torch.xpu
is available withimport intel_extension_for_pytorch
and theccl
backend totorch.distributed
becomes available when one doesimport oneccl_bindings_for_pytorch
. Because of this, I have in many cases done one of these:xpu
is initialized, I use it freely.torch.distributed.initialize
, since the target backend is available, I intercept and ensure the oneccl bindings are loaded.torch.xpu
and can't be sure its available, I have included logic analogous to cuda: instead ofif torch.cuda.is_available(): ...
I doif hasattr(torch, "xpu") and torch.xpu.is_available(): ...
This PR was not intended to introduce any breaking changes.
I think this PR needs some discussion before we even ask "should it be merged":
📚 Documentation preview 📚: https://pytorch-lightning--19443.org.readthedocs.build/en/19443/