codekingpro/portable-devtools
114k
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES.
3 * All rights reserved. SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11*/
12
13#pragma once
14
15#include "nvcompManager.hpp"
16#include "formatSpec.hpp"
17#include "zstd.h"
18
19namespace nvcomp {
20
21/**
22 * @brief High-level interface class for the Zstd compressor.
23 *
24 * @note uncomp_chunk_size must be <= nvcompZstdCompressionMaxAllowedChunkSize.
25 * Use 64-128 KB for best performance.
26 *
27 * @note If user_stream is specified, the lifetime of the ZstdManager instance must not
28 * extend beyond that of the user_stream.
29 */
30struct ZstdManager : detail::PimplManager {
31 /**
32 * @brief Constructor of ZstdManager.
33 *
34 * @param[in] uncomp_chunk_size Internal chunk size used to partition the input data.
35 * @param[in] compress_opts Compression options to use.
36 * @param[in] decompress_opts Decompression options to use.
37 * @param[in] user_stream The CUDA stream to operate on.
38 * @param[in] checksum_policy The checksum policy to use during compression and decompression.
39 * @param[in] bitstream_kind Setting to configure how the manager compresses the input.
40 */
41 NVCOMP_EXPORT
42 ZstdManager(
43 size_t uncomp_chunk_size,
44 const nvcompBatchedZstdCompressOpts_t& compress_opts = nvcompBatchedZstdCompressDefaultOpts,
45 const nvcompBatchedZstdDecompressOpts_t& decompress_opts = nvcompBatchedZstdDecompressDefaultOpts,
46 cudaStream_t user_stream = 0,
47 ChecksumPolicy checksum_policy = NoComputeNoVerify,
48 BitstreamKind bitstream_kind = BitstreamKind::NVCOMP_NATIVE);
49
50 /**
51 * @brief Destructor of ZstdManager.
52 */
53 NVCOMP_EXPORT
54 ~ZstdManager() noexcept;
55};
56
57} // namespace nvcomp
58 