Limitations - 2021.2 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
ft:locale
English (United States)
Release Date
2021-12-15
Version
2021.2 English

There are some limitations with the use of hls::stream_of_blocks that you should be aware of:

  • Each hls::stream_of_blocks object must have a single producer and consumer process, and each process must be different. In other words, local streams-of-blocks within a single process are not supported.
  • You cannot use hls::stream_of_blocks within a sequential region. The producer and consumer must be separate concurrent processes in a dataflow region.
  • You cannot use multiple nested acquire/release statements (write_lock/read_lock), for example in the same or nested scopes, as shown in the following example:
    using ppbuf = int[N];
    void readerImplicitNested(hls::stream_of_blocks<ppbuf>& in, ...) {
        for(unsigned j = 0; j < M; ++j) {
           hls::read_lock<ppbuf> arrA(in); // constructor would acquire A first
           hls::read_lock<ppbuf> arrB(in); // constructor would acquire B second
           for(unsigned i = 0; i < N; ++i)
               ... = arrA[f(i)] + arrB[g(i)];
           // destructor would release B first
           // destructor would release A second
        }
    }

    However, you can use multiple sequential or mutually exclusive acquire/release statements (write_lock/read_lock), for example inside IF/ELSE branches or in two subsequent code blocks. This is shown in the following example:

    void readerImplicitNested(hls::stream_of_blocks<ppbuf>& in, ...) {
     for(unsigned j = 0; j < M; ++j) {
      {
        hls::read_lock<ppbuf> arrA(in); // constructor acquires A
        for(unsigned i = 0; i < N; ++i)
          ... = arrA[f(i)];
        // destructor releases A
      }
      {
        hls::read_lock<ppbuf> arrB(in); // constructor acquires B
        for(unsigned i = 0; i < N; ++i)
          ... = arrB[g(i)];
        // destructor releases B
      }
     }
    }
  • Explicit release of locks in producer and consumer processes are not recommended, as they are automatically released when they go out of scope. However, you can use these by adding #define EXPLICIT_ACQUIRE_RELEASE before #include "hls_streamofblocks.h in your source code.