[PATCH] D152081: [Attributor] Add lightweight version for attribute deduction only. (WIP)

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 7 16:26:24 PDT 2023


jdoerfert added a comment.

I have been on this the last two days, will need till the end of the week for patches and proper eval across CTMark.

Quick update, all relative to my favorite source file ((llvm-test-suite/MultiSource/Applications/SPASS/clause.c):
I modified the lightweight pass a little and disabled some features we don't need in the beginning via new switches.
The CGSCC pass is run instead the (full) FunctionAttrCGSCC pass for testing. 
If I run them both, the FunctionAttrCGSCC does not add any attributes (according to the stats). (my version of Attributor!)
I currently see the following overall time results (-O3):

  0.0116 (  1.5%)   0.0021 (  3.5%)   0.0137 (  1.6%)   0.0137 (  1.6%)  PostOrderFunctionAttrsPass

and

  0.0171 (  2.2%)   0.0037 (  5.2%)   0.0208 (  2.4%)   0.0209 (  2.4%)  LightweightAttributorCGSCCPass

I think the initial results I got were ~2x that. So, on this file, and at this moment, we would add ~0.8% compile time for better attribute deduction.
Here are the stats results:

  168 function-attrs               - Number of functions with improved memory attribute
    2 function-attrs               - Number of function returns marked noalias
  223 function-attrs               - Number of arguments marked nocapture
   52 function-attrs               - Number of functions marked as nofree
  160 function-attrs               - Number of functions marked as norecurse
  167 function-attrs               - Number of functions marked as nosync
   62 function-attrs               - Number of arguments marked readnone
  161 function-attrs               - Number of arguments marked readonly
   32 function-attrs               - Number of arguments marked returned
  145 function-attrs               - Number of functions marked as willreturn
   24 function-attrs               - Number of arguments marked writeonly

vs

  5081 attributor                   - Number of abstract attributes created
  1886 attributor                   - Number of abstract attributes manifested in IR
  2834 attributor                   - Number of abstract attributes in a valid fixpoint state
   301 attributor                   - Number of functions with exact definitions
     1 attributor                   - Number of functions without exact definitions
   223 attributor                   - Number of arguments marked 'nocapture'
   242 attributor                   - Number of arguments marked 'nofree'
    62 attributor                   - Number of arguments marked 'readnone'
   164 attributor                   - Number of arguments marked 'readonly'
    32 attributor                   - Number of arguments marked 'returned'
    31 attributor                   - Number of arguments marked 'writeonly'
    53 attributor                   - Number of call site arguments marked 'nocapture'
    99 attributor                   - Number of call site arguments marked 'nofree'
     4 attributor                   - Number of call site arguments marked 'readnone'
    36 attributor                   - Number of call site arguments marked 'readonly'
     1 attributor                   - Number of call site arguments marked 'writeonly'
    11 attributor                   - Number of call site marked 'willreturn'
   187 attributor                   - Number of function with known return values
   187 attributor                   - Number of function with unique return
     2 attributor                   - Number of function returns marked 'noalias'
   170 attributor                   - Number of functions marked 'nofree'
   300 attributor                   - Number of functions marked 'norecurse'
   167 attributor                   - Number of functions marked 'nosync'
    62 attributor                   - Number of functions marked 'readnone'
    56 attributor                   - Number of functions marked 'readonly'
   151 attributor                   - Number of functions marked 'willreturn'
    20 attributor                   - Number of functions marked 'writeonly'

Long story short, I think I can shave off a little more time and then we re-run proper testing.
We can also limit the deductions further, as you can see, it tracks, and annotates, way more than the existing pass.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152081/new/

https://reviews.llvm.org/D152081



More information about the llvm-commits mailing list