Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.4.9 fails to autodetect SVE2 with gcc 10.3.0 #145

Closed
mddirba opened this issue Mar 30, 2023 · 2 comments · Fixed by #165
Closed

5.4.9 fails to autodetect SVE2 with gcc 10.3.0 #145

mddirba opened this issue Mar 30, 2023 · 2 comments · Fixed by #165
Assignees
Labels
bug Something isn't working

Comments

@mddirba
Copy link

mddirba commented Mar 30, 2023

The remaining issue is the check for sve and sve2 support in CMakeLists.txt. If the string sve is found in the compile options which will be true for systems that support sve2, then you do not set either SVE2_FOUND or SVE2_BITPERM. So later in the process you attempt to append sve2 to the end of the compile flags which violates the same gcc rule as shown in #106

I propose either rearranging the search order like below or breaking up the if ... elseif ... endif to three separate if statements.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e90d8c9..9fb0cfd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -187,12 +187,15 @@ if (CMAKE_COMPILER_IS_GNUCC AND NOT CROSS_COMPILE)
     string(FIND "${GNUCC_ARCH}" "sve" POS_SVE)
     string(FIND "${GNUCC_ARCH}" "sve2" POS_SVE2)
     string(FIND "${GNUCC_ARCH}" "sve2-bitperm" POS_SVE2_BITPERM)
-    if (NOT POS_SVE EQUAL 0)
+    if(NOT POS_SVE2_BITPERM EQUAL 0)
+        set(SVE2_BITPERM_FOUND 1)
+        set(SVE2_FOUND 1)
         set(SVE_FOUND 1)
     elseif(NOT POS_SVE2 EQUAL 0)
         set(SVE2_FOUND 1)
-    elseif(NOT POS_SVE2_BITPERM EQUAL 0)
-        set(SVE2_BITPERM_FOUND 1)
+        set(SVE_FOUND 1)
+    elseif (NOT POS_SVE EQUAL 0)
+        set(SVE_FOUND 1)
     endif()
 message(STATUS "ARCH_FLAG '${ARCH_FLAG}' '${GNUCC_ARCH}', TUNE_FLAG '${TUNE_FLAG}' '${GNUCC_TUNE}' ")
@markos
Copy link

markos commented Mar 30, 2023

indeed, the order should be reversed as you note. I will need to test this on both SVE and SVE2 systems and will probably release a new version soon with a fix.

@markos markos self-assigned this Mar 30, 2023
@markos markos added the bug Something isn't working label Mar 30, 2023
@mddirba
Copy link
Author

mddirba commented Mar 30, 2023

thank you!

@markos markos changed the title feature/bump-version fails to enable SVE2 with gcc 10.3.0 5.4.9 fails to autodetect SVE2 with gcc 10.3.0 Mar 31, 2023
markos pushed a commit that referenced this issue Aug 23, 2023
@markos markos linked a pull request Aug 31, 2023 that will close this issue
@markos markos closed this as completed Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants