FZGPUModules 2.0
GPU-accelerated modular compression pipelines
Loading...
Searching...
No Matches
huffman_stage.h File Reference

Huffman entropy coding stage with selectable encode mode. More...

#include "stage/stage.h"
#include "fzm_format.h"
#include "coders/huffman/phf/hf.h"
#include <cuda_runtime.h>
#include <cstdint>
#include <cstring>
#include <memory>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <vector>

Go to the source code of this file.

Classes

class  fz::HuffmanStage< T >
 

Namespaces

namespace  fz
 

Enumerations

enum class  fz::HuffmanEncodeMode { fz::Coarse , fz::Fine }
 

Detailed Description

Huffman entropy coding stage with selectable encode mode.

Forward: T[] → variable-length PHF bitstream (inline phf_header prepended). Inverse: PHF bitstream → T[].

Two encode modes are available via setEncodeMode():

  • HuffmanEncodeMode::Coarse (default): multi-kernel coarse-grained path with a CPU prefix-sum sync in the middle of encode. Stable and well-tested.
  • HuffmanEncodeMode::Fine: single ReVISIT-lite kernel path with a fully GPU-async phase 3 (CUB ExclusiveSum + custom reduce kernel). No mid-encode CPU sync; preferred for latency-sensitive or graph-capture use cases.

Note: the histogram D2H is still a CPU-sync operation in both modes.

Supported input types: uint8_t, uint16_t, uint32_t.

Serialized header layout (11 bytes): [0] DataType of T (1 byte) [1..2] bklen_ (uint16_t LE) [3..10] original_len_ (uint64_t LE, element count)