[PATCH][Review Requested][Compilation Time] Calculate hash value and equality comparison within SCEV node itself

Murali, Sriram sriram.murali at intel.com
Thu Feb 7 09:45:20 PST 2013


Hi Nick,

Using Vtune, our colleague Xiaofei, collected profile information for FoldingSet (see attached). It is observed that the hash calculation part is especially hot with benchmarks having many loops, increasing the overhead within SCEV.



The reason being, whenever FoldingSet is used as a hash map in different classes such as SCEV and Selection DAG, all the information is copied into FoldingSetNode, which is a clone of the original object.  The aim to solve this is to calculate the hash value based on SCEV itself, rather than using the hash function of FoldingSetNode. Even though this causes rewrite of the hash calculation, simple arithmetic operations such as XOR, AND can be used instead of the complicated hash algorithms in FoldingSetnode.



Thanks

Ram



-----Original Message-----
From: Nick Lewycky [mailto:nicholas at mxc.ca]
Sent: Wednesday, February 06, 2013 4:23 AM
To: Murali, Sriram
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [PATCH][Review Requested][Compilation Time] Calculate hash value and equality comparison within SCEV node itself



Murali, Sriram wrote:

> SCEV is currently implemented as a FoldingSetNode to calculate the

> hashing value and for equality comparison. This causes some

> performance loss. This patch aims at improving the compilation time

> performance by implementing the hashing and equality comparison within

> SCEV class instead of inheriting FoldingSetNode. The compilation

> performance gain for this particular refactoring is around 2%.



What is it about FoldingSet that causes a performance loss? It should not. I want to understand this. :)



Nick



> This patch is part of a series of compile time improvements. Although

> these were originally produced by our colleague Wan Xiaofei, our team

> consisting of tyler.nowicki at intel.com<mailto:tyler.nowicki at intel.com>

> <mailto:tyler.nowicki at intel.com>; preston.gurd at intel.com<mailto:preston.gurd at intel.com>

> <mailto:preston.gurd at intel.com>; and sriram.murali at intel.com<mailto:sriram.murali at intel.com>

> <mailto:sriram.murali at intel.com>, are assuming all responsibility for this work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130207/ad838e5f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FoldingSetImpl_profile.png
Type: image/png
Size: 44452 bytes
Desc: FoldingSetImpl_profile.png
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130207/ad838e5f/attachment.png>


More information about the llvm-commits mailing list