-
Notifications
You must be signed in to change notification settings - Fork 4.1k
SIMDConfig object + SIMD detections #4552
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
base: main
Are you sure you want to change the base?
SIMDConfig object + SIMD detections #4552
Conversation
|
This pull request was exported from Phabricator. Differential Revision: D72937710 |
Summary: Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
6b9c311 to
39d1361
Compare
|
This pull request was exported from Phabricator. Differential Revision: D72937710 |
39d1361 to
d53fa20
Compare
Summary: Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
Summary: Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
|
This pull request was exported from Phabricator. Differential Revision: D72937710 |
Summary: Pull Request resolved: facebookresearch#4552 Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
d53fa20 to
083b075
Compare
| #endif // __x86_64__ | ||
|
|
||
| std::pair<bool, std::vector<int>> try_execute(std::vector<int> (*func)()) { | ||
| signal(SIGILL, sigill_handler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is linux-specific
Summary: Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
083b075 to
038db06
Compare
|
This pull request was exported from Phabricator. Differential Revision: D72937710 |
Summary: Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
038db06 to
1e36e43
Compare
|
This pull request was exported from Phabricator. Differential Revision: D72937710 |
Summary: Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
1e36e43 to
ae093b1
Compare
|
This pull request was exported from Phabricator. Differential Revision: D72937710 |
Summary: Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
ae093b1 to
5c8261d
Compare
|
This pull request was exported from Phabricator. Differential Revision: D72937710 |
Summary: Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
5c8261d to
a0a3657
Compare
|
This pull request was exported from Phabricator. Differential Revision: D72937710 |
Summary: Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
a0a3657 to
c440da1
Compare
|
This pull request was exported from Phabricator. Differential Revision: D72937710 |
| supported_simd_levels().clear(); | ||
| supported_simd_levels().insert(matched_level.value()); | ||
| } else { | ||
| fprintf(stderr, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that a better reaction would be to issue a warning rather than terminate a program
| } | ||
|
|
||
| std::string SIMDConfig::get_level_name() { | ||
| return to_string(level).value_or(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return to_string(level).value_or("unknown"); ?
| SIMDLevel level = SIMDLevel::NONE; | ||
|
|
||
| #if defined(__x86_64__) && \ | ||
| (defined(COMPILE_SIMD_AVX2) || defined(COMPILE_SIMD_AVX512)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic must be separated. A CPU-capability detection facility must detect all CPU features. And then following code must decide SIMDLevel to use, based on possible #pragma definitions.
| return "AVX2"; | ||
| case SIMDLevel::AVX512: | ||
| return "AVX512"; | ||
| case SIMDLevel::ARM_NEON: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AVX512 for Sapphire Rapids (AVX512_SPR or similar) ?
| return "AVX512"; | ||
| case SIMDLevel::ARM_NEON: | ||
| return "ARM_NEON"; | ||
| default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, I've seen the code for ARM SVE somewhere in Faiss, maybe, in incoming PRs
| } | ||
|
|
||
| std::optional<SIMDLevel> to_simd_level(const std::string& level_str) { | ||
| if (level_str == "NONE") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::toupper() must be used
| // arm & aarch64 | ||
| ARM_NEON, | ||
|
|
||
| COUNT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any other platforms?
| // arm & aarch64 | ||
| ARM_NEON, | ||
|
|
||
| COUNT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is COUNT exactly? :)
c440da1 to
ec40e4d
Compare
Summary: Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
Summary: Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
|
This pull request was exported from Phabricator. Differential Revision: D72937710 |
Summary: Pull Request resolved: facebookresearch#4552 Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
ec40e4d to
4e08a32
Compare
Summary: Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
4e08a32 to
09ccb86
Compare
Summary: Pull Request resolved: facebookresearch#4552 Implementation of: - `SIMDLevel` that can be used as a template parameter to differentiate implementations - `SIMDConfig` object that defines what is the enabled SIMDLevel in the TARGETS all SIMD code is disabled by default. Reviewed By: mnorris11 Differential Revision: D72937710
|
This pull request was exported from Phabricator. Differential Revision: D72937710 |
09ccb86 to
8134c8f
Compare
Summary:
Implementation of:
SIMDLevelthat can be used as a template parameter to differentiate implementationsSIMDConfigobject that defines what is the enabled SIMDLevelin the TARGETS all SIMD code is disabled by default.
Reviewed By: mnorris11
Differential Revision: D72937710