SPRUIG8J January 2018 – March 2024
Unlike the example in the previous section, the following example is not transformed,
because len1
and len2
can potentially exceed the
size of the 32-bit fields of the SE and the loop counters can exceed 32-bit
values:
void example2(char *in, char *restrict out, long len1, long len2)
{
for (long i = 0; i < len1; i++)
for (long j = 0; j < len2; j++)
out[i*len1 + j] = in[i*len1 + j];
}
In practice, such addressing patterns almost always map to a stream, although edge cases are still possible. Such cases include, but are not limited to:
For further information about how a stream is programmed, see Section 4.15.6.
The --assume_addresses_ok_for_stream option allows the compiler to ignore edge cases
such as these. Using this option allows example2
to be transformed
in the same way as example1
.
Incorrect code can be generated if the --auto_stream=no_saving option is used when an SE or SA is open and a function call is made. In this case, the state of the SE or SA that is open is lost if that SE or SA is used automatically by the compiler.
Incorrect code can also be generated if --auto_stream is used and L1D is configured and used as SRAM. In this case, attempting to use the SE to access L1D fails.