Because Clang-tidy 19 has more powerful clang-analyzer checks to detect subtle bugs. New checks such as misc-use-internal-linkage can help identify potential static variables or functions, thus reducing binary sizes.
Some new checks are disabled temporarily for later enabling. Additional warnings have been fixed or suppressed.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/148648
Approved by: https://github.com/Skylion007
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