Skip to content

Add option to enable "sve" optimization level on armv9 #830

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

Open
wants to merge 14 commits into
base: branch-25.08
Choose a base branch
from

Conversation

LizYou
Copy link

@LizYou LizYou commented Apr 21, 2025

No description provided.

@LizYou LizYou requested a review from a team as a code owner April 21, 2025 07:02
Copy link

copy-pr-bot bot commented Apr 21, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.


# Check for SVE support
message("Checking for SVE support")
SET(CMAKE_REQUIRED_FLAGS "-march=armv9-a+sve")
Copy link
Contributor

@bdice bdice Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use lowercase for the CMake function names, like set(...), if(...), else(), mark_as_advanced(...).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Will update

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just found the FindAVX.cmake is using the uppercase as well; So it is reasonable to use uppercase for FindSVE.cmake for code consistency?

in FindAVX.cmake:

ACRO(CHECK_SSE lang type flags)
SET(__FLAG_I 1)
SET(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
FOREACH(__FLAG ${flags})
IF(NOT ${lang}${type}FOUND)
SET(CMAKE_REQUIRED_FLAGS ${__FLAG})
CHECK_CXX_SOURCE_RUNS("${${type}CODE}" ${lang}HAS${type}${__FLAG_I})
IF(${lang}HAS${type}
${__FLAG_I})
SET(${lang}
${type}FOUND
TRUE
CACHE BOOL "${lang} ${type} support"
)
SET(${lang}
${type}_FLAGS
"${__FLAG}"
CACHE STRING "${lang} ${type} flags"
)
ENDIF()
MATH(EXPR __FLAG_I "${__FLAG_I}+1")
ENDIF()
ENDFOREACH()

Copy link
Contributor

@bdice bdice Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's prefer "good CMake style" over consistency here, and go lower-case. Maybe as a follow-up we can fix FindAVX.cmake.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Pls double-check

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the latest code look good to you? The "sve" optimization flag can enhance the performance on AArch64 machine significantly which is around 17% in my run. Hope we can integrate this flag in soon time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LizYou please see my comment below about the style checker (git pre-commit hooks). This PR cannot be merged while the style checker is not passing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for overlooking this comment. I have fixed the style warning with pre-commit run. Pls double-check; @cjnolet

$ pre-commit run --files cpp/CMakeLists.txt cpp/cmake/modules/FindSVE.cmake cpp/cmake/thirdparty/get_faiss.cmake
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
isort................................................(no files to check)Skipped
black................................................(no files to check)Skipped
flake8...............................................(no files to check)Skipped
mypy.................................................(no files to check)Skipped
pydocstyle...........................................(no files to check)Skipped
clang-format.........................................(no files to check)Skipped
no-deprecationwarning................................(no files to check)Skipped
cmake-format.............................................................Passed

  • hook id: cmake-format
  • duration: 0s

The rapids-cmake cmake-format configuration file was not found at any of the default search locations:

/home/scratch.lyou_gpu/arm/workspaces/cuvs_faiss_sve/cpp/build/_deps/rapids-cmake-src/cmake-format-rapids-cmake.json

Try setting the environment variable RAPIDS_CMAKE_FORMAT_FILE to the path to the config file.

cmake-lint...............................................................Passed

  • hook id: cmake-lint
  • duration: 0s

The rapids-cmake cmake-format configuration file was not found at any of the default search locations:

/home/scratch.lyou_gpu/arm/workspaces/cuvs_faiss_sve/cpp/build/_deps/rapids-cmake-src/cmake-format-rapids-cmake.json

Try setting the environment variable RAPIDS_CMAKE_FORMAT_FILE to the path to the config file.

include-check............................................................Passed
codespell................................................................Passed
check json...........................................(no files to check)Skipped
verify-copyright.....................................(no files to check)Skipped
verify-alpha-spec....................................(no files to check)Skipped
verify-codeowners....................................(no files to check)Skipped
RAPIDS dependency file generator.....................(no files to check)Skipped
shellcheck...........................................(no files to check)Skipped

@cjnolet cjnolet added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Apr 22, 2025
@cjnolet
Copy link
Member

cjnolet commented Apr 22, 2025

/ok to test 0d939b1

@cjnolet
Copy link
Member

cjnolet commented Apr 23, 2025

@LizYou it looks like we have some style checker errors. We use Git pre-commit hooks to automatically format code changes so they pass the style checker upon commit. Please see the following section of out contributor guide for information on how to configure pre-commit hooks.

@cjnolet
Copy link
Member

cjnolet commented Apr 24, 2025

/ok to test f4d80ce

@tfeher
Copy link
Contributor

tfeher commented May 25, 2025

/ok to test ca55b77

@cjnolet
Copy link
Member

cjnolet commented May 27, 2025

/ok to test 70e7dad

@cjnolet
Copy link
Member

cjnolet commented May 28, 2025

/ok to test 1f3618e

1 similar comment
@benfred
Copy link
Member

benfred commented May 28, 2025

/ok to test 1f3618e

@@ -18,6 +18,7 @@ include(rapids-export)
include(rapids-find)

option(BUILD_CPU_ONLY "Build CPU only components. Applies to CUVS benchmarks currently" OFF)
option(CUVS_CPU_ONLY_FAISS_ENABLE_SVE "Enable SVE support for CPU ONLY FAISS" OFF)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option is misplaced- we don't build FAISS in the top-level. I think this would be better in get_faiss.cmake

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option is misplaced- we don't build FAISS in the top-level. I think this would be better in get_faiss.cmake

Fixed. Pls double check in the PR.

@LizYou LizYou requested a review from a team as a code owner May 29, 2025 01:33
@cjnolet cjnolet changed the base branch from branch-25.06 to branch-25.08 June 3, 2025 12:28
@cjnolet
Copy link
Member

cjnolet commented Jun 4, 2025

/ok to test ac53eb1

@cjnolet
Copy link
Member

cjnolet commented Jun 12, 2025

/ok to test f52e8e4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake cpp improvement Improves an existing functionality non-breaking Introduces a non-breaking change Python
Projects
Development

Successfully merging this pull request may close these issues.

5 participants