[PATCH] D25766: [ELF] - Implemented --section-ordering-file option.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 21 11:31:37 PDT 2016


On Fri, Oct 21, 2016 at 11:17 AM, Rui Ueyama <ruiu at google.com> wrote:

> Thank you for the update. It's interesting.
>
> I think clang is too small to use as a test for the feature. It can easily
> fit in in-memory cache, so the accesses to the file won't actually go to
> the disks. Even if it hits a disk, it's still probably too small. You want
> to test it with a latency-sensitive (i.e. user-facing) huge apps, such as
> Firefox or Chromium.
>
> Do you have an SSD to test this feature? I think we are interested in
> performance numbers on SSDs.
>

Correction. I talked about this with Sriraman offline. He said that a
mechanism to reorder sections is useful to reduce TLB misses because we
could layout hot functions close to each other. It doesn't have to be
--section-ordering-file, but it seems that we need some mechanism to
reorder sections even on all-SSD systems.


> On Fri, Oct 21, 2016 at 9:12 AM, George Rimar <grimar at accesssoftek.com>
> wrote:
>
>> grimar added a comment.
>>
>> Short update: I was able to use gcc to extract section ordering files.
>> For start I generated order list for clang launch without any arguments.
>> I used gcc from svn://gcc.gnu.org/svn/gcc/branches/google/gcc-4_9.
>> For doing these next steps were performed:
>>
>> 1. Build llvm with:
>>
>> -DCMAKE_BUILD_TYPE=Release -DLLVM_PARALLEL_COMPILE_JOBS=8
>> -DLLVM_ENABLE_THREADS=true -DCMAKE_CXX_FLAGS="-fPIC -std=c++11
>> -ffunction-sections -fdata-sections -fprofile-generate=/home/umb/LLVM/gcda"
>> -DCMAKE_C_FLAGS="-fPIC -ffunction-sections -fdata-sections
>> -fprofile-generate=/home/umb/LLVM/gcda" -DCMAKE_C_COMPILER=/home/umb/gcc49google/bin/gcc
>> -DCMAKE_CXX_COMPILER=/home/umb/gcc49google/bin/g++
>>
>> 2. Run binary in the way we are interested in. It was ./clang w/o
>> arguments in my case (.gcda files should be produced after that).
>>
>> 3. Now rebuild llvm with -fprofile-use and use of .gcda files we obtained
>> earlier. Use gold linker.
>>
>> -DCMAKE_BUILD_TYPE=Release -DLLVM_PARALLEL_COMPILE_JOBS=8
>> -DLLVM_ENABLE_THREADS=true -DCMAKE_CXX_FLAGS="-B/usr/local/bin -fPIC
>> -std=c++11 -ffunction-sections -fdata-sections
>> -fprofile-dir=/home/umb/LLVM/gcda -fprofile-use
>> -freorder-functions=callgraph -Wl,--plugin-opt,file=/home/umb/LLVM/order.txt"
>> -DCMAKE_C_FLAGS="-B/usr/local/bin -fPIC -ffunction-sections
>> -fdata-sections -fprofile-dir=/home/umb/LLVM/gcda -fprofile-use
>> -freorder-functions=callgraph -Wl,--plugin-opt,file=/home/umb/LLVM/order.txt"
>> -DCMAKE_C_COMPILER=/home/umb/gcc49google/bin/gcc
>> -DCMAKE_CXX_COMPILER=/home/umb/gcc49google/bin/g++
>>
>> 4. Remove order.txt and relink clang, that will create order.txt
>> containing sections order for its executable.
>>
>> I shared it here: https://drive.google.com/file/
>> d/0B_OWr6ld9gUmd1hnV1k4Z25NQVk/view?usp=sharing
>> It is 18 megabytes in size.
>>
>> Order list file contains next sections:
>> .text.unlikely.*
>> .text.exit.*
>> .text.startup.*
>> .text.hot.*
>>
>> BTW, both gold and ld recognize suzh sections by name and use names as
>> hint for sorting (no matter was order file used or not).
>> I did not check how it works, but that is what I saw in bfd/gold source
>> code.
>> Do we want to implement the same for compatibility ?
>>
>> Finally, now when I have such file I am going to write a tool or script
>> to prepare it to be used as linker input ordering file (looks it contains
>> excessive data, I'll check) and run some tests.
>> First one will be estimate clang launch time with sections ordered and
>> without. I am thinking about other possible ones, may be compile simple
>> helloworld ?
>>
>>
>> https://reviews.llvm.org/D25766
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161021/e0311f78/attachment-0001.html>


More information about the llvm-commits mailing list