-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Documentation: Additional optimization levels for ARM/Linux #6548
Conversation
@jkotas , Could you review and merge this PR? |
\CC: @parjong , @watere , @lemmaa , @seanshpark , @myungjoo |
|To Disable Optimization| /Od | -O0 (debug build)| | ||
|To Minimize Size| /O1 | -Oz | | ||
|To Maximize Speed| /O2 | -Ofast | | ||
|To Support Full Optimization| /Ox | -O3 (release build) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "Full Optimization" mean? I would remove this.
O3 and Ofast are very much the same in Clang. Also, I believe that Ox is actually less optimization than O2 in Microsoft compilers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "Full Optimization" mean? I would remove this.
When I checked the Ox flag from MS Visual Studio 2015, I thought that the meaning of the "Full Optimization" means optimization considering both speed and size. At that time, I could not find the exact meaning at https://msdn.microsoft.com/en-us/library/k1ack8f1.aspx
I would remove this.
I made a mistake. At that time I did not change the configuration of VS2015 from Debug to Release. I will remove that.
O3 and Ofast are very much the same in Clang.
Also, I believe that Ox is actually less optimization than O2 in Microsoft compilers.
https://www.freebsd.org/cgi/man.cgi?query=clang
-Ofast: Enables all the optimizations from -O3 along with other aggressive optimizations that may violate strict compliance with language standards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http://stackoverflow.com/questions/15548023/clang-optimization-levels has good summary.
The extra optimizations in Ofast vs. O3 are mostly around floating point math that is pretty much non-existent in CoreCLR.
This instruction is to enable -Ofast or -Oz optimization level of clang on ARM/Linux. Below is file-size comparison result of major components among -O3, -Ofast, and -Oz on ARM/Linux-based Raspberry Pi2 board (Ubuntu/ARM 14.04 32bit). * Linux/ARM: Release Build + O3(default): stripped , commit: 561b64d (Jul-26-2016) ------------------------------------------------------------------------------------------------------------------ -rwxr-xr-x 1 leemgs leemgs 18,472 Jul 27 16:14 corerun -rwxr-xr-x 1 leemgs leemgs 1,512,828 Jul 27 18:33 libclrjit.so -rwxr-xr-x 1 leemgs leemgs 4,525,328 Jul 27 18:33 libcoreclr.so -rwxr--r-- 1 leemgs leemgs 29,696 Jul 27 00:55 ./mscorlib.dll -rwxr--r-- 1 leemgs leemgs 2,211,840 Jul 27 00:54 ./System.Private.CoreLib.dll Total: 8,298,164 bytes * Linux/ARM: Release Build + Ofast: stripped , commit: 561b64d (Jul-26-2016) ------------------------------------------------------------------------------------------------------------- -rwxr-xr-x 1 leemgs leemgs 18,496 Jul 26 05:00 ./corerun -rwxr-xr-x 1 leemgs leemgs 1,512,844 Jul 26 04:59 ./libclrjit.so -rwxr-xr-x 1 leemgs leemgs 4,525,360 Jul 26 04:59 ./libcoreclr.so -rwxr--r-- 1 leemgs leemgs 29,696 Jul 26 00:49 ./mscorlib.dll -rwxr--r-- 1 leemgs leemgs 2,211,840 Jul 26 00:48 ./System.Private.CoreLib.dll Total: 8,298,236 bytes * Linux/ARM: Release Build + Oz: stripped , commit: 561b64d (Jul-26-2016) --------------------------------------------------------------------------------------------------------- -rwxr-xr-x 1 leemgs leemgs 14,400 Jul 29 05:02 ./corerun -rwxr-xr-x 1 leemgs leemgs 1,181,160 Jul 29 04:40 ./libclrjit.so -rwxr-xr-x 1 leemgs leemgs 3,407,200 Jul 29 04:40 ./libcoreclr.so -rwxr--r-- 1 leemgs leemgs 29,696 Jul 29 00:49 ./mscorlib.dll -rwxr--r-- 1 leemgs leemgs 2,211,840 Jul 29 00:48 ./System.Private.CoreLib.dll Total: 6,844,296 bytes Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com>
6d867a7
to
f657d42
Compare
This instruction is to enable additional optimization levels such as -Oz and -Ofast on ARM/Linux. The below table shows what we have to enable for the code optimization of the CoreCLR run-time either the size or speed on embedded devices. | ||
|
||
| **Content** | **Build Mode** | **Clang/LLVM (Linux)** | | ||
| --- | --- | --- | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkotas I re-submitted new PR after applying your comments. Could you review this PR?
Thanks! |
…oreclr#6548) This instruction is to enable -Ofast or -Oz optimization level of clang on ARM/Linux. Below is file-size comparison result of major components among -O3, -Ofast, and -Oz on ARM/Linux-based Raspberry Pi2 board (Ubuntu/ARM 14.04 32bit). * Linux/ARM: Release Build + O3(default): stripped , commit: dotnet/coreclr@561b64d (Jul-26-2016) ------------------------------------------------------------------------------------------------------------------ -rwxr-xr-x 1 leemgs leemgs 18,472 Jul 27 16:14 corerun -rwxr-xr-x 1 leemgs leemgs 1,512,828 Jul 27 18:33 libclrjit.so -rwxr-xr-x 1 leemgs leemgs 4,525,328 Jul 27 18:33 libcoreclr.so -rwxr--r-- 1 leemgs leemgs 29,696 Jul 27 00:55 ./mscorlib.dll -rwxr--r-- 1 leemgs leemgs 2,211,840 Jul 27 00:54 ./System.Private.CoreLib.dll Total: 8,298,164 bytes * Linux/ARM: Release Build + Ofast: stripped , commit: dotnet/coreclr@561b64d (Jul-26-2016) ------------------------------------------------------------------------------------------------------------- -rwxr-xr-x 1 leemgs leemgs 18,496 Jul 26 05:00 ./corerun -rwxr-xr-x 1 leemgs leemgs 1,512,844 Jul 26 04:59 ./libclrjit.so -rwxr-xr-x 1 leemgs leemgs 4,525,360 Jul 26 04:59 ./libcoreclr.so -rwxr--r-- 1 leemgs leemgs 29,696 Jul 26 00:49 ./mscorlib.dll -rwxr--r-- 1 leemgs leemgs 2,211,840 Jul 26 00:48 ./System.Private.CoreLib.dll Total: 8,298,236 bytes * Linux/ARM: Release Build + Oz: stripped , commit: dotnet/coreclr@561b64d (Jul-26-2016) --------------------------------------------------------------------------------------------------------- -rwxr-xr-x 1 leemgs leemgs 14,400 Jul 29 05:02 ./corerun -rwxr-xr-x 1 leemgs leemgs 1,181,160 Jul 29 04:40 ./libclrjit.so -rwxr-xr-x 1 leemgs leemgs 3,407,200 Jul 29 04:40 ./libcoreclr.so -rwxr--r-- 1 leemgs leemgs 29,696 Jul 29 00:49 ./mscorlib.dll -rwxr--r-- 1 leemgs leemgs 2,211,840 Jul 29 00:48 ./System.Private.CoreLib.dll Total: 6,844,296 bytes Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com> Commit migrated from dotnet/coreclr@22c9f9e
This instruction is to enable -Oz or -Ofast optimization level of clang on ARM/Linux.
Below is file-size comparison result of major components among -O3, -Oz,
and -Ofast on ARM/Linux-based Raspberry Pi2 board (Ubuntu/ARM 14.04 32bit).
* Linux/ARM: Release Build + O3(default): stripped , commit: 561b64d (Jul-26-2016)
-rwxr-xr-x 1 leemgs leemgs 18,472 Jul 27 16:14 corerun
-rwxr-xr-x 1 leemgs leemgs 1,512,828 Jul 27 18:33 libclrjit.so
-rwxr-xr-x 1 leemgs leemgs 4,525,328 Jul 27 18:33 libcoreclr.so
-rwxr--r-- 1 leemgs leemgs 29,696 Jul 27 00:55 ./mscorlib.dll
-rwxr--r-- 1 leemgs leemgs 2,211,840 Jul 27 00:54 ./System.Private.CoreLib.dll
Total: 8,298,164 bytes
* Linux/ARM: Release Build + Ofast: stripped , commit: 561b64d (Jul-26-2016)
-rwxr-xr-x 1 leemgs leemgs 18,496 Jul 26 05:00 ./corerun
-rwxr-xr-x 1 leemgs leemgs 1,512,844 Jul 26 04:59 ./libclrjit.so
-rwxr-xr-x 1 leemgs leemgs 4,525,360 Jul 26 04:59 ./libcoreclr.so
-rwxr--r-- 1 leemgs leemgs 29,696 Jul 26 00:49 ./mscorlib.dll
-rwxr--r-- 1 leemgs leemgs 2,211,840 Jul 26 00:48 ./System.Private.CoreLib.dll
Total: 8,298,236 bytes
* Linux/ARM: Release Build + Oz: stripped , commit: 561b64d (Jul-26-2016)
-rwxr-xr-x 1 leemgs leemgs 14,400 Jul 29 05:02 ./corerun
-rwxr-xr-x 1 leemgs leemgs 1,181,160 Jul 29 04:40 ./libclrjit.so
-rwxr-xr-x 1 leemgs leemgs 3,407,200 Jul 29 04:40 ./libcoreclr.so
-rwxr--r-- 1 leemgs leemgs 29,696 Jul 29 00:49 ./mscorlib.dll
-rwxr--r-- 1 leemgs leemgs 2,211,840 Jul 29 00:48 ./System.Private.CoreLib.dll
Total: 6,844,296 bytes
Signed-off-by: Geunsik Lim geunsik.lim@samsung.com