This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to compile SVE with ArmPL?

Hi all,

I am using ArmPL 22 and want to use some functions in libamath, like exp, log, cos etc. By dumping libamath.so I can find intrinsics like armpl_svexp_f32_x, but it does not compile and I can not find any documents or examples. Could someone help me to compile SVE codes with ArmPL?

Thanks

Parents Reply Children
  • Hi Blanchard,

    Thank you for the reply! I am trying to compile a simple program as follow:

    #include <math.h>
    #include <arm_sve.h>
    #include <armpl.h>

    int main() {
        svfloat32_t x = svdup_f32(4.0);
        svbool_t p_all = svptrue_b32();

        svfloat32_t y = _ZGVsMxv_exp(x, p_all);

        return 0;
    }


    The command line I use is:
    gcc -O3 -march=armv8-a+sve -o test test.c -lamath -lm
     
    And the error I get is:
    test.c: In function ‘main’:
    test.c:9:21: warning: implicit declaration of function ‘_ZGVsMxv_exp’ [-Wimplicit-function-declaration]
    9 | svfloat32_t y = _ZGVsMxv_exp(x, p_all);
    | ^~~~~~~~~~~~
    test.c:9:21: error: incompatible types when initializing type ‘svfloat32_t’ using type ‘int’

  • Ok, you are almost there. You simply need to use the single precision version, which is _ZGVsMxv_expf.

  • I am still getting the same error with both gcc 10 and 11, and the library I am using is 22.0 (free version)

    test.c: In function ‘main’:
    test.c:9:21: warning: implicit declaration of function ‘_ZGVsMxv_expf’ [-Wimplicit-function-declaration]
    9 | svfloat32_t y = _ZGVsMxv_expf(x, p_all);
    | ^~~~~~~~~~~~~
    test.c:9:21: error: incompatible types when initializing type ‘svfloat32_t’ using type ‘int’

    Or if I change the type of y from

    svfloat32_t y = _ZGVsMxv_expf(x, p_all);

    to

    int y = _ZGVsMxv_expf(x, p_all);

    The error becomes 

    test.c:9:13: error: SVE type ‘svfloat32_t’ cannot be passed to an unprototyped function
    9 | int y = _ZGVsMxv_expf(x, p_all);
    | ^~~~~~~~~~~~~~~~~~~~~~~

    I can compile the example from

    https://developer.arm.com/documentation/102620/0100/Compile-and-test-the-examples

    So I think I have set the environment correctly.

  • Right, math.h don't seem to expose the SVE symbols. You will have to declare the one you want to use manually in the header of your file, like that:

    svfloat32_t _ZGVsMxv_expf(svfloat32_t, svbool_t);

    svfloat32_t _ZGVsNxv_expf(svfloat32_t);

  • Thank you so much, it finally works!