[LLVMdev] Analysis of polly-detect overhead in oggenc
tobias at grosser.es
Tue Jul 23 20:42:58 PDT 2013
On 07/23/2013 10:13 AM, James Courtier-Dutton wrote:
> On 23 July 2013 16:50, Tobias Grosser <tobias at grosser.es> wrote:
>> On 07/22/2013 11:58 PM, Star Tan wrote:
>>> Hi Tobias,
>>> I have attached a patch file to optimize string operations in
>>> Polly-Detect pass.
>>> In this patch file, I put most of long string operations in the condition
>>> variable of "PollyViewMode" or in the DEBUG mode.
> Is there any way to make the debug messages themselves more efficient?
Yes, there are two ways:
1) Use the getName() function instead of the ostream writer
This is significantly faster than what we have today, but does not
format unnamed instructions correctly (It does not create the %123
instruction namings). Even though this is fast, it is probably still
slower than not doing any formatting at all.
2) Fix the AssemblyWriter as decribed by Daniel Berlin
There seems to be a larger issue in the printing infrastructure. It does
not seem to be written to print values many times.
> Perhaps reimplementing it so that any table lookups are quick and no
> malloc/free is done in the process.
"The real fix is either to stop recreating these AssemblyWriter
objects, or improve caching in the bowels of it so that it doesn't
need to rerun typefinder again and again if nothing has changed."
So there is something that needs to be fixed when using the ostream
formatter as we do. However, I do not think we should do this in this
patch. Doing any kind of debug message formatting in the normal pass is
unnecessary overhead that we should not have at all. The change Star
proposes, moves this overhead out of the hot path, such that for debug
messages we can now prioritize understandable formatting over performance.
More information about the llvm-dev