Lably
Skip to content

Stream processing

Computer programming paradigm

  • 25 min read
  • 6 chapters

Related on Lably

Through Computer science, Stream (computing) and Computation

The stream processing paradigm simplifies parallel software and hardware by restricting the kinds of parallel computation that can be performed. Given a sequence of data (a stream), a series of operations (kernel functions) is applied to each element in the stream. Kernel functions are usually pipelined, and efficient local on-chip memory reuse is attempted in order to minimize bandwidth loss associated with external memory interaction. Uniform streaming, in which a single kernel function is applied to all elements in the stream, is typical. Because the kernel and stream abstractions expose data dependencies, compiler tools can fully automate and optimize on-chip management tasks. Stream processing hardware can use techniques such as scoreboarding to initiate direct memory access (DMA) when dependencies are resolved. The elimination of manual DMA management reduces software complexity, while the reduced reliance on hardware cached I/O decreases the memory footprint required by specialized computational units such as arithmetic logic units.

During the 1980s stream processing was explored within dataflow programming. One example is the language SISAL.

Applications

Stream processing can be viewed as a compromise, driven by a data-centric model that works well for traditional DSP- or GPU-type applications (such as image, video and digital signal processing), but less well for general purpose processing with more randomized data access (such as databases). By sacrificing some flexibility in the model, this approach can enable easier, faster, and more efficient execution. Depending on the context, processor design can be tuned for maximum efficiency or for a trade-off with flexibility.

Stream processing is especially suitable for applications that exhibit three characteristics:

  • Compute intensity, defined as the number of arithmetic operations per I/O or global memory reference. In many signal processing applications, this ratio is well over 50:1 and continues to increase with algorithmic complexity.
  • Data parallelism, which exists in a kernel when the same function is applied to all records of an input stream, allowing multiple records to be processed simultaneously without waiting for results from previous records.
  • Data locality, a form of temporal locality common in signal and media processing applications, in which data is produced once, read once or twice later in the application, and then not used again. Intermediate streams passed between kernels, as well as intermediate data within kernel functions, can capture this locality directly in the stream processing programming model.

Examples of records within streams include:

  • In graphics, each record may consist of vertex, normal, and color information for a triangle.
  • In image processing, each record may be a single pixel from an image.
  • In a video encoder, each record may be 256 pixels, forming a macroblock of data.
  • In wireless signal processing, each record could be a sequence of samples received from an antenna.

For each record, processing is typically limited to reading from the input, performing operations on the data, and writing the result to the output. Multiple inputs and outputs are possible, but memory is not both read and written within the same application.

Sign in to keep reading

5 more chapters are free with a Lably account.

More in Computing and communication