Skip to content

Conversation

@subhadeepkaran
Copy link

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

@meta-cla meta-cla bot added the CLA Signed label Aug 26, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D72937710

subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 26, 2025
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D72937710

subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 26, 2025
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
subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 26, 2025
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D72937710

subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 26, 2025
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
#endif // __x86_64__

std::pair<bool, std::vector<int>> try_execute(std::vector<int> (*func)()) {
signal(SIGILL, sigill_handler);
Copy link
Contributor

Choose a reason for hiding this comment

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

this is linux-specific

subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 26, 2025
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D72937710

subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 26, 2025
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D72937710

subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 26, 2025
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D72937710

subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 26, 2025
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D72937710

subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 26, 2025
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D72937710

subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 26, 2025
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D72937710

supported_simd_levels().clear();
supported_simd_levels().insert(matched_level.value());
} else {
fprintf(stderr,
Copy link
Contributor

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("");
Copy link
Contributor

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))
Copy link
Contributor

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:
Copy link
Contributor

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:
Copy link
Contributor

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") {
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

What is COUNT exactly? :)

subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 27, 2025
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
subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 27, 2025
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D72937710

subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 27, 2025
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
subhadeepkaran pushed a commit to subhadeepkaran/faiss that referenced this pull request Aug 28, 2025
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:
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D72937710

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants