home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / hp / 14633 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  12.3 KB

  1. From: dr@hpcuhe.cup.hp.com (Dick Rupp)
  2. Date: Thu, 7 Jan 1993 00:33:14 GMT
  3. Subject: Opinions Wanted on Optimizer Options
  4. Message-ID: <31480304@hpcuhe.cup.hp.com>
  5. Organization: Hewlett Packard, Cupertino
  6. Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!sdd.hp.com!hpscit.sc.hp.com!hplextra!hpfcso!hpcss01!hpcuhe!dr
  7. Newsgroups: comp.sys.hp
  8. Lines: 281
  9.  
  10.  
  11. The Computer Language Operation at Hewlett-Packard would like to get your
  12. opinions on command line options to control optimization.
  13.  
  14. If you would like to respond, please Email your reply to "dr@cup.hp.com",
  15. by January 22, 1993.  Please do not post a reply.  We appreciate your feedback!
  16.  
  17. Note: you do not need to be an expert at optimization to provide useful
  18. feedback. 
  19.  
  20. The following note presents two different proposals for command line options 
  21. to control optimization, and then asks some questions on what you would prefer.
  22. We would like to get your feedback on whether either of these is an
  23. improvement over the current command line option syntax for invoking
  24. optimization, on the HP9000 series 700 and series 800 computer systems.
  25.  
  26.  
  27. -------------------------  Proposal 1 starts here ---------------------------
  28.  
  29. This proposal offers an increasing level of choices, depending on how much
  30. you want to control the optimization process.
  31.  
  32.  
  33. First choice:
  34.  
  35.   Your first choice is whether you want to optimize or not, the choices are:
  36.  
  37.    Option        Meaning
  38.    ------        -------
  39.  
  40.     <none>       No optimization.
  41.  
  42.      -O          Basic Optimization.
  43.  
  44.   The optimizations performed under the basic "-O" level were chosen to
  45.   provide a good balance -- they increase run-time execution speed
  46.   without excessively slowing down compile time and link time.
  47.  
  48.   The "-O" level is not the highest optimization level available, but
  49.   it is a good choice for many users.  It is equivalent to "+O2" below.
  50.  
  51.  
  52. Second choice:
  53.  
  54.   There may be times when you want more or less optimization than
  55.   available through the basic "-O" level.  For this, this proposal
  56.   offers the following (brackets indicate the letters between the
  57.   brackets are optional, and a vertical bar means you can choose one of
  58.   the two choices):
  59.  
  60.     +O1[s]           Level 1 provides optimization that compiles very
  61.                      quickly, but still provides some execution-time
  62.                      speedup.  Level 1 optimizations are those that the
  63.                      compiler can do in a few passes of looking at the
  64.                      generated instructions.
  65.  
  66.     +O2[c|a][u][s]   Level 2 (which is equivalent to "-O") takes more
  67.                      time to compile, but produces greatly improved
  68.                      run-time speed.  At this level, the compiler does
  69.                      extensive analysis of data-flow, memory usage,
  70.                      loops, and expressions.  Level 2 includes all
  71.                      optimizations that can be done while considering
  72.                      only one source file at a time.
  73.  
  74.     +O3[c|a][u][s]   Level 3 goes a step beyond level 2, by postponing
  75.                      optimization and code generation until link time.
  76.                      This allows the optimizer to process the entire program
  77.                      at once (at link time).  By doing this, the optimizer 
  78.                      can take advantage of execution profile information
  79.                      to do a better job of improving the object code.
  80.                      Also, it can shorten global data references and do
  81.                      inlining across multiple source files.  Postponing
  82.                      optimization until link time decreases the time
  83.                      spent in the compile phase, but it greatly increases 
  84.                      the time and memory required to link the program.
  85.  
  86.     Level 3 includes all the optimizations of level 2.  Level 3 is not
  87.     included in the set of optimizations done at the basic "-O" level, because 
  88.     of its large increase in the time and memory required to link a program.
  89.  
  90.     The level number controls where the optimizer spends its time:
  91.       Level 1 is very quick optimization on one file, 
  92.       level 2 is extensive optimization on one file, and 
  93.       level 3 is extensive optimization over the entire program.
  94.  
  95.     The optional letters that follow the level number control other
  96.     aspects of optimization.  These are as follows:
  97.  
  98.     Letter        Meaning:
  99.  
  100.       c           Conservative optimization.  This reduces the level of
  101.                   assumptions the optimizer makes about the code, so that 
  102.                   the optimizer can correctly optimize source code even
  103.                   when that source code violates the strict definition
  104.                   of the language.  Run-time performance will be less
  105.                   then the default level.
  106.  
  107.     <no letter>   Basic optimization (default) -- those optimizations at
  108.                   each level that do not change the behavior of code
  109.                   that conforms to the applicable language standards
  110.                   (for each particular language).
  111.  
  112.       a           Aggressive optimization.  This raises the level of
  113.                   assumptions the optimizer makes about the code, doing
  114.                   things that might be risky to gain the best possible
  115.                   run time performance.  This also includes optimization
  116.                   techniques that are new for this release.
  117.  
  118.       u           Unrestricted compile time and compiler memory space --
  119.                   does all optimizations appropriate to the optimization
  120.                   level without regard to compilation time and memory
  121.                   space.  By default, compilation time and space are
  122.                   limited when optimizations are performed on large routines.
  123.  
  124.       s           Optimize for Space.  This letter disables optimizations 
  125.                   that expand the size of the executable program.  Most 
  126.                   optimizations improve both execution time and reduce
  127.                   code space.  This option suppresses the few techniques
  128.                   that expand code space to improve execution time.
  129.  
  130.   Example:  To produce the best run time performance (and the longest
  131.             time to compile), use "+O3au".
  132.  
  133.  
  134. Third choice:
  135.  
  136.   Most of the time, using level 1, 2, or 3 optimizations with their
  137.   suboption letters should provide you with the control over the
  138.   optimizer that you need.  Additional parameters are provided when you
  139.   require a finer level of control.
  140.  
  141.   At each level, you can turn on and off specific optimizations using the  
  142.   +O[no]<optimization> option.  The <optimization> parameter is the name 
  143.   of a specific optimization technique.  The optional prefix [no] 
  144.   disables the specified optimization. 
  145.  
  146.   There are many such toggles, here is just one example:
  147.  
  148.     +O[no]pipeline  Enables [or disables] software pipelining.  The default is 
  149.                     +Opipeline at levels 2 and 3 unless the [s] suboption is
  150.                     specified.  The +Opipeline option replaces the obsolete
  151.                     "+OS" option.
  152.  
  153.   Several advanced optimization options can be specified in the same command 
  154.   line.  For example, the following command line specifies aggressive level 3
  155.   optimizations with unrestricted compile time, disables software pipelining,
  156.   and disables moving conditional floating-point instructions out of a loop:
  157.  
  158.        cc +O3au +Onopipeline +Onomoveflops sourcefile.c
  159.  
  160.   Specify the level of optimization first (+O1, +O2, or +O3), followed by
  161.   any +O[no]<optimization> options.
  162.  
  163.   There will be a new mnemonic toggle to replace many of the obscure 
  164.   optimization options HP currently supports (-J, +OE, +Om1, +OV, +Obb, etc).
  165.  
  166. ------------------------  Proposal 1 ends here -------------------------------
  167. ------------------------  Proposal 2 starts here -----------------------------
  168.  
  169.  
  170. This section proposes an alternate way of controlling optimizer
  171. aggressiveness, compile time, and code-expansion.  This proposal groups
  172. the optimization features into four levels and eliminates the "a", "c",
  173. "s", and "u" suboptions.  Advanced toggles to enable or disable specific
  174. optimization techniques (such as "+O[no]pipeline") would be provided
  175. with this proposal, just as they are provided in the other proposal.
  176. The options would appear as follows:
  177.  
  178. Option             Aggressiveness   Compile Time    Code Expansion 
  179. ---------------------------------------------------------------
  180. +O1                conservative     very limited    enabled
  181.                    (not likely to change unstructured code)
  182.  
  183. -O or +O2          basic            limited         enabled
  184.                    (not likely to change unstructured code)
  185.  
  186. +O3                aggressive       unlimited       enabled 
  187.                    (not likely to change standards-conforming code)
  188.  
  189. +O4                very aggressive  unlimited       enabled
  190.                    (may change the behavior of user's code
  191.                    in areas such as error handling)
  192.  
  193. With each higher level of optimization, there is an increase in the risk
  194. and build times, as well as potential performance benefits.  At level 3
  195. and level 4, optimizations are performed at link time.
  196.  
  197. The major differences between this proposal and proposal #1 are:
  198.  
  199. 1) This proposal emphasizes a simpler command line interface, in that
  200.    there are no suboption letters.  It thus offers 4 choices, instead of
  201.    the 24 possibilities offered by proposal #1.
  202.  
  203.    This proposal thus bundles all factors together on one scale.  When
  204.    optimizing the entire program at link time (level 3 and 4) it makes
  205.    the most aggressive assumptions about the object code.  When optimizing
  206.    one file at a time (level 2), it will only do basic optimization.
  207.    No other combinations are possible.  For example, you cannot request
  208.    aggressive optimization on one file, nor conservative optimization
  209.    over the entire program.
  210.  
  211. 2) In contrast to proposal #1, this one offers two "aggressive" levels.
  212.    The first would be for new optimizations, and the second "very
  213.    aggressive" level would be for optimizations that can change program
  214.    behavior (for example:  changing error handling methods, or moving
  215.    floating point exceptions).
  216.  
  217. 3) The "s" (size) suboption is not provided since optimized code is
  218.    typically about 50% smaller than unoptimized code, and suppressing
  219.    space expanding optimizations would typically only reduce the size of
  220.    an average program by another 3% to 5%.  If a customer wants to limit
  221.    the object code size, he or she could turn off any optimizations that
  222.    increase code size, by using the toggles, as follows:
  223.  
  224.       cc +O4 +Onoinline +Onolibcall +Onopipeline sourcefile.c
  225.  
  226. 4) The "u" (unrestricted) suboption is not provided since this proposal
  227.    assumes that optimization is typically performed only at the tail end
  228.    of projects, and because limiting compilation time when optimization
  229.    is enabled is not a major issue for most customers.
  230.  
  231. 5) The "c" (conservative) and "a" (aggressive) suboptions are not
  232.    provided as they are replaced by placing more aggressive optimizations 
  233.    at the higher optimization levels.
  234.  
  235. ------------------------  Proposal 2 ends here -------------------------------
  236.  
  237. After reading through the proposals, please answer the following questions:
  238.  
  239. 1) Briefly describe your programming environment.
  240.    Languages:                  
  241.    Platforms: 
  242.    Applications:
  243.    # of years of programming experience: 
  244.    Standards Conformance (ANSI, NON-ANSI, POSIX, X,...):
  245.  
  246. 2) Do you currently use the HP optimizer? If so, what command line options?
  247.  
  248.  
  249.  
  250. 3) Are the proposed optimizer schemes easy to understand?  Which one is
  251.    easier to understand?  Is there anything in either scheme that is not
  252.    straightforward?
  253.  
  254.  
  255.  
  256. 4) Do the proposed optimizer schemes provide the capability you need? 
  257.    If not, what is missing?
  258.  
  259.  
  260. 5) Which proposal do you prefer?
  261.  
  262.  
  263.  
  264. 6) Is the ability to control the actions of the optimizer (in terms of
  265.    aggressiveness, compile time limits, and code size) important to you?
  266.    
  267.  
  268.  
  269. 7) If you are already using the HP optimizer, is either of the proposals
  270.    an improvement?
  271.  
  272.  
  273.  
  274. 8) What optimization options might you consider using?
  275.  
  276.  
  277.  
  278. 9)  What other comments do you have regarding optimization command
  279.     line options?
  280.  
  281.  
  282.  
  283. 10) May we contact you to obtain more information about your use
  284.     of the HP optimizer?
  285.  
  286.  
  287.  
  288. We appreciate the time you have taken to read and comment on these
  289. proposals.  We plan to incorporate any feedback received into planning
  290. for our next product release cycle.
  291.