Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-9854

SE advance may be duplicated in the presence of vectors larger than 512 bits

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-7654
    • C7000_1.4.0.LTS
    • C7000_1.4.1.LTS*
    • default
    • Hide
      There are three potential ways to avoid the bug in a function, each of which corresponds to a necessary condition for the bug to occur:

      1. Do not use operations on vector types that are not directly supported by hardware. This means not using long16 and double16 which are 1024 bits wide. This solution is the most practical and performant.
      2. Do not advance the streaming engine as part of a load of a vector. Access the streaming engine (__SE0()), then advance it separately (__SEOADV()).
      3. Do not use non-overlapping subvector accesses of vectors loaded by a streaming engine advance. This solution is likely most difficult to implement reliably depending on what an affected function is required to do.
      Show
      There are three potential ways to avoid the bug in a function, each of which corresponds to a necessary condition for the bug to occur: 1. Do not use operations on vector types that are not directly supported by hardware. This means not using long16 and double16 which are 1024 bits wide. This solution is the most practical and performant. 2. Do not advance the streaming engine as part of a load of a vector. Access the streaming engine (__SE0()), then advance it separately (__SEOADV()). 3. Do not use non-overlapping subvector accesses of vectors loaded by a streaming engine advance. This solution is likely most difficult to implement reliably depending on what an affected function is required to do.

      If a function contains all of the following:

      1. Any vector operation that is wider than what the hardware supports (512 bits). For example, an add operation on two double16 vectors (1024 bits) that must be split by the compiler into two add operations on double8 vectors.
      2. A load of a vector by streaming engine advance.
      3. Non-overlapping accesses of the vector loaded by the streaming engine advance.

      Then at any optimization level (-o0 or higher), the streaming engine advance may be duplicated causing too many advances to occur. The following example contains the necessary components for the bug to occur:

      #include <c7x.h>
      int a; int b; int c; int d;
      double16 foo(double16 d1, double16 d2)

      { int4 v = __SE0ADV(int4); a = v.s0; b = v.s1; c = v.s2; d = v.s3; return d1 + d2; }

      This will result in assembly that contains four SE advances. If the code is modified such that the load is not associated with an advance, which breaks the second condition for the bug to occur:

      int4 v = __SE0(int4); __SE0ADV(int4);

      Then, only one SE advance will occur, avoiding the bug. Similarly, if the code is modified to not have a vector operation that is larger than what the hardware supports, which breaks the first condition:

      double8 foo(double8 d1, double16 8)

      Then the SE advance will not be duplicated, avoiding the bug. The third condition may be more difficult to break in source code, but if the assignments to a, b, c, and d from non-overlapping subvector accesses are removed in the example, the bug will not occur.

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: