highway icon indicating copy to clipboard operation
highway copied to clipboard

Query about sandybridge with AES instruction from AVX2

Open Jamaika1 opened this issue 2 years ago • 1 comments

Will adding an AES instruction to get sse4 damage the CPU sandybridge? Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set support.

Jamaika1 avatar Aug 06 '22 16:08 Jamaika1

Hi @Jamaika1 , Highway's SSE4 target requires AES. This means your CPU can (and will automatically) only use the HWY_SSSE3 target, which is somewhat slower than SSE4.

If you want SSE4 and are sure that the software does not use AES (e.g. the AESRound() intrinsic - JPEG XL currently does not), you could consider changing in targets.cc constexpr uint64_t kGroupSSE4 = Bit(FeatureIndex::kSSE41) | Bit(FeatureIndex::kSSE42) | Bit(FeatureIndex::kCLMUL) | Bit(FeatureIndex::kAES) | kGroupSSSE3; to constexpr uint64_t kGroupSSE4 = Bit(FeatureIndex::kSSE41) | Bit(FeatureIndex::kSSE42) | Bit(FeatureIndex::kCLMUL) | kGroupSSSE3;

The worst that can happen is that software using AES will then crash with SIGILL, but I do not see how that could damage the CPU.

jan-wassenberg avatar Aug 08 '22 07:08 jan-wassenberg

Please feel free to reopen if any action is required here :)

jan-wassenberg avatar Aug 17 '22 08:08 jan-wassenberg