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

MSVC instruction detection (fixed up #809) #3923

Merged
merged 15 commits into from
Nov 5, 2023
Merged

MSVC instruction detection (fixed up #809) #3923

merged 15 commits into from
Nov 5, 2023

Conversation

netrunnereve
Copy link
Contributor

@netrunnereve netrunnereve commented Nov 3, 2023

I got annoyed by #3906, so I took @howard0su's #809 and cleaned it up for submission. Note that this is for MSVC only and is ignored on Linux (Linux has -march=native anyways). If you want to try this on Linux grab 5c5281b which is what I used for testing purposes.

I'm keeping this as a draft until someone with MSVC and AVX-512 actually confirms that this works! I have no Windows and no AVX-512.

@ggerganov ggerganov linked an issue Nov 3, 2023 that may be closed by this pull request
@cebtenzzre
Copy link
Collaborator

This does correctly detect AVX, AVX2, and FMA on my CPU with MSVC. I do not have AVX-512 either.

@netrunnereve netrunnereve marked this pull request as ready for review November 4, 2023 20:32
@netrunnereve
Copy link
Contributor Author

Tested successfully on a Windows AVX-512 machine (Github CI has them).

Processor(s):              1 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 85 Stepping 7 GenuineIntel ~2594 Mhz
-- x86 detected
-- Performing Test HAS_AVX_1
-- Performing Test HAS_AVX_1 - Success
-- Performing Test HAS_AVX2_1
-- Performing Test HAS_AVX2_1 - Success
-- Performing Test HAS_FMA_1
-- Performing Test HAS_FMA_1 - Success
-- Performing Test HAS_AVX512_1
-- Performing Test HAS_AVX512_1 - Success

@ggerganov ggerganov merged commit c41ea36 into ggerganov:master Nov 5, 2023
32 checks passed
@netrunnereve netrunnereve deleted the instruction_detection branch November 5, 2023 16:44
olexiyb pushed a commit to Sanctum-AI/llama.cpp that referenced this pull request Nov 23, 2023
…v#3923)

* Add detection code for avx

* Only check hardware when option is ON

* Modify per code review sugguestions

* Build locally will detect CPU

* Fixes CMake style to use lowercase like everywhere else

* cleanup

* fix merge

* linux/gcc version for testing

* msvc combines avx2 and fma into /arch:AVX2 so check for both

* cleanup

* msvc only version

* style

* Update FindSIMD.cmake

---------

Co-authored-by: Howard Su <howard0su@gmail.com>
Co-authored-by: Jeremy Dunn <jeremydunn123@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

llama : build with AVX support on Windows by default with CMake
5 participants