Skip to content

Add XLA support to moco benchmark.#2292

Closed
ysiraichi wants to merge 2 commits intopytorch:mainfrom
ysiraichi:moco-add-xla-support
Closed

Add XLA support to moco benchmark.#2292
ysiraichi wants to merge 2 commits intopytorch:mainfrom
ysiraichi:moco-add-xla-support

Conversation

@ysiraichi
Copy link
Copy Markdown
Contributor

This PR tweaks moco benchmark, so that it will also run on XLA devices. Previously, moco hardcoded the CUDA device in two ways:

  • Initializing the ProcessGroup with nccl backend, only
  • Moving intermediate tensors to cuda, explicitly

In order to add XLA support, this PR:

  • Also checks for xla* devices and, if detected, initializes the ProcessGroup with xla backend
  • Moves intermediate tensors to the appropriate devices

cc @lezcano

@ysiraichi
Copy link
Copy Markdown
Contributor Author

The CI failures don't seem related to this PR.
@xuzhao9 I think this PR is ready for review. Could you do it whenever you have some time?

Copy link
Copy Markdown
Contributor

@albanD albanD left a comment

Choose a reason for hiding this comment

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

Sounds good to me.

FYI @aaronenyeshi and @JackCaoG

Comment thread torchbenchmark/models/moco/__init__.py Outdated
)
except RuntimeError:
pass # already initialized?
elif device.startswith("xla"):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit for consistency device == "xla" ?

@ysiraichi ysiraichi force-pushed the moco-add-xla-support branch from 4c46871 to eb46de2 Compare June 19, 2024 13:47
@ysiraichi ysiraichi temporarily deployed to docker-s3-upload June 19, 2024 16:13 — with GitHub Actions Inactive
@ysiraichi ysiraichi temporarily deployed to docker-s3-upload June 19, 2024 16:13 — with GitHub Actions Inactive
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@xuzhao9 merged this pull request in 612b3c8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants