The genvectors_bilinear_interp
function generates test vector files assuming a single AI Engine kernel is used for processing. To utilize multiple kernels in parallel, invoke the function as:
>> genvectors_bilinear_interp(N)
where, N is the number of desired kernels. This function extracts one of the coordinate transformations from file bli_coords.mat
, performs bilinear interpolation on the pixels, and creates input and output test vectors for AI Engine simulation. The function also generates a file named config.h
used by the AI Engine compiler and simulator to specify number of kernels and number of kernel invocations required to process the entire test image. This function also performs bilinear interpolation in double precision using the MATLAB interp2
function and stores the result in file golden_ref.mat
.
As an example, specifying four kernels should result in the MATLAB Console Window displaying something like
>> genvectors_bilinear_interp(4)
Number of output pixels interpolated = 453221 out of 1048576 (43.22252 %)
Maximum pixel error is 0.000035322
Mean square pixel error is 0.000000000
along with the image shown in Figure 12.
Figure 12 - MATLAB genvectors_bilinear_interp Output
Once these MATLAB scripts are run, the rest of the AI Engine build and simulation process proceeds in the same manner. Figure 13 shows how four kernels are assigned to tiles in the AI Engine array.
Figure 13 - Multicore Kernel Placement in AI Engine Array
Figure 14 shows the result of comparing multicore AI Engine simulation output with test vectors. Based on profile results, four kernels will support peak processing rates in the range of approximately 453 to 568 MP/s, depending on device speed.
Figure 14 - Multicore Simulation Verification