10 Commits

Author SHA1 Message Date
f231be25c6 Mark unused parameters in C++ code (#164912)
This PR adds unused parameter name comments in C++ declarations to improve code readability.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/164912
Approved by: https://github.com/Skylion007
2025-10-09 06:23:25 +00:00
cyy
7663ffb673 [10/N] Fixes clang-tidy warnings in c10/util/*.h (#116326)
Still a continued work for clean up c10/util/*.h
Pull Request resolved: https://github.com/pytorch/pytorch/pull/116326
Approved by: https://github.com/Skylion007
2023-12-23 04:59:55 +00:00
d7caef7996 [CI] Update clang-format (#116002)
To 17.0.6 build using https://github.com/pytorch/test-infra/blob/main/.github/workflows/clang-tidy-linux.yml

Pull Request resolved: https://github.com/pytorch/pytorch/pull/116002
Approved by: https://github.com/suo
2023-12-18 14:58:46 +00:00
cyy
f9bf104c64 [2/N] Fixes clang-tidy warnings in header files (#113727)
This PR fixes more clang-tidy warnings in common headers.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/113727
Approved by: https://github.com/Skylion007
2023-11-16 13:21:15 +00:00
01292cc9e4 [BE] Get rid of std::result_of in c10 (#85977)
As it is a deprecated and to be removed in C++20

Fixes https://github.com/pytorch/pytorch/issues/85962

Pull Request resolved: https://github.com/pytorch/pytorch/pull/85977
Approved by: https://github.com/kit1980
2022-09-30 23:13:42 +00:00
5455df2b99 [codemod][dirsync] Apply clang-format
Test Plan: Sandcastle and visual inspection.

Reviewed By: igorsugak

Differential Revision: D28477071

fbshipit-source-id: e844e0fad2f5599fd27e0fd113a328031cb63aa7
2021-05-20 21:23:24 -07:00
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
4add8502c3 inlining a function that i noticed were hot during previous benchmarking (#50848)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/50848

I noticed that the call overhead from `Tensor::device()` for ~1-2% of instruction counts depending on the microbenchmark

Some nice looking instruction count wins https://www.internalfb.com/intern/paste/P164529004/

Test Plan: Imported from OSS

Reviewed By: ezyang

Differential Revision: D25984136

Pulled By: bdhirsh

fbshipit-source-id: 0e54f2afe78caeb5a03abbb15e9197556acfeca1
2021-02-10 18:12:47 -08:00
93973ee699 Header cleanup (#48728)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/48728

Mostly removing unnecessary includes so that TensorIterator.h can be
included from NativeFunctions.h without causing cycles.  There some
cases where I moved code around so that I didn't have to pull in other
unnecessary stuff.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

Test Plan: Imported from OSS

Reviewed By: bhosmer

Differential Revision: D25278030

Pulled By: ezyang

fbshipit-source-id: 5f6b95a6bc734e452e9bd7bee8fe5278f5e45be2
2020-12-03 08:26:20 -08:00
81bbb7ebab Convert TensorIterator to use function_ref, a lightweight alternative to std::function. (#26592)
Summary:
function_ref is pulled over from LLVM.  It is to callables what StringRef is to strings.
This allows it to be substantially lighter weight, particularly in code size.  That comes
at the cost of not being usable in situations where the callable's lifetime is shorter
than the function_ref.  This means it is suitable for callback-like scenarios, but not
for situations where the callable needs to be stored.  In converting TensorIterator,
I only encountered one situation that required refactoring to comply with function_ref's
constraints.

In my local Release build, this reduces the size of libtorch by 4MB, from 70MB->66MB.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26592

Differential Revision: D17516202

fbshipit-source-id: 267476891f767f4827a4d38149f70e5035c56c48
2019-09-25 14:48:50 -07:00