License, Windows and Compatibility Upgrade (redux)#19
Merged
vkrasnov merged 17 commits intocloudflare:gcc.amd64from Feb 26, 2020
rordenlab:gcc.amd64
Merged
License, Windows and Compatibility Upgrade (redux)#19vkrasnov merged 17 commits intocloudflare:gcc.amd64from rordenlab:gcc.amd64
vkrasnov merged 17 commits intocloudflare:gcc.amd64from
rordenlab:gcc.amd64
Conversation
vkrasnov
reviewed
Feb 25, 2020
configure
Outdated
| #include <immintrin.h> | ||
| void foo(void) { | ||
| _mm_clmulepi64_si128(_mm_set1_epi16(1), _mm_set1_epi16(2), 0); | ||
| #include <wmmintrin.h> |
vkrasnov
reviewed
Feb 25, 2020
crc32.c
Outdated
| #ifndef _MSC_VER | ||
| #include <cpuid.h> | ||
| #endif | ||
| //#include <stdio.h> |
vkrasnov
reviewed
Feb 25, 2020
crc32.c
Outdated
| #endif | ||
| if ((ecx & crc_bit_PCLMUL) != 0) | ||
| cpu_has_pclmul = 1; | ||
| //printf("leaf=%d, eax=0x%x, ebx=0x%x, ecx=0x%x, edx=0x%x, cpu_has_pclmul %d\n", leaf, eax, ebx, ecx, edx, cpu_has_pclmul); |
vkrasnov
reviewed
Feb 25, 2020
| #ifndef SKIP_CPUID_CHECK | ||
| if (!has_pclmul()) | ||
| return crc32_generic(crc, buf, len); | ||
| #endif |
There was a problem hiding this comment.
Not aligned with the #ifndef above it
vkrasnov
reviewed
Feb 25, 2020
deflate.c
Outdated
| * allocation. | ||
| */ | ||
| uint64_t ZEXPORT deflateBound(strm, sourceLen) | ||
| uLong ZEXPORT deflateBound(strm, sourceLen) |
Author
|
@vkrasnov thanks for your careful review. I believe my latest commit includes all your suggestions. |
kornelski
approved these changes
Feb 25, 2020
|
@neurolabusc thank you very much for the contribution! |
Merged
fhanau
pushed a commit
to fhanau/zlib
that referenced
this pull request
Feb 27, 2023
Add a "compression context" to CompressionStream and DecompressionStream to make the tracking of the internal state explicit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request responds to feedback to an earlier pull request.
It adds 3 benefits:
I would be excited to see this pull request included, as it can be called from the pigz make. This dramatically accelerates pigz, with the SIMD CRC directly accelerating the serial stage that is most impacted by Amdahl's law.
The first time the CRC is called it set the atomic int cpu_has_pclmul, which reports whether or not the clmul instructions are available. This ensures the program does not crash if compiled on a modern computer and executed on an old computer. I appreciate different people have different views on this, which I summarize below. I do not have a preference, the pull request I am providing is robust (tested on Ubuntu 14.04 as well as recent versions) and simple. The CRC SIMD code and CPUID is only tested for x86-64, but again this extends the current repository. Future developments my consider alternatives:
Other comments
For most cases (where files are large) testing the CPU for CLMUL support on has negligible performance impact. One can conceive of use cases where an statically compiled executable is called many times to compress tiny files. If one is confident the resulting executable is going to be only run on modern (Westmere or later) CPUs, one can compile with the DSKIP_CPUID_CHECK compiler directive to skip this check for cmake the command is "cmake -DSKIP_CPUID_CHECK=ON ..".