Nikolay Korovaiko
4aac42cc98
[LT] Add a new backend interface [DUP of the original] ( #81662 )
...
This is a dup of https://github.com/pytorch/pytorch/pull/76517 which is failing because Jiewen needs to resign the CLA.
Summary:
This commit introduces a new set of BackendImplInterface: GetDefaultDeviceOrdinal
and SetDefaultDeviceOrdinal. It allows backend to specify their own default
device, e.g, 1 for XLA and 0 for CUDA/CPU.
Test Plan:
./build/bin/test_lazy --gtest_filter=BackendDeviceTest.*
ghstack-source-id: b4adfef49253e51bffbbf40d356188a92c98994d
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76517
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81662
Approved by: https://github.com/JackCaoG , https://github.com/wconstab
2022-07-19 01:15:22 +00:00
Michael Suo
30fb2c4aba
[lint] autoformat test/cpp and torch/csrc
...
Let's have some fun.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78828
Approved by: https://github.com/ezyang
2022-06-11 21:11:16 +00:00
Jiewen Tan
a28b132bc2
Revert D35860266: [pytorch][PR] Update torch::lazy::BackendDevice to have a new default ordinal
...
Test Plan: revert-hammer
Differential Revision:
D35860266 (f9d07ae644 )
Original commit changeset: 554ebe16a068
Original Phabricator Diff: D35860266 (f9d07ae644 )
fbshipit-source-id: 325c54aa2e87e51134115213352b3d33a81b7edf
(cherry picked from commit bbd74bf34a534d1b87aadff9790038e3dbbfa9c8)
2022-04-27 18:11:24 +00:00
Wonjoo Lee
f9d07ae644
Update torch::lazy::BackendDevice to have a new default ordinal ( #76264 )
...
Summary:
Fixes https://github.com/pytorch/xla/issues/3490 . Updates `torch::lazy::BackendDevice` with changes below:
1. Remove the no-op string constructor.
2. Update default ordinal to `-1`.
3. Add a `is_valid` function to check if `ordinal` is valid/non-default (`ordinal >= 0`).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76264
Reviewed By: mrshenli
Differential Revision: D35860266
Pulled By: alanwaketan
fbshipit-source-id: 554ebe16a0683d37b00270c4f35163bf690bfe28
(cherry picked from commit b941d10e8545dfecfb34e4d5c24a29a1cc49bc4b)
2022-04-25 23:57:18 +00:00
Will Constable
3547f20872
Land remaining parts of Torchscript Lazy Tensor backend ( #74111 )
...
Summary:
Also enables bazel build to run lazy codegen. Bazel (oss) build feeds off the same filelists as cmake/buck (build_variables.bzl), so enabling it is easier than keeping it disabled.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74111
Test Plan: Run CI and verify test_lazy_ops is running via OSS cmake builds
Reviewed By: bdhirsh
Differential Revision: D34772403
fbshipit-source-id: 8a63f58b9536e6ac1be530667932176ef2549496
(cherry picked from commit e807ffb1918853d10b924fdc24f85ee5b1a39021)
2022-03-22 23:14:03 +00:00
Jiewen Tan
338eb1b2b3
[LTC] Export torch::lazy::GetBackendDevice() ( #70963 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70963
This commit exports torch::lazy::GetBackendDevice().
Test Plan: CI in the lazy_tensor_staging branch.
Reviewed By: wconstab
Differential Revision: D33468938
Pulled By: alanwaketan
fbshipit-source-id: f65599c9238bf6b4f4ffbd5194befdc267272831
2022-01-07 13:13:18 -08:00
Jiewen Tan
ab57f6d12c
[LTC] Upstream utils to extract BackendDevice from at::Tensor ( #70069 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70069
This commit upstreams utils to extract BackendDevice from at::Tensor.
Test Plan: ./build/bin/test_lazy --gtest_filter=BackendDeviceTest.GetBackendDevice*
Reviewed By: samdow
Differential Revision: D33293160
Pulled By: alanwaketan
fbshipit-source-id: 78647239f90b4d04adce84ae6022b8983ad30c09
2021-12-23 12:42:03 -08:00
Michael Suo
795af1578c
Revert D33172665: [LTC] Upstream utils to extract BackendDevice from at::Tensor
...
Test Plan: revert-hammer
Differential Revision:
D33172665 (121d067999 )
Original commit changeset: b334ee358ea7
Original Phabricator Diff: D33172665 (121d067999 )
fbshipit-source-id: 8bff43cddfc5d30483ec5cea8eff037aab9d1cfa
2021-12-22 21:12:49 -08:00
Jiewen Tan
121d067999
[LTC] Upstream utils to extract BackendDevice from at::Tensor ( #70069 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70069
This commit upstreams utils to extract BackendDevice from at::Tensor.
Test Plan: ./build/bin/test_lazy --gtest_filter=BackendDeviceTest.GetBackendDevice*
Reviewed By: wconstab
Differential Revision: D33172665
Pulled By: alanwaketan
fbshipit-source-id: b334ee358ea7b031bbffb0a16fa634715dba83f5
2021-12-22 18:15:45 -08:00
Jiewen Tan
e6c435bf96
[LTC] Upstream helpers for c10::Device <=> BackendDevice ( #69064 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/69064
This commit upstreams helpers for converting a c10::Device to
BackendDevice and vice versa.
Test Plan: ./build/bin/test_lazy --gtest_filter=BackendDeviceTest.FromAten:BackendDeviceTest.ToAten
Reviewed By: wconstab
Differential Revision: D32732607
Pulled By: alanwaketan
fbshipit-source-id: 0dd233d37a4a30fc4b22dba322ddd85d4cb3635b
2021-12-01 12:15:32 -08:00
Jiewen Tan
6011c35a79
[LTC] Upstream class BackendDevice ( #68027 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/68027
This commit upstreams class BackendDevice to the master, which is a backend
specific representation of the actual hardware, for instances, CPU, GPU, or
TPU.
This concept is important for backend like XLA where it needs to tell the
actual hardware type from the c10::DeviceType::Lazy virtual device during
both IR constructions and lowerings.
Test Plan: ./build/bin/test_lazy --gtest_filter=BackendDeviceTest.*
Reviewed By: wconstab
Differential Revision: D32261838
Pulled By: alanwaketan
fbshipit-source-id: 579c3fc5f9da7847c887a383c6047e8ecb9cc5bc
2021-11-10 07:05:43 -08:00