9fff8155c3
[2/N] Fix clang-tidy readability checks ( #164652 )
...
This PR applies clang-tidy readability checks to jit sources and all headers in the code base.
`readability-redundant-inline-specifier` is suppressed because it incurs too many changes. `readability-redundant-inline-specifier` is used to detect redundant inline specifiers on function and variable declarations. There are many in-class method definitions that are marked inline.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164652
Approved by: https://github.com/Skylion007
2025-10-06 01:06:01 +00:00
2c5ed6e7c0
Revert "[2/N] Fix clang-tidy readability checks ( #164652 )"
...
This reverts commit 3c5ca685d6f5b6f3971c0cd20a054aa355610419.
Reverted https://github.com/pytorch/pytorch/pull/164652 on behalf of https://github.com/izaitsevfb due to need to revert due to a conflict with revert of https://github.com/pytorch/pytorch/pull/162659 ([comment](https://github.com/pytorch/pytorch/pull/164652#issuecomment-3369346707 ))
2025-10-05 21:36:57 +00:00
3c5ca685d6
[2/N] Fix clang-tidy readability checks ( #164652 )
...
This PR applies clang-tidy readability checks to jit sources and all headers in the code base.
`readability-redundant-inline-specifier` is suppressed because it incurs too many changes. `readability-redundant-inline-specifier` is used to detect redundant inline specifiers on function and variable declarations. There are many in-class method definitions that are marked inline.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164652
Approved by: https://github.com/Skylion007
2025-10-05 07:05:11 +00:00
ad28565ed7
Use C++17 Convention Methods in PyTorch ( #137958 )
...
Detailed Descriptions:
- `std::is_same<X, Y>::value` -> `std::is_same_v<X, Y>`
- `std::enable_if<C, T>::type` -> `std::enable_if_t<C, T>`
- and so on
Pull Request resolved: https://github.com/pytorch/pytorch/pull/137958
Approved by: https://github.com/janeyx99
2024-10-18 00:52:51 +00:00
d46e0761ca
Revert "[11/N] Fix clang-tidy warnings in aten/src/ATen ( #133298 )"
...
This reverts commit 35785984013a74469de8c1d29eaecb25aa0c141e.
Reverted https://github.com/pytorch/pytorch/pull/133298 on behalf of https://github.com/izaitsevfb due to causes build time regression in aten/src/ATen/native/cpu/ReduceOpsKernel.cpp ([comment](https://github.com/pytorch/pytorch/pull/133298#issuecomment-2289453440 ))
2024-08-14 17:47:12 +00:00
3578598401
[11/N] Fix clang-tidy warnings in aten/src/ATen ( #133298 )
...
Follows #133155
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133298
Approved by: https://github.com/ezyang
2024-08-14 00:29:38 +00:00
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
1aad5c98b4
[structural binding][5/N] Replace std::tie with structural binding ( #120142 )
...
This PR follows https://github.com/pytorch/pytorch/pull/119774 , it is a continued work to clean up std::tie.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/120142
Approved by: https://github.com/albanD
2024-02-21 22:32:55 +00:00
8a09f1320c
Avoid COW materialize in index, reduce, compare, unique, and copy ops ( #119504 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/119504
Approved by: https://github.com/ezyang
ghstack dependencies: #119501 , #119502 , #119503
2024-02-09 14:47:19 +00:00
cbe0254dc4
Optimize sparse.mm reduce in BFloat16 data type in CPU backend ( #103239 )
...
### Description
This PR is to optimize sparse.mm reduce of BFloat16 data type in CPU backend, which is one task in https://github.com/pyg-team/pytorch_geometric/issues/7057 . Half support (need support addmm Half implementation) will be done once https://github.com/pytorch/pytorch/pull/99498 upstream.
Next step:
- [x] Add benchmarks
- [x] Update UTs
- [x] Check backward behaviors
- [x] Refactor code
### Performance test (Updated)
Test BFloat16 in Intel(R) Xeon(R) Platinum 8380 CPU @ 2.30GHz
With jemalloc and iomp
Single socket (40C)

Single core

Pull Request resolved: https://github.com/pytorch/pytorch/pull/103239
Approved by: https://github.com/mingfeima , https://github.com/albanD
2023-07-16 05:02:10 +00:00
053654b9cf
Optimize scatter_add/scatter_reduce in BFloat16/Half data type in CPU backend ( #103427 )
...
### Description
This PR is to optimize scatter_add/scatter_reduce of BFloat16/Half data type in CPU backend, which is one task in https://github.com/pyg-team/pytorch_geometric/issues/7057 . Main point is creating a buffer among threads to accumulate intermediate data as fp32 data type.
Next step:
- [x] Add benchmarks
- [x] Extend to Half
- [x] Simplify code
### Performance test (Updated)
Test BFloat16 in Intel(R) Xeon(R) Platinum 8380 CPU @ 2.30GHz
With jemalloc and iomp
Single socket (40C)

Single core

Pull Request resolved: https://github.com/pytorch/pytorch/pull/103427
Approved by: https://github.com/mingfeima , https://github.com/albanD
2023-07-13 09:34:29 +00:00
f8aedf1efe
Revert "Optimize scatter_add/scatter_reduce in BFloat16/Half data type in CPU backend ( #103427 )"
...
This reverts commit da7675621efce341c80187e404ac62cb6c22bbf8.
Reverted https://github.com/pytorch/pytorch/pull/103427 on behalf of https://github.com/clee2000 due to sorry but it looks like this pr broke test_scatter_gather_ops.py::TestScatterGatherCPU::test_scatter_expanded_index_cpu_bfloat16 on periodic parallelnative testing da7675621e
https://github.com/pytorch/pytorch/actions/runs/5477783108/jobs/9977608393 ([comment](https://github.com/pytorch/pytorch/pull/103427#issuecomment-1624008753 ))
2023-07-06 17:02:03 +00:00
da7675621e
Optimize scatter_add/scatter_reduce in BFloat16/Half data type in CPU backend ( #103427 )
...
### Description
This PR is to optimize scatter_add/scatter_reduce of BFloat16/Half data type in CPU backend, which is one task in https://github.com/pyg-team/pytorch_geometric/issues/7057 . Main point is creating a buffer among threads to accumulate intermediate data as fp32 data type.
Next step:
- [x] Add benchmarks
- [x] Extend to Half
- [x] Simplify code
### Performance test (Updated)
Test BFloat16 in Intel(R) Xeon(R) Platinum 8380 CPU @ 2.30GHz
With jemalloc and iomp
Single socket (40C)

Single core

Pull Request resolved: https://github.com/pytorch/pytorch/pull/103427
Approved by: https://github.com/mingfeima , https://github.com/albanD
2023-07-06 01:23:56 +00:00
f1b367c418
[BE] Nested namespace in ATen/native
headers ( #103753 )
...
Use nested namespace and `enum class` in `ATen/native` headers.
In particular, it helps avoid polluting global namespace with `MAX`,`MIN` enum values.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/103753
Approved by: https://github.com/atalman , https://github.com/Skylion007
2023-06-16 19:51:45 +00:00
dd7d47c4ac
abstract vectorized reduction utils on CPU ( #92284 )
...
This PR abstracts some reduction utils on CPU, which can be shared by multiple reduction operators, such as `scatter_reduce`, `segment_reduce`, `spmm_reduce`.
No functional change or performance change.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/92284
Approved by: https://github.com/ezyang
2023-02-03 04:59:24 +00:00