Skip to content

Conversation

@smessmer
Copy link
Contributor

Summary: Mostly making some stuff in ArrayRef constexpr to give it better perf.

Differential Revision: D8926785

@colesbury
Copy link
Member

In what sort of use cases did you see a performance improvement?

@smessmer
Copy link
Contributor Author

smessmer commented Jul 23, 2018

Sorry, I probably formulated that a bit misleadingly. It doesn't improve perf for existing use cases, but it allows ArrayRef to be used in constexpr environments in future (for example for c10).

Constexpr per se doesn't improve perf. Some expressions can be evaluated at compile time and some cannot. For expressions that can be evaluated at compile time, many compilers will do so, even if you don't add the "constexpr" keyword. What the "constexpr" keyword does is it asserts that the expression can be evaluated at compile time. So it makes sure that the stuff you want to be run at compile time actually can be done so. And it needs to be added to functions or methods if you want to call them from a constexpr environment (i.e. from another function or method that is constexpr).

Summary:
Pull Request resolved: pytorch#9610

Mostly making some stuff in ArrayRef constexpr to give it better perf.

Differential Revision: D8926785

fbshipit-source-id: 5403e86e4b1849718f24f0c79b6e70380b3eceaa
zdevito pushed a commit to zdevito/ATen that referenced this pull request Aug 1, 2018
Summary:
Pull Request resolved: pytorch/pytorch#9610

Mostly making some stuff in ArrayRef constexpr to give it better perf.

Reviewed By: ezyang

Differential Revision: D8926785

fbshipit-source-id: af6d4b05fbc69d20855a80f3edc2b501577a742b
goodlux pushed a commit to goodlux/pytorch that referenced this pull request Aug 15, 2018
Summary:
Pull Request resolved: pytorch#9610

Mostly making some stuff in ArrayRef constexpr to give it better perf.

Reviewed By: ezyang

Differential Revision: D8926785

fbshipit-source-id: af6d4b05fbc69d20855a80f3edc2b501577a742b
@ezyang ezyang added the merged label Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants