Commit Graph
10352 Commits
Author SHA1 Message Date
Yann ColletandGitHub 7cf62bc274 Merge pull request #3849 from facebook/dependabot/github_actions/actions/upload-artifact-4.0.0
Bump actions/upload-artifact from 3.1.3 to 4.0.0
2023-12-18 09:49:57 -08:00
Yann ColletandGitHub 377ecefce9 Update windows-artifacts.yml
and fixed version number in comment
2023-12-18 09:39:42 -08:00
dependabot[bot]andGitHub e515327764 Bump actions/upload-artifact from 3.1.3 to 4.0.0
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.3 to 4.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/a8a3f3ad30e3422c9c7b888a15615d19a852ae32...c7d193f32edcb7bfad88892161225aeda64e9392)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 05:26:39 +00:00
Yann ColletandGitHub 86ead9f4a4 Merge pull request #3845 from emaste/dev
Update FreeBSD CI: drop 12.4 (nearly EOL)
2023-12-13 23:54:41 -08:00
Ed Maste 20f8df6440 Update FreeBSD CI: drop 12.4 as it is nearly EOL
12.4 is EOL as of the end of December 2023, and pkg installation will
start failing some time after that so remove those jobs now.
2023-12-13 19:10:43 -05:00
Elliot GorokhovskyandGitHub 126ec2669c Merge pull request #3839 from embg/offload_refactor
Move offload API params into ZSTD_CCtx_params
2023-11-28 20:04:08 -05:00
Elliot Gorokhovsky d151a4880b Move offload API params into ZSTD_CCtx_params 2023-11-27 08:11:01 -08:00
Elliot Gorokhovsky 809c7eb6bf Refactor ZSTD_sequenceProducer_F typedef to ZSTD_sequenceProducer_F* 2023-11-27 06:56:37 -08:00
elasotaandNick Terrell 05059e5a48 Clarify that there must be at least 2 weights, i.e. encoding all weights as 0 is invalid 2023-11-24 16:49:40 -05:00
elasotaandNick Terrell dc84e35138 Clarify that the presence of a value with weight 1 is required 2023-11-24 16:49:40 -05:00
Nick TerrellandNick Terrell 8193250615 Modernize macros to use do { } while (0)
This PR introduces no functional changes. It attempts to change all
macros currently using `{ }` or some variant of that to to
`do { } while (0)`, and introduces trailing `;` where necessary.
There were no bugs found during this migration.

The bug in Visual Studios warning on this has been fixed since VS2015.
Additionally, we have several instances of `do { } while (0)` which have
been present for several releases, so we don't have to worry about
breaking peoples builds.

Fixes Issue #3830.
2023-11-21 20:05:17 -05:00
Yann ColletandGitHub 6b3d12fe54 Merge pull request #3820 from facebook/xxh082
update xxhash library to v0.8.2
2023-11-21 09:11:40 -08:00
Nick TerrellandNick Terrell dd4de1dd7a [huf] Fix null pointer addition
`HUF_DecompressFastArgs_init()` was adding 0 to NULL. Fix it by exiting
early for empty outputs. This is no change in behavior, because the
function was already exiting 0 in this case, just slightly later.
2023-11-20 17:13:01 -05:00
Nick TerrellandNick Terrell 5ab78c0418 [huf] Improve fast C & ASM performance on small data
* Rename `ilimit` to `ilowest` and set it equal to `src` instead of
  `src + 6 + 8`. This is safe because the fast decoding loops guarantee
  to never read below `ilowest` already. This allows the fast decoder to
  run for at least two more iterations, because it consumes at most 7
  bytes per iteration.
* Continue the fast loop all the way until the number of safe iterations
 is 0. Initially, I thought that when it got towards the end, the
 computation of how many iterations of safe might become expensive. But
 it ends up being slower to have to decode each of the 4 streams
 individually, which makes sense.

This drastically speeds up the Huffman decoder on the `github` dataset
for the issue raised in #3762, measured with `zstd -b1e1r github/`.

| Decoder  | Speed before | Speed after |
|----------|--------------|-------------|
| Fallback | 477 MB/s     | 477 MB/s    |
| Fast C   | 384 MB/s     | 492 MB/s    |
| Assembly | 385 MB/s     | 501 MB/s    |

We can also look at the speed delta for different block sizes of silesia
using `zstd -b1e1r silesia.tar -B#`.

| Decoder  | -B1K ∆ | -B2K ∆ | -B4K ∆ | -B8K ∆ | -B16K ∆ | -B32K ∆ | -B64K ∆ | -B128K ∆ |
|----------|--------|--------|--------|--------|---------|---------|---------|----------|
| Fast C   | +11.2% | +8.2%  | +6.1%  | +4.4%  | +2.7%   | +1.5%   | +0.6%   | +0.2%    |
| Assembly | +12.5% | +9.0%  | +6.2%  | +3.6%  | +1.5%   | +0.7%   | +0.2%   | +0.03%   |
2023-11-20 17:13:01 -05:00
Nick TerrellandNick Terrell c7269add7e [huf] Improve fast huffman decoding speed in linux kernel
gcc in the linux kernel was not unrolling the inner loops of the Huffman
decoder, which was destroying decoding performance. The compiler was
generating crazy code with all sorts of branches. I suspect because of
Spectre mitigations, but I'm not certain. Once the loops were manually
unrolled, performance was restored.

Additionally, when gcc couldn't prove that the variable left shift in
the 4X2 decode loop wasn't greater than 63, it inserted checks to verify
it. To fix this, mask `entry.nbBits & 0x3F`, which allows gcc to eliete
this check. This is a no op, because `entry.nbBits` is guaranteed to be
less than 64.

Lastly, introduce the `HUF_DISABLE_FAST_DECODE` macro to disable the
fast C loops for Issue #3762. So if even after this change, there is a
performance regression, users can opt-out at compile time.
2023-11-20 14:56:46 -05:00
Nick TerrellandNick Terrell e122fcbf58 [debug] Don't define g_debuglevel in the kernel
We only use this constant when `DEBUGLEVEL>=2`, but we get
-Werror=pedantic errors for empty translation units, so still define it
except in kernel environments.

Backport from the kernel:

https://lore.kernel.org/lkml/20230616144400.172683-1-ben.dooks@codethink.co.uk/
2023-11-17 09:54:10 -08:00
Nick TerrellandNick Terrell c2d470581e [linux] Remove usage of deprecated function
ZSTD_resetDStream() is deprecated and replaced by ZSTD_DCtx_reset().
This removes deprecation warnings from the kernel build.

This change is a no-op, see the docs suggesting this replacement.

https://github.com/facebook/zstd/blob/fcbf2fde9ac7ce1562c7b3a394350e764bcb580f/lib/zstd.h#L2655-L2663
2023-11-17 09:54:10 -08:00
Nick TerrellandNick Terrell a419265d30 [linux] Backport intptr_t removal
Linux started providing intptr_t in <linux/types.h> so we no longer need
to define it here.

https://lkml.kernel.org/r/ed66b9e4-1fb7-45be-9bb9-d4bc291c691f@p183
2023-11-17 09:54:10 -08:00
Yann Collet 59dcc47579 update license text 2023-11-16 16:19:25 -08:00
Yann ColletandGitHub fcbf2fde9a Merge pull request #3807 from gruenich/increase_minimum_cmake_version_3.5
[cmake] Require CMake version 3.5 or newer
2023-11-14 10:48:11 -08:00
Yann Collet 3fd5f9f52d fix the copyright linter 2023-11-13 15:50:42 -08:00
Yann Collet 592b1acb18 update xxhash to v0.8.2
List of updates : https://github.com/Cyan4973/xxHash/releases/tag/v0.8.2

This is also a preparation task before taking care of #3819
2023-11-13 15:42:07 -08:00
Yann ColletandGitHub e19fe535f4 Merge pull request #3813 from elasota/overflow-clarification
Clarify that a stream containing too many Huffman weights is invalid
2023-11-13 00:03:42 -08:00
Yann ColletandGitHub 83adaecf41 Merge pull request #3812 from jondo2010/bazel_build_doc
Add Bazel module instructions to README.md
2023-11-13 00:03:10 -08:00
elasota e61e3ff152 Clarify that decoding too many Huffman weights is a failure condition 2023-11-08 20:06:58 -05:00
John Hughes 98d8ad27a2 Add Bazel module instructions to README.md 2023-11-08 09:08:21 +00:00
Christoph Grüninger f013b1b504 [cmake] Remove code for compatibility with CMake < 3.0
The required version of CMake is now 3.5.
2023-11-01 20:46:47 +01:00
Yann ColletandGitHub 1518570c62 Merge pull request #3806 from elasota/fmt-clarifications
Correct FSE probability bit consumption in specification
2023-11-01 10:59:54 -07:00
Christoph Grüninger 4502ca5f42 [cmake] Require CMake version 3.5 or newer
More recent versions of CMake emit the following warning:
CMake Deprecation Warning at cmake/CMakeLists.txt:10 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
2023-10-31 23:30:43 +01:00
Yann ColletandGitHub fabce2a61c Merge pull request #3800 from facebook/dependabot/github_actions/actions/checkout-4.1.1
Bump actions/checkout from 4.1.0 to 4.1.1
2023-10-31 09:23:47 -07:00
Yann ColletandGitHub 81fdca0012 Merge pull request #3795 from Saverio976/doc/cmake-fetch-content
Add doc on how to use it with cmake FetchContent
2023-10-31 09:23:28 -07:00
elasota 324cce4996 Add definition of "log2sup" function 2023-10-31 11:45:10 -04:00
elasota b38d87b476 Clarify that the log2 of the largest possible symbol is the maximum number of bits consumed 2023-10-31 01:17:23 -04:00
Xavier Mitault 3c3845b9d8 Add target_include_directories because windows and macos need it for me 2023-10-23 17:38:09 +02:00
dependabot[bot]andGitHub af971cec65 Bump actions/checkout from 4.1.0 to 4.1.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/8ade135a41bc03ea155e62e844d188df1ea18608...b4ffde65f46336ab88eb53be808477a3936bae11)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-23 05:56:05 +00:00
Yann ColletandGitHub 7567769a7e Merge pull request #3789 from facebook/fix_flexArray_fse
solving flexArray issue #3785 in fse
2023-10-20 12:40:13 -07:00
Yann Collet 24dabde507 revert to manually defining DTable
thus avoiding the analyzer and ubsan to associate DTable to a size of 1.
2023-10-18 22:45:57 -07:00
Yann Collet d988e00a7f baby-step towards solving flexArray issue #3785
the flexArray in structure FSE_DecompressWksp
is just a way to derive a pointer easily,
without risk/complexity of calculating it manually.

