Commit Graph

30 Commits

Author SHA1 Message Date
Edward Z. Yang
0af18f2234 Unify TEST_CUDNN definition (#105594)
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/105594
Approved by: https://github.com/larryliu0820, https://github.com/voznesenskym
2023-07-20 16:10:26 +00:00
PyTorch MergeBot
154d89b224 Revert "Unify TEST_CUDNN definition (#105594)"
This reverts commit 1ea153a11d.

Reverted https://github.com/pytorch/pytorch/pull/105594 on behalf of https://github.com/PaliC due to breaks periodic test `distributed/_tensor/test_dtensor.py::TestDynamoDTensor::test_dynamo_dtensor` ([comment](https://github.com/pytorch/pytorch/pull/105594#issuecomment-1644166414))
2023-07-20 15:48:25 +00:00
Edward Z. Yang
1ea153a11d Unify TEST_CUDNN definition (#105594)
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/105594
Approved by: https://github.com/larryliu0820, https://github.com/voznesenskym
2023-07-20 08:36:58 +00:00
Justin Chu
73e1455327 [BE] Enable ruff's UP rules and autoformat test/ (#105434)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/105434
Approved by: https://github.com/albanD
2023-07-19 20:36:06 +00:00
shibo19
7acc4a2e86 add generic func to get function defined in custom device module (#99048)
Fixes #ISSUE_NUMBER
Now for the custom device, we use `getattr` and `setattr` to run the func defined in custom device module in some files, such as `AMP`, `random`, `DDP` and so on. So I want to add a generic func to get these funcs more friendly, could you take a look? @bdhirsh @albanD

Pull Request resolved: https://github.com/pytorch/pytorch/pull/99048
Approved by: https://github.com/bdhirsh
2023-06-30 20:02:44 +00:00
shibo19
53919d4bf8 add named tensor support for custom device (#104401)
Fixes #ISSUE_NUMBER
1. for custom device(privateuse1 backend), we also want to support named tensors, so I optimize the check and add test.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/104401
Approved by: https://github.com/mikaylagawarecki
2023-06-30 19:40:12 +00:00
Bug Hunter Yan
b7777c812e extend serialization for tensor metadata (#99808)
Fixes #ISSUE_NUMBER
Add the serialization logic of backend metadata to the serialization of tensor, which is implemented through custom registration functions.

In #97429 , the structure backendMeta is provided in TensorImpl, and we think that this part of information may also need to be serialized for custom.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/99808
Approved by: https://github.com/ezyang, https://github.com/huydhn
2023-06-14 01:43:21 +00:00
shibo19
9d20b47e47 make device normalization more generic in faketensor (#102519)
Fixes #ISSUE_NUMBER
 make the device normalization more generic in faketensor to support devices like "cuda", "foo" and so on.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/102519
Approved by: https://github.com/albanD
2023-06-04 01:44:21 +00:00
shibo19
d9c8f9a00d add storage dtype for custom device (#102481)
Fixes #ISSUE_NUMBER
1、add `isinstance` check with dtyped storage for custom device
2、add `storage.type()` support for custom device
Pull Request resolved: https://github.com/pytorch/pytorch/pull/102481
Approved by: https://github.com/albanD
2023-06-01 12:46:19 +00:00
Bug Hunter Yan
c9f8f4cf2d Fix device normalization of automatically generate methods for custom backends. (#101796)
Fixes #ISSUE_NUMBER
Fix the problem of error handling when the device input parameter adopts string type, Align capabilities.

`foo_storage = torch.DoubleStorage(4).foo(device="foo:0, non_blocking=False")`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/101796
Approved by: https://github.com/bdhirsh
2023-05-22 19:02:16 +00:00
wbigat
4486a1d09a Improve the functionality of untyped storage for privateuse1. (#100868)
Complete the implementation of the interface  is_pinned() of untyped storage class for privateuse1.
And refactor the implementation in typed storage by   untyped_storage.is_pinned().

Hi,  @ezyang
This is another improvement of untyped storage for privateuse1, can you  take a moment to review it?  Thanks.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100868
Approved by: https://github.com/kurtamohler, https://github.com/ezyang
2023-05-19 04:33:59 +00:00
Bug Hunter Yan
0c470b17e3 Extend storage create for custom storageImpl (#100237)
Fixes #ISSUE_NUMBER

For the scenario where users inherit storageimpl to implement their own subclasses, the current storage creation method cannot correctly create storage objects.

Refer to the registration method of Allocator to expand the creation method of storageimpl, users can register their own custom storageimpl creation.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100237
Approved by: https://github.com/albanD
2023-05-17 04:30:13 +00:00
PyTorch MergeBot
1272cd73da Revert "extend serialization for tensor metadata (#99808)"
This reverts commit 4b9bc6f2a6.

Reverted https://github.com/pytorch/pytorch/pull/99808 on behalf of https://github.com/izaitsevfb due to Breaks internal builds: ld.lld: error: undefined symbol: torch::jit::GetBackendMetaSerialization() ([comment](https://github.com/pytorch/pytorch/pull/99808#issuecomment-1550071656))
2023-05-16 17:22:25 +00:00
fakeYan
4b9bc6f2a6 extend serialization for tensor metadata (#99808)
Fixes #ISSUE_NUMBER
Add the serialization logic of backend metadata to the serialization of tensor, which is implemented through custom registration functions.

In #97429 , the structure backendMeta is provided in TensorImpl, and we think that this part of information may also need to be serialized for custom.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/99808
Approved by: https://github.com/ezyang
2023-05-15 19:45:34 +00:00
zhi.cai
bf50180b4a enable dispatch stub for backend PrivateUse1 (#99611)
When expanding the new backend of pytorch in the form of out ot tree, Privateuse1 will be reused. So we also need to support PrivateUse1 in the dispatch stub module

Pull Request resolved: https://github.com/pytorch/pytorch/pull/99611
Approved by: https://github.com/ezyang
2023-05-12 04:02:12 +00:00
XDaoHong
a723f1f2b9 fix _privateuse1_tag problem (#100632)
Fix _privateuse1_tag bug in torch/serialization.py
Add device_index after device_type.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100632
Approved by: https://github.com/ezyang
2023-05-10 09:53:19 +00:00
PyTorch MergeBot
5c14eea1de Revert "extend serialization for tensor metadata (#99808)"
This reverts commit 73dd6f04c9.

Reverted https://github.com/pytorch/pytorch/pull/99808 on behalf of https://github.com/atalman due to breaking internal builds ([comment](https://github.com/pytorch/pytorch/pull/99808#issuecomment-1536823538))
2023-05-05 21:55:52 +00:00
Bug Hunter Yan
73dd6f04c9 extend serialization for tensor metadata (#99808)
Fixes #ISSUE_NUMBER
Add the serialization logic of backend metadata to the serialization of tensor, which is implemented through custom registration functions.

In #97429 , the structure backendMeta is provided in TensorImpl, and we think that this part of information may also need to be serialized for custom.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/99808
Approved by: https://github.com/ezyang
2023-05-04 20:32:11 +00:00
wbigat
b02aa5e71d [Feature] storage resize_ support custom device. (#99882)
Fixes #99326

Support storage resize_ for custom device, by calling dispatched tensor operations.

@ezyang  this pr is another case  that was brought up in issue #99326,  please take a moment to review this change.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/99882
Approved by: https://github.com/ezyang
2023-04-27 20:18:35 +00:00
Bug Hunter Yan
33fe2dbb23 Fix a minor bug about method generation. (#99704)
Fixes #ISSUE_NUMBER

when create a torch.device obj, like `x=torch.device("foo")`, the device index is None.

So in this scenario, we need to get the current device index again.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/99704
Approved by: https://github.com/albanD
2023-04-24 22:18:18 +00:00
wbigat
ee5f09ab80 [Feature] storage pin memory support custom device. (#99712)
Fixes #99326

Support storage pin_memory and is_pinned for custom device, by calling dispatched tensor operations.

@ezyang  this pr is what we have discussed in issue #99326, would you please take a moment to review it, thanks.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/99712
Approved by: https://github.com/ezyang
2023-04-21 18:31:01 +00:00
XDaoHong
27f8eb8c2b add storage serialization methods for privateuse1 (#98920)
add entry for privateuse1 storage serialization register_package in _register_device_module.
1. User only need to implement `privateuse1_tag` and `privateuse1_deserialize` in the device module of open device. When registering device module, the methods are registered with _package_registry in storage serialization.
2. Provides a fixed sequence number 30 for privateuse1 in storage serialization _package_registry list.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98920
Approved by: https://github.com/ezyang
2023-04-21 01:51:08 +00:00
Bug Hunter Yan
2b54d673fc Add custom backend case for storage and automatically generate storage attributes. (#98478)
Currently storage only considers partial backend. We want storage to create on custom backend by key PrivateUse1.
It also provides an easy automatic generation of storage-related attributes.
When the user registers a new backend, the corresponding methods and attributes can be automatically generated.
Do this code.
`torch.utils.rename_privateuse1_backend('foo')`
`torch.utils.generate_storage_for_privateuse1_backend()`
Then, get the following methods and attributes.
`torch.TypedStorage.is_foo`
`torch.TypedStorage.foo()`
`torch.UntypedStorage.is_foo`
`torch.UntypedStorage.foo()`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/98478
Approved by: https://github.com/albanD
2023-04-17 19:18:39 +00:00
fakeYan
668c578083 Automatically generate attributes and methods for custom backends. (#98066)
Fixes #ISSUE_NUMBER
#97593
A new extension mechanism has been added.
When the user registers a new backend, the corresponding methods and attributes can be automatically generated.
Do this code.
`torch.utils.rename_privateuse1_backend('foo')`
`torch.utils.generate_for_privateuse1_backend()`
Then, get the following methods and attributes.
`torch.Tensor.is_foo`
`torch.Tensor.foo()`
`torch.nn.Module.foo()`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/98066
Approved by: https://github.com/albanD
2023-04-13 22:04:05 +00:00
shibo
f25f85546f add rng_state support for custom device (#98069)
Fixes #ISSUE_NUMBER
Extend rng device related func,support custom device extensions,and default device is `cuda`.
@bdhirsh @kit1980 would you please take a moment to review my changes?
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98069
Approved by: https://github.com/bdhirsh
2023-04-10 22:36:55 +00:00
donnyyou
8a6e28ccd3 Fix typo for generator. (#97136)
Fix typo for generator.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/97136
Approved by: https://github.com/Skylion007, https://github.com/kit1980
2023-03-20 20:43:56 +00:00
dujinhang
1983b31711 Fixed print tensor.type() issue. (#96381)
Fixes #95954
Updating the cpp printing.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/96381
Approved by: https://github.com/albanD
2023-03-17 20:26:43 +00:00
shibo
7038458c5b Add Generator register for the privateuse1 backend (#93920)
Fixes #92202
Add generator regiter for the backend of `privateuseone`

module: backend
Pull Request resolved: https://github.com/pytorch/pytorch/pull/93920
Approved by: https://github.com/bdhirsh
2023-03-07 03:43:23 +00:00
albanD
2255911f8a Make M1 tests green (#82213)
This is skipping all the failing tests and add a new master job to test on M1

Pull Request resolved: https://github.com/pytorch/pytorch/pull/82213
Approved by: https://github.com/seemethere, https://github.com/soulitzer, https://github.com/malfet
2022-08-05 16:12:08 +00:00
Brian Hirsh
282de5539d add open device registration test with cpp extensions (#80477)
Adding a test for open device registration using cpp extensions.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80477
Approved by: https://github.com/albanD, https://github.com/malfet
2022-07-12 01:46:16 +00:00