[PATCH] Add getUnrollingPreferences to TTI

Hal Finkel hfinkel at anl.gov
Wed Aug 28 13:07:31 PDT 2013


Nadav, et al.,

The attached patch adds the following interface to TTI:

/// Parameters that control the generic loop unrolling transformation.
struct UnrollingPreferences {
  unsigned Threshold; ///< The cost threshold for the unrolled loop.
  unsigned OptSizeThreshold; ///< The cost threshold for the unrolled loop
                             ///< when optimizing for size.
  bool     Partial;   ///< Allow partial loop unrolling.
  bool     Runtime;   ///< Perform runtime unrolling.
};

/// \brief Get target-customized preferences for the generic loop unrolling
/// transformation. Returns true if the UnrollingPreferences struct has been
/// initialized.
virtual bool getUnrollingPreferences(UnrollingPreferences &UP) const;

I'd like to use this in the PowerPC backend when targeting the A2 core. For this target, using more aggressive unrolling helps a lot because it is in-order with a deep pipeline. As a result, unrolling is important for hiding instruction latency and branch overhead (especially when combined with the -enable-aa-sched-mi functionality).

I discussed this briefly with Chandler on IRC, and he expressed the opinion that changing the unrolling factor does not really change the canonical form (and TTI is already used to calculate the loop body costs), and so this seems like an appropriate use of TTI.

Please review.

Thanks again,
Hal

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unroll_tti.patch
Type: text/x-patch
Size: 6496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130828/486ab4e1/attachment.bin>


More information about the llvm-commits mailing list