cyy
1544c37520
[7/N] Fixes clang-tidy warnings in c10/{core,util}/*.h ( #115495 )
...
This PR continues to fix clang-tidy warnings for headers in c10/core and c10/util.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/115495
Approved by: https://github.com/malfet
2023-12-19 02:14:30 +00:00
Benson Ma
66a2600b6a
[T153220354] Fix header inclusions in c10 ( #1541 ) ( #101846 )
...
Summary:
This is a re-attempt to land the iwyu header changes, by taking the diff from [PR 100304](https://github.com/pytorch/pytorch/pull/100304 ), and adding the bare minimal changes to make the diff build corectly in the internal builds.
X-link: https://github.com/facebookresearch/pytorch3d/pull/1541
X-link: https://github.com/fairinternal/pytorch3d/pull/44
- Re-work D45769819 to fix header inclusions in c10
Test Plan:
```
buck2 build --no-remote-cache mode/dev-nosan //caffe2/c10/...
buck2 build --no-remote-cache mode/dev-nosan //deeplearning/fbgemm/fbgemm_gpu/...
buck2 build mode/dev-nosan //vision/fair/pytorch3d/pytorch3d:_C
```
Reviewed By: malfet
Differential Revision: D45920611
Pull Request resolved: https://github.com/pytorch/pytorch/pull/101846
Approved by: https://github.com/malfet , https://github.com/Skylion007
2023-05-20 19:35:14 +00:00
PyTorch MergeBot
4eaaa08623
Revert "Fix header inclusions in c10 by iwyu ( #100304 )"
...
This reverts commit 6037ee8cc9 .
Reverted https://github.com/pytorch/pytorch/pull/100304 on behalf of https://github.com/jeanschmidt due to Breaking meta internal builds and fbgemm builds ([comment](https://github.com/pytorch/pytorch/pull/100304#issuecomment-1543919257 ))
2023-05-11 12:37:35 +00:00
cyy
6037ee8cc9
Fix header inclusions in c10 by iwyu ( #100304 )
...
This work introduces include-what-you-use support for c10 by a CMake option defaulting to off. We also remove some unused header inclusions and fix a trivial inclusion error.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100304
Approved by: https://github.com/ezyang
2023-05-11 05:19:42 +00:00
PyTorch MergeBot
3271413e74
Revert "Fix header inclusions in c10 by iwyu ( #100304 )"
...
This reverts commit 39ec5fa722 .
Reverted https://github.com/pytorch/pytorch/pull/100304 on behalf of https://github.com/huydhn due to Sorry for reverting your PR, it is almost there but fails on Windows 39ec5fa722 , which is in unstable mode after https://github.com/pytorch/pytorch/pull/100548 ([comment](https://github.com/pytorch/pytorch/pull/100304#issuecomment-1542975714 ))
2023-05-11 00:37:32 +00:00
cyy
39ec5fa722
Fix header inclusions in c10 by iwyu ( #100304 )
...
This work introduces include-what-you-use support for c10 by a CMake option defaulting to off. We also remove some unused header inclusions and fix a trivial inclusion error.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100304
Approved by: https://github.com/ezyang
2023-05-10 15:42:43 +00:00
Aaron Gokaslan
18b37bbff9
Clang-Tidy: Improve tensorexpr headers with additional std::moves ( #91572 )
...
Splitting #91559 into smaller pieces
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91572
Approved by: https://github.com/ezyang
2023-01-05 09:57:54 +00:00
Aaron Gokaslan
48dc24ddce
Fix: [ATen] Add some missing moves ( #88514 )
...
Related to #88512 , but for ATen. This should reduce a number of copies and inefficient atomic smart pointer increments.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/88514
Approved by: https://github.com/jgong5 , https://github.com/ezyang
2022-11-13 22:05:41 +00:00
Edward Z. Yang
33f0e98a49
Re-land*4 "SymIntify cat and narrow" ( #86468 )
...
This re-lands https://github.com/pytorch/pytorch/pull/86289 but with more wrappers.
Contains implicit inclusion of <ATen/native/NonSymbolicBC.h> in internal usage.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86468
Approved by: https://github.com/albanD
2022-10-08 07:17:37 +00:00
PyTorch MergeBot
65b408074f
Revert "Relandx3 "SymIntify cat and narrow" ( #86289 )"
...
This reverts commit a00f8489df .
Reverted https://github.com/pytorch/pytorch/pull/86289 on behalf of https://github.com/malfet due to @seemether unlanded the rest of the stack and it will fail intern import anyway
2022-10-07 16:29:27 +00:00
Edward Z. Yang
a00f8489df
Relandx3 "SymIntify cat and narrow" ( #86289 )
...
This reverts commit fc94a2115b .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86289
Approved by: https://github.com/wconstab
2022-10-07 14:04:10 +00:00
PyTorch MergeBot
2110c89443
Revert "Revert "Revert "SymIntify cat and narrow ( #86191 )"" ( #86289 )"
...
This reverts commit e778fbf519 .
Reverted https://github.com/pytorch/pytorch/pull/86289 on behalf of https://github.com/seemethere due to Fails internal tests see: https://www.internalfb.com/intern/sandcastle/job/27021598552487548/
2022-10-07 05:20:36 +00:00
Edward Z. Yang
e778fbf519
Revert "Revert "SymIntify cat and narrow ( #86191 )"" ( #86289 )
...
This reverts commit fc94a2115b .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86289
Approved by: https://github.com/wconstab
2022-10-05 20:51:28 +00:00
PyTorch MergeBot
fc94a2115b
Revert "SymIntify cat and narrow ( #86191 )"
...
This reverts commit 63d8d4f6ec .
Reverted https://github.com/pytorch/pytorch/pull/86191 on behalf of https://github.com/seemethere due to Fails internal tests, see [D40106464](https://www.internalfb.com/diff/D40106464 )
2022-10-05 17:19:55 +00:00
Will Constable
63d8d4f6ec
SymIntify cat and narrow ( #86191 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86191
Approved by: https://github.com/ezyang
2022-10-05 14:46:55 +00:00
Peter Bell
e6842c0ed4
Optimize size(dim) and stride(dim)
...
This improves `c10::maybe_wrap_dim` to short-cut the "happy path"
where dim is in the correct range, and also moves the error and scalar
edge-cases out-of-line. These changes cut callgrind instruction counts
for `size(i)` from 5200 to 2000.
In the `size` and `stride` methods themselves, I also avoid calling
`TensorImpl::dim()` since it may be a virtual call. This further
reduced the instruction count from 2000 to 1500.
For comparison, `tensor.sizes()[0]` takes 1200 instructions so
`tensor.size(0)` is still marginally slower. This is unavoidable
though since it has to handle dimension wrapping.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75416
Approved by: https://github.com/Lezcano , https://github.com/ngimel
2022-04-09 02:58:46 +00:00
Scott Wolchok
44cc873fba
[PyTorch] Autoformat c10 ( #56830 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56830
Opt into formatting on GitHub and format everything. This is a trial run before turning on formatting for more and eventually all of the codebase.
Test Plan: CI
Reviewed By: zertosh
Differential Revision: D27979080
fbshipit-source-id: a80f0c48691c08ae8ca0af06377b87e6a2351151
2021-04-30 21:23:28 -07:00
Hong Xu
925cdd57dc
Replace all uses of AT_INDEX_ERROR with TORCH_CHECK_INDEX ( #35050 )
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/35050
Differential Revision: D20550978
Pulled By: ezyang
fbshipit-source-id: df7c0730f27d2986601b1dee17e41957be2956de
2020-03-24 09:10:51 -07:00
Stefan Krah
e4e9b738d3
Followup to #17049 : change more instances of RuntimeError to IndexError
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/17114
Differential Revision: D14150890
Pulled By: gchanan
fbshipit-source-id: 579ca71665166c6a904b894598a0b334f0d8acc7
2019-02-25 15:34:22 -08:00
Stefan Krah
a5e7b1d032
Use IndexError instead of RuntimeError in ATen CPU kernels
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/17049
Reviewed By: ezyang
Differential Revision: D14064700
Pulled By: fmassa
fbshipit-source-id: 3575db103bba5a7d82f574cbb082beca419151ec
2019-02-13 10:19:28 -08:00
Sebastian Messmer
279ec9ef7a
Move WrapDimMinimal to c10
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/14793
Reviewed By: ezyang
Differential Revision: D13336841
fbshipit-source-id: 4365a799e1856cc68dd94a273e97663fee5f51db
2018-12-10 15:10:01 -08:00