Skip to content

Commit

Permalink
Use nvCOMP for ZLIB decompression in ORC reader (#11024)
Browse files Browse the repository at this point in the history
Issue #11023

Adds `DEFLATE` compression type to the nvCOMP adapter.
ORC reader uses the adapter when nvCOMP experimental integrations are enabled (for now). Otherwise behavior is unchanged and the internal implementation is still used.
No tests as no visible behavior change is expected.

Pending: Performance impact

Authors:
  - Vukasin Milovanovic (https://github.com/vuule)

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - David Wendt (https://github.com/davidwendt)
  - Jim Brennan (https://github.com/jbrennan333)
  - Bradley Dice (https://github.com/bdice)

URL: #11024
  • Loading branch information
vuule authored Jun 2, 2022
1 parent 9301235 commit 447028f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
16 changes: 16 additions & 0 deletions cpp/src/io/comp/nvcomp_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
#define NVCOMP_HAS_ZSTD 0
#endif

#define NVCOMP_DEFLATE_HEADER <nvcomp/deflate.h>
#if __has_include(NVCOMP_DEFLATE_HEADER)
#include NVCOMP_DEFLATE_HEADER
#define NVCOMP_HAS_DEFLATE 1
#else
#define NVCOMP_HAS_DEFLATE 0
#endif

namespace cudf::io::nvcomp {

template <typename... Args>
Expand All @@ -40,6 +48,10 @@ auto batched_decompress_get_temp_size(compression_type compression, Args&&... ar
#if NVCOMP_HAS_ZSTD
case compression_type::ZSTD:
return nvcompBatchedZstdDecompressGetTempSize(std::forward<Args>(args)...);
#endif
#if NVCOMP_HAS_DEFLATE
case compression_type::DEFLATE:
return nvcompBatchedDeflateDecompressGetTempSize(std::forward<Args>(args)...);
#endif
default: CUDF_FAIL("Unsupported compression type");
}
Expand All @@ -54,6 +66,10 @@ auto batched_decompress_async(compression_type compression, Args&&... args)
#if NVCOMP_HAS_ZSTD
case compression_type::ZSTD:
return nvcompBatchedZstdDecompressAsync(std::forward<Args>(args)...);
#endif
#if NVCOMP_HAS_DEFLATE
case compression_type::DEFLATE:
return nvcompBatchedDeflateDecompressAsync(std::forward<Args>(args)...);
#endif
default: CUDF_FAIL("Unsupported compression type");
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/io/comp/nvcomp_adapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace cudf::io::nvcomp {

enum class compression_type { SNAPPY, ZSTD };
enum class compression_type { SNAPPY, ZSTD, DEFLATE };

/**
* @brief Device batch decompression of given type.
Expand Down
13 changes: 11 additions & 2 deletions cpp/src/io/orc/reader_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,17 @@ rmm::device_buffer reader::impl::decompress_stripe_data(
device_span<device_span<uint8_t>> inflate_out_view{inflate_out.data(), num_compressed_blocks};
switch (decompressor.compression()) {
case compression_type::ZLIB:
gpuinflate(
inflate_in_view, inflate_out_view, inflate_stats, gzip_header_included::NO, stream);
if (nvcomp_integration::is_all_enabled()) {
nvcomp::batched_decompress(nvcomp::compression_type::DEFLATE,
inflate_in_view,
inflate_out_view,
inflate_stats,
max_uncomp_block_size,
stream);
} else {
gpuinflate(
inflate_in_view, inflate_out_view, inflate_stats, gzip_header_included::NO, stream);
}
break;
case compression_type::SNAPPY:
if (nvcomp_integration::is_stable_enabled()) {
Expand Down

0 comments on commit 447028f

Please sign in to comment.