[Question] Is GCC -freorder-blocks-and-partition going to be handled?
Hi,
Do you plan to handle the GCC -freorder-blocks-and-partition flag in the future?
As this flag needs to be apply at compilation time, it's matter in a daily development.
We are currently using this flag on our libraries, and the need to disable it for BOLT means either deliver two version of these, either slow down every applications not using BOLT It's a big drawback of using BOLT at the moment.
If you plan to, do you have an estimated time for it?
Thanks you, Pierre
We do plan to support it, however there's no timeline at the moment. Are you using this option with any form of compiler PGO? If it's used without PGO, do you see measurable gains?
We don't use compiler PGO at the moment. But we might add some it in the future, which is why we needed that information. Without PGO, this flag seems to give us a small speed improvement, but too small to give accurate numbers on the program we bench-marked.
Do you know what differences on the final binary implies this flag? Is it a big change on BOLT to handle it?
It will split some functions into hot and cold code. BOLT will do what -freorder-blocks-and-partition does, but better. The only reason we plan to support it is to avoid the recompilation issue.
does BOLT can use compiler hint like __builtin_expect to split hot/cold code? because this is better than perf collected method sometimes
Hi, Do you plan to handle the GCC
-freorder-blocks-and-partitionflag in the future? As this flag needs to be apply at compilation time, it's matter in a daily development.We are currently using this flag on our libraries, and the need to disable it for BOLT means either deliver two version of these, either slow down every applications not using BOLT It's a big drawback of using BOLT at the moment.
If you plan to, do you have an estimated time for it?
Thanks you, Pierre
how you use this option to partition hot/cold code ? any example hopes.
I can't found any example by google
thanks:)
-split-functions=1 will do the partitioning based on the profile. Do you have an example where __builtin_expect does a better job?
-split-functions=1will do the partitioning based on the profile. Do you have an example where__builtin_expectdoes a better job?
#include <stdio.h>
int a = 200;
int calA(int x, int y)
{
if(__builtin_expect(!!(x > 200), 0)) {
a+=x;
printf("a");
} else {
a+=y;
}
return a;
}
int b = 300;
int calB(int h, int j) {
if(__builtin_expect(!!(h > 100), 0)) {
b += h;
printf("b");
} else {
b +=j;
}
return b;
}
//extern int calA(int a, int b);
//#extern int calB(int a, int b);
int main(int argc, char **argv)
{
int x = argv[0][0];
int y = argv[0][1];
return calA(x, y) + calB(x, y);
}
If I understand correctly, there are cases not covered by profile that you want to preserve? Because in the example above there will be no samples recorded due to a short execution time. If that's the case, then without a profile BOLT should preserve the original order and the layout.