DEV Community

Yukti Manoj Mulani
Yukti Manoj Mulani

Posted on

Project Stage-3: Digging Deeper

Hi Peeps!! Welcome back. Without wasting any time lets continue from the last blog.

The error message related to the target("sve2") attribute has been a key focus in the latest phase of our AFMV implementation. The message was clear but presented a challenge:

error: pragma or attribute ‘target("sve2")’ is not valid
Enter fullscreen mode Exit fullscreen mode

To address this, I first ensured that my GCC version supports SVE2 instructions. Using the command gcc --version, I verified the version and compatibility. Here’s what I found:

  • GCC Version Check: Confirmed that my GCC version was up-to-date and should theoretically support SVE2.

Next, I explored the usage and context of the target attribute. Here’s a snippet from my hello.c file:

#include <stdio.h>

__attribute__((target_clones("sve2")))
void my_function() {
    printf("This function uses SVE2 instructions.\n");
}

int main() {
    my_function();
    return 0;
}

Enter fullscreen mode Exit fullscreen mode

Despite the correct syntax, the error persisted. This led me to check if there were specific flags required to enable SVE2 support. The solution involved adding -march=armv8.5-a+sve2 to the GCC compilation command:

gcc hello.c -o hello -O3 -march=armv8.5-a+sve2

Enter fullscreen mode Exit fullscreen mode

This resolved the issue, confirming that the attribute was now valid under the specified architecture. The journey continues, but this was a significant step towards a functioning AFMV implementation.

Until next time, happy coding 🚀!!

Top comments (0)