Not sure if this change is good enough to avoid ubsan warnings though.
2023-10-18 16:21:39 -07:00
Xavier Mitault e590c8a0e3 Add doc on how to use it with cmake FetchContent 2023-10-18 13:22:15 +02:00
Yann ColletandGitHub 69036dffe5 Merge pull request #3786 from facebook/fix_flexarray_cctx
Remove FlexArray pattern from ZSTDMT
2023-10-13 09:08:20 -07:00
Yann Collet 6bb1688c1a extended the fix to ZSTDMT's Buffer Pool 2023-10-08 00:25:17 -07:00
Yann Collet ea4027c003 removed unused macro constant 2023-10-07 23:32:22 -07:00
Yann Collet c87ad5bdb5 fixes suggested by @ebiggers 2023-10-07 23:29:42 -07:00
Yann Collet e8ff7d18eb removed FlexArray pattern from CCtxPool
within ZSTDMT_.
This pattern is flagged by less forgiving variants of ubsan
notably used during compilation of the Linux Kernel.

There are 2 other places in the code where this pattern is used.
This fixes just one of them.
2023-10-07 21:30:08 -07:00
Yann ColletandGitHub c692b8d12d Merge pull request #3752 from paulmenzel/fix-pzstd-makefile
Fix pzstd Makefile to allow setting `DESTDIR` and `BINDIR` separately
2023-10-07 19:32:22 -07:00
Yann ColletandGitHub 2b31cb0698 Merge pull request #3763 from dloidolt/fix_lib/README.md
Fix a very small formatting typo in the lib/README.md file
2023-10-07 19:31:36 -07:00
Yann ColletandGitHub 19317239ec Merge pull request #3772 from DimitriPapadopoulos/WIN32
Do not test WIN32, instead test _WIN32
2023-10-07 19:30:18 -07:00
Yann ColletandGitHub c1e588fcb4 Merge pull request #3771 from DimitriPapadopoulos/codespell
Fix new typos found by codespell
2023-10-07 19:29:41 -07:00
Yann ColletandGitHub 0e2cfebb63 Merge pull request #3777 from facebook/fix_x32
fix x32 tests on Github CI
2023-10-02 16:25:43 -07:00
Nick TerrellandNick Terrell 43118da8a7 Stop suppressing pointer-overflow UBSAN errors
* Remove all pointer-overflow suppressions from our UBSAN builds/tests.
* Add `ZSTD_ALLOW_POINTER_OVERFLOW_ATTR` macro to suppress
  pointer-overflow at a per-function level. This is a superior approach
  because it also applies to users who build zstd with UBSAN.
* Add `ZSTD_wrappedPtr{Diff,Add,Sub}()` that use these suppressions.
  The end goal is to only tag these functions with
  `ZSTD_ALLOW_POINTER_OVERFLOW`. But we can start by annoting functions
  that rely on pointer overflow, and gradually transition to using
  these.
* Add `ZSTD_maybeNullPtrAdd()` to simplify pointer addition when the
  pointer may be `NULL`.
* Fix all the fuzzer issues that came up. I'm sure there will be a lot
  more, but these are the ones that came up within a few minutes of
  running the fuzzers, and while running GitHub CI.
2023-09-28 17:35:05 -04:00