Chapter 6
Vectorized Code Generation
©
National Instruments Corporation
6-17
The interesting part is that of the last gain block (
gain..99
). Notice that
although two distinct arrays are used as input, because the input arrays are
connected contiguously, the code is rolled into two separate loops. The
generalized capability can be thought of as a replication of the block
algorithm to produce the best vectorization based on the inputs, outputs,
and the block algorithm.
Note
There can be more than one array for the outputs of a block just as there can be
multiple arrays for the inputs. AutoCode replicates the algorithm to support multiple output
arrays just as Example 6-6 showed with multiple inputs.
Split-Merge Inefficiency
The term split-merge is a description of a problem that occurs when
generating vectorized code for a diagram and pieces of one or more arrays
are used as input. This is called a
split
[input] vector problem. A split vector
can prevent blocks from rolling into a single loop. A solution to this
problem is the merging
of all of the inputs into arrays that can be easily
rolled.
Split Vector
The SystemBuild Editor lets you connect individual pins of the blocks very
easily. Thus, when generating vectorized code, instead of connecting up the
whole array, pieces or slices of the array are being used. This does not pose
a problem for the block generating the data, but for the blocks consuming
the data—that is, blocks using part of the array as input. The problem is that
the generated code might not be rolled into a loop. Hence, one would say
that you are using a split vector.
Consider the diagram in Figure 6-4 and the generated code in Example 6-7.