Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upOffer attributes for controlling loop optimizations #2219
Comments
This comment has been minimized.
This comment has been minimized.
|
Previous discussion: https://internals.rust-lang.org/t/loop-unrolling-on-request/3091 (pointed out in #rust-internals by lqd) |
This comment has been minimized.
This comment has been minimized.
|
In that discussion, the possibility of a (likely procedural) macro for unrolling specifically was brought up. That would be a rather blunt tool, as it wouldn't integrate with the optimizer. It would also not cover use cases for limiting in the optimizer (i.e., preventing unrolling that would normally occur). It also doesn't address knobs related to other optimization than loop unrolling. |
marshallpierce
referenced this issue
Nov 15, 2017
Open
Making a function generic (but not using the parameter at all) causes ~12% slowdown #46019
This comment has been minimized.
This comment has been minimized.
leonardo-m
commented
Nov 16, 2017
•
|
My proposal was meant to integrate with the optimizer. In that proposal
Regarding the knobs for other optimizations, my proposal doesn't prevent them. If you want later you can add other attributes:
And: |
Centril
added
T-compiler
T-lang
labels
Dec 6, 2017
This comment has been minimized.
This comment has been minimized.
BatmanAoD
commented
May 28, 2018
|
The I.e, something like,
So, for example:
|
This comment has been minimized.
This comment has been minimized.
BatmanAoD
commented
May 29, 2018
|
I believe this is potentially something for @rust-lang/wg-codegen to weigh in on? |
This comment has been minimized.
This comment has been minimized.
|
(small nit) In Rust we'd probably use |
This comment has been minimized.
This comment has been minimized.
BatmanAoD
commented
May 29, 2018
|
Personally, I think |
rkruppe commentedNov 15, 2017
For example, Clang has
#pragma loopwhich allow the programmer to guide loop unrolling, vectorization, and other optimizations. This is useful in high performance code because heuristics are often fallible and nudging the optimizer in the right direction can sometimes squeeze out some more performance (for a particular optimizer version, of course).In Rust, the natural replacement for a pragma would probably be an attribute.