emmtrix Code Vectorizer

From emmtrix Wiki
Jump to navigation Jump to search

emmtrix Code Vectorizer is a C source-to-source compiler that vectorizes C code for various SIMD architectures like Infineon AURIX TC4x PPU, x86 AVX, ARM NEON, or RISC-V V extensions. It follows an semi-automatic approach, where the user can guide the vectorization process from an Eclipse-based GUI or by using pragmas in the C code. The vectorized C code is always visible to the user, which makes it easy to follow the transformation and to understand the generated code. The generated code can be compiled with the vendor’s compiler and either run on the target hardware or in a simulator to get performance feedback and verify the correctness of the transformation.

Multi-Precision Vector Math Library

The emmtrix Code Vectorizer incorporates a multi-precision vector math library that provides vectorized implementations of common C mathematical functions like sinf, cosf, expf, logf, powf, sqrtf, tanhf and many more. The library provides multiple versions of each function to provide the best trade-off between accuracy and performance. During vectorization, the vector math library is used to replace scalar math functions with vectorized versions. By specifying the accuracy requirements in ULPs (units in the last place), the user can control which version of the function is used.

Function Info Accuracy[1] [ULP] Latency on AURIX TC4x [cycles] Throughput on AURIX TC4x [cycles]
fabsf 0.0
fminf 0.0
fmaxf 0.0
roundf 0.0 11 5
ceilf 0.0 6 4
floorf 0.0 6 4
truncf 0.0 6 4
sqrtf Hardware version 1.0 16 7
expf Hardware version 1.0 11 6
exp2f Hardware version 1.0 14 6
log2f Hardware version 1.0 14 6
logf Based on log2f ULP 1.0 hardware version 1.93
log10f Based on log2f ULP 1.0 hardware version 2.50
sinf Hardware version 1.0 14 6
cosf Hardware version 1.0 14 6
tanf Based on sinf/cosf ULP 1.0 hardware version 3.42
tanhf Based on expf ULP 1.0 hardware version 7.08 41 18
4.23 41 19
2.74 41 23
1.91 41 27
remainderf
fmodf
fdimf
  1. Accuracy of hardware version are given from the data sheet. A ULP 0.0 means that the implementation is exact. Otherwise, the highest know ULP is provided. Math functions that are based on non-perfect hardware implementation use a pessimistic software implementation for ULP evaluation. A more accurate ULP evaluation could be provided on request.