vcpkg icon indicating copy to clipboard operation
vcpkg copied to clipboard

[snappy] Add feature BMI2 and SSSE3

Open Osyotr opened this issue 2 years ago • 4 comments

Fixes #14520 Continuation of #25574

Osyotr avatar Sep 16 '22 10:09 Osyotr

you might want to fix https://github.com/google/snappy/blob/af720f9a3b2c831f173b6074961737516f2d3a46/CMakeLists.txt#L113-L115 instead

Neumann-A avatar Sep 16 '22 10:09 Neumann-A

you might want to fix https://github.com/google/snappy/blob/af720f9a3b2c831f173b6074961737516f2d3a46/CMakeLists.txt#L113-L115 instead

These variables are used only when SNAPPY_BUILD_TESTS is enabled, no action needed.

Osyotr avatar Sep 16 '22 10:09 Osyotr

These variables are used only when SNAPPY_BUILD_TESTS is enabled, no action needed.

Ok was wondering why nobody noticed that yet ;)

Neumann-A avatar Sep 16 '22 10:09 Neumann-A

Also this is a problem for MSVC since it allows compiling intrinsics without the required flags. clang-cl will fail the check_cxx_source_compiles check without the required flags.

Neumann-A avatar Sep 16 '22 10:09 Neumann-A

Ping @Osyotr for response. Could you please resolve the conflicts?

LilyWangLL avatar Oct 14 '22 07:10 LilyWangLL

I believe this is tagged vcpkg-team-review because we aren't sure if we want to dig the 'features used to control CPU features' hole deeper. We didn't have time to discuss this week but we'll probably do so next week.

BillyONeal avatar Jan 27 '23 02:01 BillyONeal

Another 'features used to control CPU features' https://github.com/microsoft/vcpkg/pull/29093

BillyONeal avatar Jan 27 '23 04:01 BillyONeal

If you don't like these options being features, let's disable them by default. Leaving these options enabled breaks binarycaching.

Osyotr avatar Jul 05 '23 15:07 Osyotr

The vcpkg maintainers discussed this on Thursday. We would be happy with the following path forward:

  • The BMI2 and SSSE3 behaviors are off by default.
  • The port snappy looks for SNAPPY_BMI2' and 'SNAPPY_SSSE3' variables to be set before portfile.cmake` starts running. These variables are intended to be set by the triplet. This goes for all other similar CPU feature tests in the future ('PORTNAME_CPUTHING') and allows a way for progress to be made here.

Note that while we have become less happy with 'half measures' like this over time, we don't expect to make meaningful progress on defining what the 'total matrix of triplet variables to control all the CPU things' is going to look like over time. Moreover, this path does not close the door on introducing a hypothetical VCPKG_BMI2 or similar triplet variable should we choose to add something like that in the future, as a new version of the port could look for either a port-specific setting or a vcpkg-wide setting, if applicable.

We are still in agreement that port features should not be used to control CPU features as there is no way to require that a feature is off.

BillyONeal avatar Jul 26 '23 01:07 BillyONeal

The port snappy looks for SNAPPY_BMI2' and 'SNAPPY_SSSE3' variables to be set before portfile.cmake` starts running. These variables are intended to be set by the triplet. This goes for all other similar CPU feature tests in the future ('PORTNAME_CPUTHING') and allows a way for progress to be made here.

I don't think it's worth introducing additional variables when we already have VCPKG_CMAKE_CONFIGURE_OPTIONS. I've added usage file with an example. Tested with the official and my custom triplets.

Osyotr avatar Jul 26 '23 13:07 Osyotr

That resolution is even better, thanks!

BillyONeal avatar Jul 27 '23 02:07 BillyONeal