-
-
Notifications
You must be signed in to change notification settings - Fork 69
BLD: Add MSVC build support on windows #220
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
r-devulap
wants to merge
10
commits into
numpy:main
Choose a base branch
from
r-devulap:msvc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8e532fe
Add MSVC build support on windows
r-devulap 15e6023
CI: use one ASAN build and run it without SDE to improve speed
r-devulap 7264a84
clang-format
r-devulap ce6c288
Simplify compiler checks
r-devulap 4dc9609
Add avx512 fp16 header file when build with MSVC
r-devulap c1994cc
CI: add windows msvc build
r-devulap 1be8ef6
Use XSS_EXPORT_SYMBOL on all template specializations
r-devulap 4e209f1
Replace intel-ubuntu-24.04 with ubuntu-24.04
r-devulap 3c007d7
Fix CI numpy runs
r-devulap 4cb589e
Add checks for xsave and _xgetbv in cpuid checks
r-devulap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef X86SIMDSORT_CPUID_H | ||
#define X86SIMDSORT_CPUID_H | ||
|
||
#ifdef _MSC_VER | ||
#include <intrin.h> | ||
#include <string> | ||
#include <unordered_map> | ||
|
||
static std::unordered_map<std::string, bool> xss_cpu_features; | ||
|
||
inline void xss_cpu_init() | ||
{ | ||
int cpuInfo[4] = {0}; | ||
// Check AVX2 | ||
__cpuid(cpuInfo, 0); | ||
int nIds = cpuInfo[0]; | ||
__cpuid(cpuInfo, 1); | ||
bool osxsave = (cpuInfo[2] & (1 << 27)) != 0; | ||
bool avx = (cpuInfo[2] & (1 << 28)) != 0; | ||
r-devulap marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
__cpuid(cpuInfo, 7); | ||
bool avx2 = (cpuInfo[1] & (1 << 5)) != 0; | ||
bool avx512f = (cpuInfo[1] & (1 << 16)) != 0; | ||
bool avx512dq = (cpuInfo[1] & (1 << 17)) != 0; | ||
bool avx512bw = (cpuInfo[1] & (1 << 30)) != 0; | ||
bool avx512vl = (cpuInfo[1] & (1 << 31)) != 0; | ||
bool avx512vbmi2 = (cpuInfo[2] & (1 << 6)) != 0; | ||
bool avx512fp16 = (cpuInfo[3] & (1 << 23)) != 0; | ||
// Store results | ||
xss_cpu_features["avx2"] = avx2; | ||
xss_cpu_features["avx512f"] = avx512f; | ||
xss_cpu_features["avx512dq"] = avx512dq; | ||
xss_cpu_features["avx512bw"] = avx512bw; | ||
xss_cpu_features["avx512vl"] = avx512vl; | ||
xss_cpu_features["avx512vbmi2"] = avx512vbmi2; | ||
xss_cpu_features["avx512fp16"] = avx512fp16; | ||
} | ||
|
||
inline bool xss_cpu_supports(const char *feature) | ||
{ | ||
auto it = xss_cpu_features.find(feature); | ||
return it != xss_cpu_features.end() && it->second; | ||
} | ||
|
||
#else | ||
#define xss_cpu_init() __builtin_cpu_init() | ||
#define xss_cpu_supports(feature) __builtin_cpu_supports(feature) | ||
#endif // _MSC_VER | ||
#endif // X86SIMDSORT_CPUID_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.