cyy
f4dcf2ae93
[1/N] Change #include <c10/util/Optional.h> to #include <optional> ( #128301 )
...
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/128301
Approved by: https://github.com/ezyang , https://github.com/r-barnes
2024-07-08 07:03:53 +00:00
PyTorch MergeBot
846bb30e13
Revert "[1/N] Change #include <c10/util/Optional.h> to #include <optional> ( #128301 )"
...
This reverts commit bd72e28314 .
Reverted https://github.com/pytorch/pytorch/pull/128301 on behalf of https://github.com/huydhn due to Sorry for reverting your change but it fails XLA build bd72e28314 . Please rebase your PR before relanding because I think the failure is hidden by an unrelated broken trunk XLA failure from your current base commit ([comment](https://github.com/pytorch/pytorch/pull/128301#issuecomment-2169035822 ))
2024-06-15 01:58:20 +00:00
cyy
bd72e28314
[1/N] Change #include <c10/util/Optional.h> to #include <optional> ( #128301 )
...
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/128301
Approved by: https://github.com/ezyang
2024-06-14 23:21:01 +00:00
Richard Barnes
ed327876f5
[codemod] c10:optional -> std::optional ( #126135 )
...
Generated by running the following from PyTorch root:
```
find . -regex ".*\.\(cpp\|h\|cu\|hpp\|cc\|cxx\)$" | grep -v "build/" | xargs -n 50 -P 4 perl -pi -e 's/c10::optional/std::optional/'
```
`c10::optional` is just an alias for `std::optional`. This removes usages of that alias in preparation for eliminating it entirely.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/126135
Approved by: https://github.com/Skylion007 , https://github.com/malfet , https://github.com/albanD , https://github.com/aaronenyeshi
2024-05-14 19:35:51 +00:00
albanD
71467abc44
Changes to compile with 3.13 ( #126033 )
...
This is mainly:
- Fix refcount access macro
- Hide all the Dynamo code that needs update as usual
- Add _PyWeakref_ClearRef as an extern provided by CPython. Including the pycore header that defines it would require raw c include shenanigans that I don't think are worth it.
This allows to build both with regular and nogil version of cpython. Both
Note that this requires the 3.13 branch at least past [d3094744d40de2deefbda9b1996d5029c9ebf0b0](d3094744d4 ) which we need for mimalloc include and weakref function being exposed.
debug-only issues in pybind11 with PyMem_MALLOC vs PyObject_MALLOC being should be synced either by updating pybind or cpython. @colesbury I can send a PR to ifdef the proper use in pybind if you think that this is the best solution here?
Pull Request resolved: https://github.com/pytorch/pytorch/pull/126033
Approved by: https://github.com/colesbury
2024-05-14 02:14:57 +00:00
Ashwin Hari
5f5778476a
rename ort to maia ( #123265 )
...
Fixes #123264
Pull Request resolved: https://github.com/pytorch/pytorch/pull/123265
Approved by: https://github.com/albanD
2024-04-23 00:33:25 +00:00
Ashwin Hari
2d4197c9b7
add case for creating storage on ort ( #122446 )
...
Fixes #122445
Pull Request resolved: https://github.com/pytorch/pytorch/pull/122446
Approved by: https://github.com/mikaylagawarecki
2024-03-25 18:59:20 +00:00
Chen_Liqing
291ce86a6c
Modify StorageImplCreateHelper ( #118459 )
...
I want to use tensor.untyped_storage()[a:b] for ``PrivateUse1`` backend but fail. The code will go into ``THPStorage_get``:
bb6eba189f/torch/csrc/Storage.cpp (L525-L540)
Here ``torch`` will create a new ``c10::StorageImpl`` but not consider about ``PrivateUse1`` backend.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/118459
Approved by: https://github.com/albanD
2024-03-07 06:26:55 +00:00
feifan
29ae4f22bf
Enables private_use_one lazy_init by PrivateUse1HooksInterface ( #115067 )
...
Fixes https://github.com/pytorch/pytorch/issues/112369
In my last pr:https://github.com/pytorch/pytorch/pull/113343 , I want to implement lazy_init for other device through `REGISTER_LAZY_INIT `. But this might be too big of a change.
Recently, my team found that `torch.load` without `lazy_init ` will also results in the same error.
bbd5b935e4/torch/csrc/Storage.cpp (L319-L321)
bbd5b935e4/torch/csrc/Storage.cpp (L334-L335)
So, I want to use `PrivateUse1HooksInterface` to implement lazy_init for `PrivateUse1`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/115067
Approved by: https://github.com/ezyang
2024-01-09 20:12:08 +00:00
cyy
91bbcf8c71
[1/N] replace THPUtils_assert with TORCH_CHECK ( #116675 )
...
This PR replaces THPUtils_assert with TORCH_CHECK.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/116675
Approved by: https://github.com/albanD
2024-01-04 11:15:33 +00:00
cyy
d0ad848aa5
Enable misc clang-tidy checks ( #110283 )
...
This PR enables the misc-XX checks in clang-tidy. Meanwhile, I excluded some of them that require a lot of code changes and have no immediate benefits. Some additional fixes and suppression were also given.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/110283
Approved by: https://github.com/albanD
2023-09-30 10:39:52 +00:00
Kurt Mohler
4c5e43574c
Reland 2: Add PyObject preservation for UntypedStorage ( #109039 )
...
Relands #103907 after it was reverted. This PR makes the new `ignore_hermetic_tls` argument of `check_pyobj` optional to avoid causing a compilation error in torchdistx
Part of #91395
Pull Request resolved: https://github.com/pytorch/pytorch/pull/109039
Approved by: https://github.com/ezyang
2023-09-12 22:26:05 +00:00
PyTorch MergeBot
59f605be57
Revert "Reland 2: Add PyObject preservation for UntypedStorage ( #109039 )"
...
This reverts commit 419e4e17a2 .
Reverted https://github.com/pytorch/pytorch/pull/109039 on behalf of https://github.com/huydhn due to Sorry for reverting your change but it is failing linter job in trunk, probably due to a landrace ([comment](https://github.com/pytorch/pytorch/pull/109039#issuecomment-1715147020 ))
2023-09-12 07:26:11 +00:00
Kurt Mohler
419e4e17a2
Reland 2: Add PyObject preservation for UntypedStorage ( #109039 )
...
Relands #103907 after it was reverted. This PR makes the new `ignore_hermetic_tls` argument of `check_pyobj` optional to avoid causing a compilation error in torchdistx
Part of #91395
Pull Request resolved: https://github.com/pytorch/pytorch/pull/109039
Approved by: https://github.com/ezyang
2023-09-12 01:19:40 +00:00
cyy
f150f96255
[Reland] increase clang-tidy coverage in torch/csrc ( #108875 )
...
Reland PR #103058 since there was a time gap between this PR and other PRs in terms of torch/csrc modifications
Pull Request resolved: https://github.com/pytorch/pytorch/pull/108875
Approved by: https://github.com/Skylion007
2023-09-12 00:54:53 +00:00
PyTorch MergeBot
68238606f3
Revert "Reland: Add PyObject preservation for UntypedStorage ( #103907 )"
...
This reverts commit 56b848157c .
Reverted https://github.com/pytorch/pytorch/pull/103907 on behalf of https://github.com/huydhn due to Sorry for reverting your change, but it is failing torchdistx build which uses check_pyobj here 9c1b9f5cb2/src/python/torchdistx/_C/deferred_init.cc (L87) ([comment](https://github.com/pytorch/pytorch/pull/103907#issuecomment-1712121158 ))
2023-09-08 19:27:07 +00:00
PyTorch MergeBot
fa8bfe5ca2
Revert "increase clang-tidy coverage in torch/csrc ( #103058 )"
...
This reverts commit cdf7f3e780 .
Reverted https://github.com/pytorch/pytorch/pull/103058 on behalf of https://github.com/atalman due to Sorry for reverting your change, breaks lint ([comment](https://github.com/pytorch/pytorch/pull/103058#issuecomment-1711906915 ))
2023-09-08 16:07:41 +00:00
cyy
cdf7f3e780
increase clang-tidy coverage in torch/csrc ( #103058 )
...
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/103058
Approved by: https://github.com/Skylion007
2023-09-08 15:07:32 +00:00
Kurt Mohler
56b848157c
Reland: Add PyObject preservation for UntypedStorage ( #103907 )
...
This relands #97470 after #102553 reverted it. This PR attempts to fix the internal failure by avoiding an unnecessary intermediate storage buffer allocation in `c10::newStorageImplFromRefcountedDataPtr`.
Part of #91395
Pull Request resolved: https://github.com/pytorch/pytorch/pull/103907
Approved by: https://github.com/ezyang
2023-09-07 04:24:11 +00:00
cyy
a20fac89c8
[4/N] fix clang-tidy warnings in torch/csrc ( #108305 )
...
Fixes clang-tidy warnings in torch/csrc.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/108305
Approved by: https://github.com/Skylion007
2023-08-31 06:47:42 +00:00
Shiyan Deng
685505353a
Back out "Add PyObject preservation for UntypedStorage ( #97470 )" ( #102553 )
...
Summary:
Original commit changeset: c24708d18ccb
Original Phabricator Diff: D46159983
Test Plan: SL tests and CI
Differential Revision: D46284986
Pull Request resolved: https://github.com/pytorch/pytorch/pull/102553
Approved by: https://github.com/DanilBaibak
2023-06-01 17:23:43 +00:00
Kurt Mohler
5fe629e314
Add PyObject preservation for UntypedStorage ( #97470 )
...
Part of #91395
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97470
Approved by: https://github.com/ezyang
2023-05-23 01:27:30 +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
fakeYan
d4ce045cfc
[Add] storage support for custom backend. ( #98469 )
...
Currently storage only considers partial backend. We want storage to create on custom backend by key PrivateUse1.
@ezyang Could you review my changes?
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98469
Approved by: https://github.com/ezyang
2023-04-11 03:55:23 +00:00
mikey dagitses
c68a94c5ea
distinguish mutability of untyped Storage::data ( #97690 )
...
See D44409928.
Differential Revision: [D44429769](https://our.internmc.facebook.com/intern/diff/D44429769/ )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97690
Approved by: https://github.com/ezyang
2023-04-08 02:02:28 +00:00
mikey dagitses
49b80c3ea2
[reland] remove typed StorageImpl::data() and StorageImpl::unsafe_data() ( #98411 )
...
Original commit changeset: a466b3cb6a0a
Original Phabricator Diff: D44629941
Differential Revision: [D44709004](https://our.internmc.facebook.com/intern/diff/D44709004/ )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98411
Approved by: https://github.com/ezyang
2023-04-06 17:42:48 +00:00
Sujoy Saraswati
846415f6ea
Add HPU to the storage tensor backends ( #98404 )
...
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98404
Approved by: https://github.com/ezyang
2023-04-05 21:29:27 +00:00
PyTorch MergeBot
45edc58e4f
Revert "remove typed StorageImpl::data() and StorageImpl::unsafe_data() ( #98219 )"
...
This reverts commit 144d5268a1 .
Reverted https://github.com/pytorch/pytorch/pull/98219 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally
2023-04-05 09:08:08 +00:00
mikey dagitses
144d5268a1
remove typed StorageImpl::data() and StorageImpl::unsafe_data() ( #98219 )
...
Typed data will now only be a tensor level concept.
Differential Revision: [D44629941](https://our.internmc.facebook.com/intern/diff/D44629941/ )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98219
Approved by: https://github.com/ezyang
2023-04-05 03:32:02 +00:00
Kurt Mohler
ffddb2219a
Change THPStorage::cdata to be a MaybeOwned<Storage>, add unpack func ( #96801 )
...
Part of #91395
Pull Request resolved: https://github.com/pytorch/pytorch/pull/96801
Approved by: https://github.com/ezyang
2023-03-17 14:58:21 +00:00
albanD
8051f8a6ee
Fix Storage destruction GC tracking ( #94051 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94051
Approved by: https://github.com/Skylion007 , https://github.com/malfet
2023-02-03 21:28:02 +00:00
Kurt Mohler
f3266015a4
Add _StorageMeta metaclass for StorageBase ( #92648 )
...
Part of #91395
Pull Request resolved: https://github.com/pytorch/pytorch/pull/92648
Approved by: https://github.com/ezyang , https://github.com/albanD
2023-01-24 23:08:23 +00:00
albanD
28ceccec21
cleanup old python_compat code ( #91162 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91162
Approved by: https://github.com/ezyang
2022-12-20 18:13:19 +00:00
Lu, Chengjun
67aed39319
Support the XPU backend untyped storage ( #83952 )
...
Simple add XPU backend in untyped torch storage.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83952
Approved by: https://github.com/ezyang
2022-08-24 04:35:43 +00:00
Kurt Mohler
14d0296e5c
Rename _Typed/_UntypedStorage to Typed/UntypedStorage and update docs ( #82438 )
...
### Description
Since the major changes for `_TypedStorage` and `_UntypedStorage` are now complete, they can be renamed to be public.
`TypedStorage._untyped()` is renamed to `TypedStorage.untyped()`.
Documentation for storages is improved as well.
### Issue
Fixes #82436
### Testing
N/A
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82438
Approved by: https://github.com/ezyang
2022-07-30 19:37:08 +00:00
Kurt Mohler
863176a1c7
Remove torch/csrc/generic ( #82373 )
...
### Description
Remove `torch/csrc/generic` since it is no longer needed.
### Issue
#82372
### Testing
No tests added
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82373
Approved by: https://github.com/ezyang
2022-07-28 07:45:31 +00:00
Alban Desmaison
0a651a231d
Add full support for serialization of MPS Tensors ( #79465 )
...
Fix https://github.com/pytorch/pytorch/issues/79384
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79465
Approved by: https://github.com/kulinseth , https://github.com/malfet
2022-06-14 17:54:30 +00:00
PyTorch MergeBot
ce6ce74703
Revert "Add full support for serialization of MPS Tensors ( #79465 )"
...
This reverts commit 64c2a275c4 .
Reverted https://github.com/pytorch/pytorch/pull/79465 on behalf of https://github.com/zengk95 due to this broke X linux-xenial-py3.7-clang7-onnx / test (default, 1, 2, linux.2xlarge). Not sure why since it passed on pull.
2022-06-14 16:42:36 +00:00
Alban Desmaison
64c2a275c4
Add full support for serialization of MPS Tensors ( #79465 )
...
Fix https://github.com/pytorch/pytorch/issues/79384
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79465
Approved by: https://github.com/kulinseth , https://github.com/malfet
2022-06-14 14:20:09 +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
Michael Andreas Dagitses
606b234336
turn on -Werror=unused-function in our Bazel CPU build
...
Summary:
We also fix any existing issues. Note that we only do this for the CPU
build because nvcc is considered a C++ toolchain but it does not have
the same flag support. Adding flags to the GPU build will cause nvcc
errors.
Test Plan: Built locally, rely on CI to confirm.
Reviewers: malfet
Subscribers:
Tasks:
Tags:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79154
Approved by: https://github.com/seemethere , https://github.com/osalpekar , https://github.com/albanD
2022-06-10 22:11:54 +00:00
PyTorch MergeBot
bcd7a20953
Revert "turn on -Werror=unused-function in our Bazel CPU build"
...
This reverts commit 67d313a032 .
Reverted https://github.com/pytorch/pytorch/pull/79154 on behalf of https://github.com/malfet due to Breaks bazel build: 67d313a032
2022-06-10 20:43:03 +00:00
Michael Andreas Dagitses
67d313a032
turn on -Werror=unused-function in our Bazel CPU build
...
Summary:
We also fix any existing issues. Note that we only do this for the CPU
build because nvcc is considered a C++ toolchain but it does not have
the same flag support. Adding flags to the GPU build will cause nvcc
errors.
Test Plan: Built locally, rely on CI to confirm.
Reviewers: malfet
Subscribers:
Tasks:
Tags:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79154
Approved by: https://github.com/seemethere , https://github.com/osalpekar , https://github.com/albanD
2022-06-10 18:30:08 +00:00
Kurt Mohler
272193d026
Move THPStorage definitions out of torch/csrc/generic ( #78032 )
...
Fixes #77908
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78032
Approved by: https://github.com/ezyang
2022-06-01 19:00:58 +00:00
PyTorch MergeBot
821c711baf
Revert "Move THPStorage definitions out of torch/csrc/generic ( #78032 )"
...
This reverts commit f012152836 .
Reverted https://github.com/pytorch/pytorch/pull/78032 on behalf of https://github.com/suo due to This broke windows binary builds, see: f012152836
2022-05-24 16:37:35 +00:00
Kurt Mohler
f012152836
Move THPStorage definitions out of torch/csrc/generic ( #78032 )
...
Fixes #77908
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78032
Approved by: https://github.com/ezyang
2022-05-24 13:42:14 +00:00
Natalia Gimelshein
c9e898fef8
delete TH ( #69929 )
...
Summary:
Move TH<C>GenerateByteType includes into torch/csrc (the only place they are used), and we can remove TH folder altogether!
The only thing left in THC are includes left for bc compatibility.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/69929
Reviewed By: mruberry
Differential Revision: D33133013
Pulled By: ngimel
fbshipit-source-id: 78c87cf93d2d641631b0f71051ace318bf4ec3c1
2021-12-16 10:45:30 -08:00
Peter Bell
b08d64202a
Remove THGeneral ( #69041 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/69041
`TH_CONCAT_{N}` is still being used by THP so I've moved that into
it's own header but all the compiled code is gone.
Test Plan: Imported from OSS
Reviewed By: anjali411
Differential Revision: D32872477
Pulled By: ngimel
fbshipit-source-id: 06c82d8f96dbcee0715be407c61dfc7d7e8be47a
2021-12-13 16:14:28 -08:00
Kurt Mohler
d9e7d85390
Remove TH/THC Storage ( #68556 )
...
Summary:
Fixes https://github.com/pytorch/pytorch/issues/67852
cc ezyang bhosmer smessmer ljk53 bdhirsh
Pull Request resolved: https://github.com/pytorch/pytorch/pull/68556
Reviewed By: ejguan
Differential Revision: D32652758
Pulled By: ngimel
fbshipit-source-id: 170956fca112606f9008abe09b92c6ddc411be09
2021-11-29 12:55:20 -08:00
Kurt Mohler
4d99bc839b
Remove TH/THC Storage functions for unused dtypes ( #67480 )
...
Summary:
Fixes https://github.com/pytorch/pytorch/issues/67466
Pull Request resolved: https://github.com/pytorch/pytorch/pull/67480
Reviewed By: mruberry
Differential Revision: D32023494
Pulled By: ngimel
fbshipit-source-id: 8827e1d6e765fee7219b5ee9888a1a3e3c5fbe89
2021-11-01 11:45:20 -07:00