[LLVMdev] Profile Based Branch Weight Metadata

Alastair Murray alastairmurray42 at gmail.com
Thu Aug 9 12:32:16 PDT 2012


Hi Manman,

Thank you for looking at this.

Regarding the removal of ProfileInfo: Chandler Carruth sent a message to 
llvm-dev on July 15th with the subject "FYI: Planning to remove 
ProfileInfo and related passes from LLVM" [1], there were some replies 
of agreement.  The reasons for removing it were that it was largely 
unused, was not on by default, and was hindering a pass manager overhaul 
(I think that was mentioned in a separate thread).

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-July/051745.html

Regarding the existing loader: Yes, the existing loader can parse the 
profiling data and map it to the IR. I started this patch by 
copy-pasting that code, removing support for any non essential features 
(optimal edge profiling, path profiling, etc.) and then 
rewrote/cleaned-up everything.  This is what I meant by "based on".

So yes, if the existing ProfileInfoLoader was sticking around then the 
sensible approach would be to add setBranchWeightMetadata to that.

Regards,
Alastair.

On 10/08/12 02:53, Manman Ren wrote:
>
> Hi Alastair,
>
> Your patch looks great. I am new on this part of llvm. Why do we want to get rid of ProfileInfo? Is there any email thread related to this?
> I understand that we want to setBranchWeightMetadata from the profiling data generated by -insert-edge-profiling.
> I thought the existing loader can parse the profiling data and map the data to the IR, and only the setting of metadata is missing.
>
> Thanks,
> Manman
>
> On Aug 3, 2012, at 12:28 PM, Alastair Murray wrote:
>
>> Hi all,
>>
>> Attached is a draft patch to use profiling data to set branch weight metadata.
>>
>> I'm not formally submitting this as a patch yet as it does not make much sense to add it before ProfileInfo etc. is removed.  I am, however, interested in making sure this is the correct approach to be taking, or any other feedback.  (Also, there are a few TODO notes in there which would not be in the actual submission.)
>>
>> It works with profiling data produced by -insert-edge-profiling (but not -insert-optimal-edge-profiling).  The loading of the data, the mapping of the data to the IR and the setting of metadata are each handled separately so changes to the profiling insertion code is not an issue. For example: -insert-edge-profiling inserts counters that have no relation to branch probabilities.
>>
>> The patch was initially based on the ProfileInfoLoader code, though has been stripped down and rewritten quite significantly.  For review purposes it can be treated as new code.
>>
>> The key function is probably setBranchWeightMetadata(...) near the end of the patch.
>>
>> Regards,
>> Alastair.
>> <profile_branch_weight_metadata.patch>_______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>




More information about the llvm-dev mailing list