Skip to content

Commit

Permalink
fix naming
Browse files Browse the repository at this point in the history
  • Loading branch information
vuule committed Nov 5, 2021
1 parent 41a6b03 commit 03bc828
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cpp/src/io/orc/reader_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ rmm::device_buffer reader::impl::decompress_stripe_data(
gpuinflate(inflate_in.data(), inflate_out.data(), num_compressed_blocks, 0, stream));
break;
case orc::SNAPPY:
if (nvcomp_integration::is_stable_integration_enabled()) {
if (nvcomp_integration::is_stable_enabled()) {
device_span<gpu_inflate_input_s> inflate_in_view{inflate_in.data(),
num_compressed_blocks};
device_span<gpu_inflate_status_s> inflate_out_view{inflate_out.data(),
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/io/orc/stripe_enc.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ void CompressOrcDataStreams(uint8_t* compressed_data,
gpuInitCompressionBlocks<<<dim_grid, dim_block_init, 0, stream.value()>>>(
strm_desc, enc_streams, comp_in, comp_out, compressed_data, comp_blk_size, max_comp_blk_size);
if (compression == SNAPPY) {
if (detail::nvcomp_integration::is_stable_integration_enabled()) {
if (detail::nvcomp_integration::is_stable_enabled()) {
try {
size_t temp_size;
nvcompStatus_t nvcomp_status = nvcompBatchedSnappyCompressGetTempSize(
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/io/parquet/reader_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ rmm::device_buffer reader::impl::decompress_page_data(
stream))
break;
case parquet::SNAPPY:
if (nvcomp_integration::is_stable_integration_enabled()) {
if (nvcomp_integration::is_stable_enabled()) {
snappy_decompress(inflate_in_view.subspan(start_pos, argc - start_pos),
inflate_out_view.subspan(start_pos, argc - start_pos),
codec.max_decompressed_size,
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/io/parquet/writer_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ void writer::impl::encode_pages(hostdevice_2dvector<gpu::EncColumnChunk>& chunks
gpu::EncodePages(batch_pages, comp_in, comp_stat, stream);
switch (compression_) {
case parquet::Compression::SNAPPY:
if (nvcomp_integration::is_stable_integration_enabled()) {
if (nvcomp_integration::is_stable_enabled()) {
snappy_compress(comp_in, comp_stat, max_page_uncomp_data_size, stream);
} else {
CUDA_TRY(gpu_snap(comp_in.data(), comp_stat.data(), pages_in_batch, stream));
Expand Down
18 changes: 8 additions & 10 deletions cpp/src/io/utilities/config_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,31 @@ namespace {
/**
* @brief Defines which nvCOMP usage to enable.
*/
enum class usage_policy : uint8_t { NONE, STABLE, EXPERIMENTAL };
enum class usage_policy : uint8_t { OFF, STABLE, ALWAYS };

/**
* @brief Get the current usage policy.
*/
inline usage_policy get_env_policy()
{
static auto const env_val = getenv_or("LIBCUDF_NVCOMP_POLICY", "STABLE");
if (env_val == "NONE") return usage_policy::NONE;
if (env_val == "EXPERIMENTAL") return usage_policy::EXPERIMENTAL;
if (env_val == "OFF") return usage_policy::OFF;
if (env_val == "ALWAYS") return usage_policy::ALWAYS;
return usage_policy::STABLE;
}
} // namespace

/**
* @brief Returns true if stable nvCOMP use is enabled.
* @brief Returns true if all nvCOMP uses are enabled.
*/
inline bool is_stable_integration_enabled() { return get_env_policy() == usage_policy::STABLE; }
inline bool is_all_enabled() { return get_env_policy() == usage_policy::ALWAYS; }

/**
* @brief Returns true if experimental nvCOMP use is enabled.
*
* Note: When experimental use is enabled, stable use is enabled as well
* @brief Returns true if stable nvCOMP use is enabled.
*/
inline bool is_experimental_integration_enabled()
inline bool is_stable_enabled()
{
return is_stable_integration_enabled() or get_env_policy() == usage_policy::EXPERIMENTAL;
return is_all_enabled() or get_env_policy() == usage_policy::STABLE;
}

} // namespace nvcomp_integration
Expand Down

0 comments on commit 03bc828

Please sign in to comment.