Skip to content

Commit

Permalink
Add -march=native in clang compile flags to enable auto-vectorization
Browse files Browse the repository at this point in the history
    Tested on Macbook Pro with 2.4 GHz Intel Core i9, Clang 15

    Output of objdump on bench_cpp when these flags are present:

    postgres@4832feb5168c:/lantern_shared/third_party/usearch/build_release$
    objdump -d ./bench_cpp | grep vzero | head
       1cad3:       c5 f8 77                vzeroupper
       1cb1e:       c5 f8 77                vzeroupper
       ...

    grep output is empty when the flags are not present
  • Loading branch information
Ngalstyan4 committed May 13, 2024
1 parent 37b47b0 commit cf0fff3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ function (setup_target TARGET_NAME)
-fPIC
-pedantic
-Wfatal-errors
-march=native
-ftree-vectorize
# Don't complain if the for-loops were not vectorzied
-Wpass-failed=transform-warning
-fcolor-diagnostics
Expand Down

0 comments on commit cf0fff3

Please sign in to comment.