[PATCH] blockfreq: Rewrite block frequency analysis

Andrew Trick atrick at apple.com
Thu Apr 3 14:11:30 PDT 2014


On Mar 26, 2014, at 5:43 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:

> 
> On Mar 25, 2014, at 7:23 PM, Chandler Carruth <chandlerc at google.com> wrote:
> 
>> 
>> Ok. I think having the terminology clarified will also help me understand the code.
>> 
>> 
>> The only thing that I think really needs to be sorted out (other than the stuff you've clarified you're planning to do already) prior to commit is the positive float issue. I'm just a bit hesitant to put that into Support only to rip it back out. ;] But maybe that doesn't matter too much.
> 
> FYI, I committed the preparatory patches recently: r204740 and r204741.
> 
> Here’s a new plan for the remainder that minimizes churn in Support:
> 
> 1. Move BlockMass and PositiveFloat into private headers.  Strip their
>    tests from the patch, but hang onto them out of tree.
> 
> 2. Commit everything as a new class that’s unused.
> 
> 3. Move non-trivial things I need from BlockMass and PositiveFloat into
>    Support (sharing implementation details with APFloat, where possible). 
>    I’ll commit tests for the functionality I need.
> 
> 4. Switch from soft-float to power-of-two-except-3 loop-scale.  (Delete
>    PositiveFloat at this point.)
> 
> 5. Switch to LoopInfo.
> 
> 6. Respond to the rest of the review comments incrementally.
> 
> 7. Turn it on.
> 
> 8. Kill the old one.
> 
> Sound good?

It would be great to get a working design committed and begin making the improvements we discussed. However, I don’t think you need to keep the existing implementation alive as you replace pieces. There’s isn’t any need here to preserve old broken behavior. Ideally the first commit will be usable and easy to review even if it’s not efficient or missing features.

1. Move to using existing LoopInfo to rule out that as a source of problems.

2. Move BlockMass and PositiveFloat out of support (make them temporary helpers)

3. Commit and enable.

4. Factor Float/Mass utilities into Support

5. Switch to pow2 loop scale

6. Reimplement Positive float as a very simple BlockFrequency-specific wrapper that implements loop scale computation and frequency scaling in terms of integer operations (you seem to have come up with a way to do this that won’t lead to madness).

One more thing. Chandler requested definitions of the terminology, which would be good to do before your first commit.

-Andy



More information about the llvm-commits mailing list