pytorch
c2b9283d - [PyTorch Mobile] Use real if constexpr behind macro in hot template (copy D26154964 in a different setting) (#52420)

Commit
4 years ago
[PyTorch Mobile] Use real if constexpr behind macro in hot template (copy D26154964 in a different setting) (#52420) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/52420 Inspired by D26154964 (https://github.com/pytorch/pytorch/commit/6e1a5b1196aa0277a2113a4bca75b6e0f2b4c0c8), I'm basically going to just blindly copy the change that swolchok has made since it promises to reduce compile time, and who doesn't want faster compiles! I haven't actually checked if it has any impact on build time, but I have come to trust what swolchok does. In addition, swolchok observed a size reduction with the change, which I assume happens when the `constexpr` is true since the lambda is invoked and possibly needs to be compiled in. When tracing based selective build is enabled, many many many of these will be enabled, and this will use valuable size. This change is required to get the maximum bang for our buck. In addition, I'll look into making the lambda not capture all arguments by ref via the ref-capture `[&]` directive. I can probably have an entire half's worth of impact by copying Scott's changes and mirroring them in other parts of the PyTorch codebase lol. #accep2ship ghstack-source-id: 122178246 Test Plan: Build Reviewed By: iseeyuan Differential Revision: D26506634 fbshipit-source-id: b91d5e4773ade292fddce8dddd7e5ba1e5afeb29
Author
Parents
Loading