[PATCH] D55710: add pragmas to control Software Pipelining optimisation

Alexey Lapshin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 20 08:13:25 PST 2018


alexey.lapshin marked an inline comment as done.
alexey.lapshin added inline comments.


================
Comment at: include/clang/Basic/AttrDocs.td:2677-2678
+`language extensions
+<http://clang.llvm.org/docs/LanguageExtensions.html#extensions-for-loop-hint-optimizations>`_
+for further details, including limitations of the pipeline hints.
+  }];
----------------
aaron.ballman wrote:
> There is nothing in the linked documentation that describes pipeline initiation intervals, so I'm still left wondering how to pick a value for the attribute argument. I think the docs need a bit more detail for what that value means and how it impacts the user's code.
How about this variant :

Software Pipelining optimization is a technique used to optimize loops by
utilizing instructions level parallelism. It reorders loop instructions to
overlap iterations. As the result new iteration started before previous
have finished. The Modulo Scheduling technique creates schedule for one
iteration such that when repeating at regular interval no inter-iteration
dependence violated. This constant interval(in cycles) between the start
of iterations called initiation interval. Cycles number of one iteration
of newly generated loop matches with Initiation Interval. For further
details see https://en.wikipedia.org/wiki/Software_pipelining and
"Swing Modulo Scheduling: A Lifetime-Sensitive Approach", by J. Llosa,
A. Gonzalez, E. Ayguade, and M. Valero.

``#pragma clang loop pipeline`` and `#pragma loop pipeline_initiation_interval``
could be used as hints for Software Pipelining optimization.

Using ``#pragma clang loop pipeline(disable)`` avoids software pipelining optimization. The disable state can only be specified:

.. code-block:: c++

          #pragma clang loop pipeline(disable)
          for (...) {
            ...
          }


Using ``#pragma loop pipeline_initiation_interval``
instructs the software pipeliner to check the specified initiation interval.
If schedule found the result loop iteration would have specified
cycle count:

.. code-block:: c++

         #pragma loop pipeline_initiation_interval(10)
         for (...) {
           ...
         }



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

https://reviews.llvm.org/D55710





More information about the cfe-commits mailing list