[MDEV-22749] Implement portable PCLMUL accelerated crc32() with Intel intrinsics Created: 2020-05-29 Updated: 2021-04-13 Resolved: 2020-09-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | mariabackup, Server |
| Affects Version/s: | 10.1, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.5.7 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Vladislav Vaintroub |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | performance | ||
| Environment: |
cross-platform, gcc, clang, msvc, amd64 |
||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
The pclmul acceleration for the zlib crc32() function that was cleaned up in |
| Comments |
| Comment by Marko Mäkelä [ 2020-08-27 ] | |||||||||||||||||||||||||||||||
|
I would prefer to see something like this in the implementation. The approach was demonstrated in
For GCC 4 (the oldest that we currently support is 4.8.2), some extra hoops are needed to replace the broken #include header:
I would find it risky to compile the entire compilation unit with something that enables many SIMD features that may not be available on the least common denominator (SSE2 for AMD64; Intel 80486 or possibly something newer for IA-32). We do not want the compiler to accidentally enable some exotic instructions for any ‘glue’ code that is supposed to run anywhere. | |||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2020-09-04 ] | |||||||||||||||||||||||||||||||
|
I do not see why anew feature and a workaround for the said feature will help code to be better. It only adds more code, we will need compiler options for clang-cl, and there are already compiler options for ARM etc. So, if anything, I would prefer not to add both attributes and GCC intrinsics for the broken attributes, to reduce complexity, and increase portability. I can't imagine that compiler will accidentially add pclmul in cpuid test (crc32_pclmul_enabled), which is single function in question in this particular compilation unit |