FZGPUModules 2.0
GPU-accelerated modular compression pipelines
Loading...
Searching...
No Matches
fz Namespace Reference

Classes

struct  AdaptiveBitpackConfig
 
class  AdaptiveBitpackStage
 
struct  AdaptiveLorenzoConfig
 Serialized config stored in FZMBufferEntry.stage_config. More...
 
class  AdaptiveLorenzoStage
 
struct  AllocationInfo
 
class  BitpackStage
 
class  BitplaneRZEStage
 
class  BitshuffleStage
 
class  BorrowedDeviceBuffer
 
struct  BufferInfo
 
struct  Cdf97Config
 
class  Cdf97Stage
 
class  CLOGStage
 
class  CompressionDAG
 
struct  ConstDeviceSpan
 
struct  DAGNode
 
struct  DeviceSpan
 
class  DifferenceStage
 
struct  EncodingOracleDecl
 Host-side declaration of a local, exact encoded-size oracle. More...
 
struct  FusedAuxOutputDecl
 
struct  FusedImpl
 A registered fused implementation and its matcher. More...
 
struct  FusedOpDecl
 A stage's contribution to a generated fused kernel — the device-op it maps to, where its source lives, and its runtime parameter bytes. More...
 
struct  FusedPrimeContext
 Minimal context a fused runner hands a stage so it can establish the forward-computed state its OWN inverse will later read. More...
 
struct  FusedRunContext
 Everything a fused runner needs to compress one group in place. More...
 
struct  FusedSideOutput
 
struct  FusionGeometry
 Geometry accumulated while extending one candidate fusion chain. More...
 
struct  FusionGroup
 One maximal fusion-legality domain, in producer→consumer order. More...
 
struct  FusionGroupInfo
 One finalize-time fusion specialization selected for compress execution. More...
 
struct  FusionInfo
 Resolved fusion decision for diagnostics and benchmark provenance. More...
 
struct  FusionSpec
 A stage's fusion contract. Stages that can participate in a fused kernel override Stage::getFusionSpec() to return a non-Unfusable spec; the default is Unfusable (a barrier), so a stage is only ever fused if it opts in. More...
 
struct  FZMBufferEntry
 Per-buffer metadata record written into the FZM header (256 bytes). More...
 
struct  FZMHeaderCore
 Fixed-size FZM file header core (80 bytes). More...
 
struct  FZMStageInfo
 Per-stage metadata record written into the FZM header (256 bytes). More...
 
struct  GInterpConfig
 
class  GInterpStage
 
class  GPULZStage
 
class  HCLOGStage
 
struct  HuffmanBookSpec
 
class  HuffmanStage
 
struct  LevelTimingResult
 
class  Logger
 
struct  LogTransformConfig
 
class  LogTransformStage
 
struct  LorenzoConfig
 
struct  LorenzoQuantConfig
 
class  LorenzoQuantStage
 
class  LorenzoStage
 
class  MemoryPool
 
struct  MemoryPoolConfig
 
class  MergeStage
 
struct  Negabinary
 
class  NegabinaryStage
 
struct  OutlierCorrectConfig
 Serialized OutlierCorrectStage config. 12 bytes. More...
 
class  OwnedDeviceBuffer
 
struct  PersistentAllocInfo
 
struct  PipelinePerfResult
 
struct  QuantizerConfig
 
class  QuantizerStage
 
class  RAREStage
 
class  RAZEStage
 
struct  ReconstructionStats
 
class  RLEStage
 
class  ROIBinSplitStage
 
struct  RoiPeak
 One Bragg-peak record, matching the on-disk .roi layout exactly (8 bytes). More...
 
class  RREStage
 
class  RZEStage
 
struct  Speck2DConfig
 Serialized Speck2DStage config (FZMBufferEntry.stage_config). 24 bytes. More...
 
class  Stage
 
struct  StageFingerprintInfo
 A stage's name paired with a hash of the source that implements it. More...
 
struct  StageTimingResult
 
struct  SZpConfig
 
class  SZpStage
 
struct  SZxConfig
 
class  SZxStage
 
struct  TiledLorenzoConfig
 
class  TiledLorenzoStage
 
class  TUPLStage
 
struct  Zigzag
 
class  ZigzagStage
 

Typedefs

using StageHeaderFactory = Stage *(*)(const uint8_t *config, size_t config_size)
 

Enumerations

enum class  MemoryStrategy { MINIMAL , PREALLOCATE }
 
enum class  FusionCompatibility : uint8_t
 Exact reason a stage spec cannot extend an accumulated group geometry.
 
enum class  StageType : uint16_t {
}
 Stage type identifiers written into the FZM header. More...
 
enum class  DataType : uint8_t { }
 Element data type identifiers used in buffer and stage descriptors. More...
 
enum class  LogLevel : int {
  TRACE = 0 , DEBUG = 1 , INFO = 2 , WARN = 3 ,
  SILENT = 255
}
 
enum class  FusionPolicy
 
enum class  FusionAccess : uint8_t
 How a stage accesses its input — the property that decides whether it can be fused into a single kernel with its neighbours. More...
 
enum class  FusionStrategy : uint8_t
 Which fused-kernel execution model a stage's device-op belongs to. More...
 
enum class  EncodingOracleKind : uint8_t
 Registered exact encoded-size policies used by an upstream adaptive stage for an algorithmic mode decision. More...
 
enum class  FusedAuxSizeKind : uint8_t { FixedBitsPerUnit = 0 , CompactedElements }
 
enum class  HuffmanExecutionMode { HostCoordinated , DeviceResident }
 
enum class  HuffmanBookSource { PerBlock , Fixed , Adaptive }
 
enum class  HuffmanBookModel { Gaussian , Laplace , GeneralizedNormal , Uniform }
 
enum class  ErrorBoundMode : uint8_t { ABS = 0 , REL = 1 , NOA = 2 , PREL = 3 }
 
enum class  SZxErrorMode : uint8_t
 
enum class  FusionMode : uint8_t { NEGABINARY = 0 , ZIGZAG = 1 }
 
enum class  ADMDtype : uint8_t
 

Functions

FusionCompatibility extendFusionGeometry (FusionGeometry &geometry, const FusionSpec &next)
 Validate and, on success, extend geometry with next.
 
std::vector< FusionGroupplanFusionGroups (const CompressionDAG &dag)
 
const FusedImplfindFusedImpl (const std::vector< Stage * > &group, bool include_experimental=false)
 
const char * getBackendErrorString (error_t err)
 
size_t getPoolUsedMemCurrent (mempool_t pool)
 
size_t getPoolUsedMemHigh (mempool_t pool)
 
constexpr uint8_t fzmVersionMajor (uint16_t v)
 
constexpr uint8_t fzmVersionMinor (uint16_t v)
 
size_t getDataTypeSize (DataType type)
 
std::string dataTypeToString (DataType type)
 
std::string stageTypeToString (StageType type)
 
std::vector< std::string > registeredStageTypes ()
 Every stage type string loadConfig() accepts, in registry order.
 
std::vector< StageFingerprintInfostageFingerprints ()
 Per-stage source fingerprints for THIS build.
 
template<typename T >
ReconstructionStats calculateStatistics (const T *d_original, const T *d_decompressed, size_t n)
 
void registerStageHeaderFactory (StageType type, StageHeaderFactory fn)
 
bool hasStageHeaderFactory (StageType type)
 
StagecreateStage (StageType type, const uint8_t *config, size_t config_size)
 
template<typename T >
constexpr size_t rleValuesOffset ()
 
template<typename T >
constexpr size_t rleChunkedValuesOffset (size_t num_chunks)
 
template<typename T >
void launchAdaptiveLorenzoForward (const T *d_input, T *d_residuals, uint8_t *d_modes, T *d_means, uint32_t *d_flags, size_t n, uint32_t tile_size, bool enable_order2, bool enable_centering, EncodingOracleKind oracle_kind, fz::stream_t stream)
 Forward: select the best variant per tile and emit its residuals.
 
template<typename T >
void launchAdaptiveLorenzoInverse (const T *d_residuals, const uint8_t *d_modes, const T *d_means, T *d_output, size_t n, uint32_t tile_size, fz::stream_t stream)
 Inverse: replay each tile's recorded variant.
 
ErrorBoundMode resolveApproxRelMode (ErrorBoundMode mode, const char *stage_name)
 
template<typename TInput , typename TCode >
void launchLorenzoKernel2D (const TInput *d_input, size_t nx, size_t ny, TInput ebx2_r, TCode quant_radius, TCode *d_codes, TInput *d_outlier_errors, uint32_t *d_outlier_indices, uint32_t *d_outlier_count, size_t max_outliers, bool zigzag_codes, fz::stream_t stream)
 2-D forward Lorenzo kernel launcher. nx is the fast (x) dimension.
 
template<typename TInput , typename TCode >
void launchLorenzoInverseKernel2D (const TCode *d_codes, const TInput *d_outlier_errors, const uint32_t *d_outlier_indices, uint32_t outlier_n, size_t nx, size_t ny, TInput ebx2, TCode quant_radius, TInput *d_output, bool zigzag_codes, fz::stream_t stream, MemoryPool *pool)
 2-D inverse Lorenzo kernel launcher.
 
template<typename TInput , typename TCode >
void launchLorenzoKernel3D (const TInput *d_input, size_t nx, size_t ny, size_t nz, TInput ebx2_r, TCode quant_radius, TCode *d_codes, TInput *d_outlier_errors, uint32_t *d_outlier_indices, uint32_t *d_outlier_count, size_t max_outliers, bool zigzag_codes, fz::stream_t stream)
 3-D forward Lorenzo kernel launcher.
 
template<typename TInput , typename TCode >
void launchLorenzoInverseKernel3D (const TCode *d_codes, const TInput *d_outlier_errors, const uint32_t *d_outlier_indices, uint32_t outlier_n, size_t nx, size_t ny, size_t nz, TInput ebx2, TCode quant_radius, TInput *d_output, bool zigzag_codes, fz::stream_t stream, MemoryPool *pool)
 3-D inverse Lorenzo kernel launcher.
 
template<typename T >
void launchLorenzoDeltaCentered1D (const T *d_input, T *d_output, T *d_means, size_t n, fz::stream_t stream, unsigned block_threads)
 
template<typename T >
void launchLorenzoSegmentedScan (const T *d_input, const T *d_means, T *d_output, size_t n, fz::stream_t stream, unsigned block_threads, int passes)
 
template<typename T >
void launchLorenzo2Delta1D (const T *d_input, T *d_output, T *d_means, size_t n, fz::stream_t stream, unsigned block_threads)
 

Variables

constexpr bool kBackendSupportsGraphCapture = true
 
constexpr uint32_t FZM_MAGIC = 0x464D5A32
 
constexpr uint8_t FZM_VERSION_MAJOR = 3
 
constexpr size_t FZM_LEGACY_HEADER_CORE_SIZE = 72
 
constexpr uint16_t FZM_FLAG_HAS_DATA_CHECKSUM = 0x0001u
 data_checksum field is valid
 
constexpr uint16_t FZM_FLAG_HAS_HEADER_CHECKSUM = 0x0002u
 header_checksum field is valid
 
constexpr size_t FZM_MAX_BUFFERS = 32
 Maximum pipeline output buffers per file.
 
constexpr size_t FZM_MAX_NAME_LEN = 64
 Maximum output port name length (bytes, null-terminated)
 
constexpr size_t FZM_STAGE_CONFIG_SIZE = 128
 Per-stage serialized config slot (bytes)
 
constexpr size_t FZM_MAX_SOURCES = 4
 Maximum source stages per pipeline.
 
constexpr uint16_t FZM_STAGE_FLAG_PRIMARY_SOURCE = 0x1
 

Detailed Description

Copyright (c) Meta Platforms, Inc. and affiliates.

This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.

Adapted for FZGPUModules: namespace renamed from multibyte_ans to fz::ans.

Copyright (c) Meta Platforms, Inc. and affiliates.

This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.

Adapted for FZGPUModules: namespace renamed from multibyte_ans to fz::ans; stripped ansDecode() host function (called directly from ans_stage.cu instead).

Copyright (c) Meta Platforms, Inc. and affiliates.

This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.

Adapted for FZGPUModules: namespace renamed from multibyte_ans to fz::ans; stripped ansEncode() host function (called directly from ans_stage.cu instead).

Copyright (c) Meta Platforms, Inc. and affiliates.

This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.

Adapted for FZGPUModules: namespace renamed from multibyte_ans to fz::ans; stripped histogramSingle, histogramBatch, ansHistogramBatch (replaced by fz::module::GPU_histogram_generic in ans_stage.cu).

Typedef Documentation

◆ StageHeaderFactory

using fz::StageHeaderFactory = typedef Stage* (*)(const uint8_t* config, size_t config_size)

Build a Stage from its serialized config bytes. A factory owns the type dispatch (e.g. picking the right template instantiation from the config) and must call deserializeHeader() itself. It returns a heap-allocated Stage the caller owns, or throws std::runtime_error on an unsupported config.

Enumeration Type Documentation

◆ MemoryStrategy

enum class fz::MemoryStrategy
strong

Memory allocation strategy for pipeline execution.

Enumerator
MINIMAL 

Allocate on-demand, free at last consumer. Lowest peak memory.

PREALLOCATE 

Allocate everything upfront at finalize(). Required for graph mode.

◆ StageType

enum class fz::StageType : uint16_t
strong

Stage type identifiers written into the FZM header.

Each concrete Stage subclass reports one of these values via getStageTypeId(). Used by StageFactory::createStage() to reconstruct the pipeline during decompression.

Enumerator
ANS 

rANS entropy coder (GPU, via dietGPU)

ADM 

Adaptive Data Mapping transform (MANS)

G_INTERP 

Spline interpolation predictor + quantizer (cuSZ-Hi G-Interp)

BITPLANE_RZE 

Fused bitplane transpose + zero-group RZE (FZ-GPU lossless encoder)

ADAPTIVE_BITPACK 

Per-block adaptive fixed-rate bit-plane coder (cuSZp plain mode)

TILED_LORENZO 

Dimension-aware (tiled separable) Lorenzo predictor (cuSZp3 delta)

RRE 

Repeated-word bitmap reducer with recursive bitmap compression (LC component)

RARE 

Adaptive top-bit matching generalization of RRE (LC component)

RAZE 

Adaptive leading-zero-bit generalization of RZE (LC component)

CLOG 

Per-subchunk leading-zero compression and bit packing (LC framework component)

HCLOG 

CLOG bit packing with per-subchunk TCMS selection (LC framework component)

TUPL 

Tuple deinterleave (AoS -> SoA) transpose (LC framework lossless component)

GPULZ 

TODO: describe this stage.

LOG_TRANSFORM 

Log-space transform for point-wise relative bounds (Liang et al., CLUSTER'18)

ADAPTIVE_LORENZO 

Per-tile adaptive multi-order Lorenzo + centering (FSZ prediction stage)

ROIBIN_SPLIT 

Region-of-interest / binned-background split (ROIBIN-style dual-error-bound branching)

SZX 

SZx ultrafast EB compressor: per-block constant/non-constant classification + fixed-length residuals (fused, no entropy coder)

SZP 

SZp / fZ-light: quantize + 1-D Lorenzo delta + fixed-length bitpack (fused, no entropy coder)

CDF97 

CDF 9/7 biorthogonal wavelet transform (SPERR's DWT front-half)

SPECK2D 

GPU-parallel "wavefront" SPECK-like coder (2-D), decode-parallel format.

CDF97_OUTLIER_CORRECT 

Sparse outlier correction, guarantees the GPU SPERR pipeline's pointwise bound.

◆ DataType

enum class fz::DataType : uint8_t
strong

Element data type identifiers used in buffer and stage descriptors.

Returned by Stage::getOutputDataType() and Stage::getInputDataType(). UNKNOWN is returned by byte-transparent stages (Bitshuffle, RZE) to opt out of Pipeline::finalize() type-compatibility checking.

Enumerator
UNKNOWN 

Byte-transparent stages: skip type checking at finalize()

◆ LogLevel

enum class fz::LogLevel : int
strong
Enumerator
TRACE 

Per-stage execute(), per-chunk details — very verbose.

DEBUG 

Pipeline construction, buffer allocation, data stats.

INFO 

High-level milestones: finalize, compress, decompress.

WARN 

Unexpected but recoverable: outlier overflow, fallbacks.

SILENT 

Compile-time sentinel — do not pass to log()

◆ FusionPolicy

enum class fz::FusionPolicy
strong

High-level pipeline API for building and executing compression workflows.

Stages are added with addStage<T>(), wired with connect(), then the pipeline is finalized and ready for compress()/decompress().

Ownership:

  • compress() output is pool-owned — do NOT cudaFree it. Valid until the next compress()/reset() or Pipeline destruction.
  • decompress() output is pool-owned by default - do NOT cudaFree it. Call setPoolManagedDecompOutput(false) to receive a caller-owned pointer instead. Kernel-fusion policy for compress. Off (default) runs every stage staged. Auto installs only registered implementations that have passed their profitability gate. Force also permits experimental implementations and is intended for correctness/performance diagnostics, not production selection. The planner may select non-overlapping partial groups from one larger compatible chain; a specialization need not consume the maximal chain. Decompression and archive semantics remain staged-compatible. Overridable at runtime with FZ_FUSION=off|auto|force ("experimental" aliases force).

◆ FusionAccess

enum class fz::FusionAccess : uint8_t
strong

How a stage accesses its input — the property that decides whether it can be fused into a single kernel with its neighbours.

Fusion keeps a block's data register/shared-resident across a chain of stages instead of materialising each intermediate to DRAM. Whether that is possible depends only on a stage's data-access pattern, not on what it computes:

  • Map element-wise, out[i] = f(in[i]). Composes with anything.
  • BlockLocal bounded, resettable neighbourhood inside a fixed-size block (e.g. 1-D Lorenzo delta with a per-block reset). Fusable with other block-local / map stages of the same block size.
  • Cooperative warp/block reduce+scan producing variable-length output — a fixed-length coder. Fusable as the tail of a block-local chain (its per-block work consumes the block still in registers); the cross-block offset prefix is handled by the fused driver.
  • TileAdaptive one cooperative selector owns a larger tile containing an integer number of downstream coder units. Its tile size and coder-unit size are separate legality constraints.
  • Unfusable opaque kernel or a genuine global dependency (entropy coder with a global codebook, whole-array scan). A fusion barrier.

See docs/codebase_notes.md CN-FUSE-PROOF for the measured motivation.

◆ FusionStrategy

enum class fz::FusionStrategy : uint8_t
strong

Which fused-kernel execution model a stage's device-op belongs to.

A fused group is composed of ops that all share one strategy — the generic runner routes by this, and the codegen has a per-strategy backend. The two are deliberately different execution models (see the two-axis taxonomy):

  • ChunkCooperative one CTA owns a fixed byte-chunk, intermediates in shared memory, __syncthreads between ops (LC/PFPL-style).
  • WarpRegister one warp owns a ≤64-element block, intermediates in registers and shuffles, no barriers (cuSZp-style).

◆ EncodingOracleKind

enum class fz::EncodingOracleKind : uint8_t
strong

Registered exact encoded-size policies used by an upstream adaptive stage for an algorithmic mode decision.

This is deliberately separate from fusion profitability: an encoding oracle changes which representation is selected and must therefore agree in staged and fused execution. None means the stage exposes no local exact oracle.

◆ FusedAuxSizeKind

enum class fz::FusedAuxSizeKind : uint8_t
strong

How an escaping fused output's byte length is determined.

Enumerator
FixedBitsPerUnit 

ceil(num_units * bits_per_unit / 8)

CompactedElements 

runtime count * sizeof(element)

◆ HuffmanExecutionMode

enum class fz::HuffmanExecutionMode
strong

Selects how the forward Huffman bitstream is assembled.

Enumerator
HostCoordinated 

cuSZ coarse path with a host partition-prefix scan (default).

DeviceResident 

Device scan/header assembly; book construction follows the selected source.

◆ HuffmanBookSource

enum class fz::HuffmanBookSource
strong

Selects where the Huffman codebook comes from on the forward path.

PerBlock builds a fresh book from each input histogram. HostCoordinated follows cuSZ by copying frequencies to the CPU; DeviceResident builds the same canonical book directly from the device histogram. Fixed builds one book up front and reuses it for every call.

Prior work: CEAZ (Xiong et al., ICS'22) generates canonical codewords offline from representative scientific data; Shah et al., Lightweight Huffman Coding for Efficient GPU Compression (ICS'23) precomputes a dictionary of codebooks fitted to cuSZ's quantization-code distribution and selects one at runtime. The win grows as the per-call payload shrinks, so Fixed matters most for small-chunk workloads.

Enumerator
PerBlock 

Histogram + build a fresh codebook on every forward call (default).

Fixed 

Build one codebook up front and reuse it for every forward call.

Adaptive 

Histogram the first call only, then reuse that codebook forever.

◆ HuffmanBookModel

enum class fz::HuffmanBookModel
strong

Analytic symbol distribution used to synthesize a fixed codebook.

Enumerator
Gaussian 

exp(-((i-center)/scale)^2 / 2)

Laplace 

exp(-|i-center|/scale)

GeneralizedNormal 

exp(-(|i-center|/scale)^shape)

Uniform 

flat; every symbol equally likely

◆ ErrorBoundMode

enum class fz::ErrorBoundMode : uint8_t
strong

Interpretation of the user-specified error bound.

  • ABS|x_orig - x_recon| <= eb (default).
  • RELguaranteed point-wise relative (PFPL): |error| / |x_orig| <= eb for every element. Requires per-element log-space quantization and is therefore implemented only by QuantizerStage. Predictor-fused stages (LorenzoQuantStage, GInterpStage) cannot honour it — they accept it as a deprecated alias for PREL and emit a warning.
  • PRELpseudo-relative: abs_eb = eb × max(|data|), then treated as ABS. This is the cheap global approximation of REL used by predictor-fused stages. It bounds |error| / max(|x|), not |error| / |x|: any element with |x| < max(|data|) sees a proportionally looser effective relative error, and elements near zero are effectively unbounded in relative terms. Named PREL (not REL) precisely so that this is impossible to use by accident.
  • NOA — norm-of-absolute / value-range relative (PFPL): abs_eb = eb × (max(data) - min(data)). Equivalent to what most other compressors call "relative". Differs from PREL only in the scan statistic (range vs. max magnitude); for data that straddles zero the two are within 2×.
Enumerator
ABS 

Absolute error bound.

REL 

Exact per-element point-wise relative bound (QuantizerStage only).

NOA 

Value-range relative bound (norm-of-absolute).

PREL 

Pseudo-relative: eb × max(|data|), applied as a single ABS bound.

◆ SZxErrorMode

enum class fz::SZxErrorMode : uint8_t
strong

Error-bound interpretation. SZx quantizes residuals against one global tolerance per block, so it supports ABS and value-range-relative (NOA) bounds only — no exact per-element REL path (use QuantizerStage for that).

◆ FusionMode

enum class fz::FusionMode : uint8_t
strong

Fusion applied at the final write of the forward difference kernel (and undone as the first step of the inverse kernel) when TOut is the unsigned counterpart of a signed T. Both transforms are O(1), bitwise-only, and size-preserving (see modules/transforms/negabinary/negabinary.h and modules/transforms/zigzag/zigzag.h); neither dominates universally — negabinary tends to produce denser zero runs at high bit-planes for smooth, symmetric-around-zero residuals, but zigzag/TCMS can win on other residual distributions. This mirrors the LC framework's decision to keep DIFFNB and DIFFMS as two separate searchable components rather than picking one.

Enumerator
NEGABINARY 

LC's DIFFNB — Negabinary<T>::encode/decode.

ZIGZAG 

LC's DIFFMS — Zigzag<T>::encode/decode (sign-magnitude/TCMS).

◆ ADMDtype

enum class fz::ADMDtype : uint8_t
strong

Input element type for ADMStage.

Function Documentation

◆ planFusionGroups()

std::vector< FusionGroup > fz::planFusionGroups ( const CompressionDAG dag)

Return every maximal legal group (size >= 2) in dag. dag should be finalized. Groups are disjoint search domains; installation may choose smaller contiguous subspans, and all unselected stages run staged.

◆ findFusedImpl()

const FusedImpl * fz::findFusedImpl ( const std::vector< Stage * > &  group,
bool  include_experimental = false 
)

First registered impl whose matcher accepts group, or nullptr. Experimental implementations are returned only when include_experimental is true.

◆ getBackendErrorString()

const char * fz::getBackendErrorString ( error_t  err)
inline

Returns a human-readable description of a backend error code.

◆ getPoolUsedMemCurrent()

size_t fz::getPoolUsedMemCurrent ( mempool_t  pool)
inline

Current live bytes in pool (0 if pool is null).

◆ getPoolUsedMemHigh()

size_t fz::getPoolUsedMemHigh ( mempool_t  pool)
inline

Peak live bytes in pool since the attribute was last reset (0 if pool is null).

◆ fzmVersionMajor()

constexpr uint8_t fz::fzmVersionMajor ( uint16_t  v)
constexpr

Extract major version from a raw on-disk version field. Pre-split files stored small integers (e.g. 3); values ≤ 0xFF are treated as (major=value, minor=0).

◆ fzmVersionMinor()

constexpr uint8_t fz::fzmVersionMinor ( uint16_t  v)
constexpr

Extract minor version from a raw on-disk version field (see fzmVersionMajor).

◆ getDataTypeSize()

size_t fz::getDataTypeSize ( DataType  type)
inline

Returns the size in bytes of the given DataType. Throws for DataType::UNKNOWN.

◆ dataTypeToString()

std::string fz::dataTypeToString ( DataType  type)
inline

Returns a human-readable string for the given DataType (e.g. "float32").

◆ stageTypeToString()

std::string fz::stageTypeToString ( StageType  type)
inline

Returns a human-readable string for the given StageType (e.g. "LorenzoQuant").

◆ registeredStageTypes()

std::vector< std::string > fz::registeredStageTypes ( )

Every stage type string loadConfig() accepts, in registry order.

Reads the one stage registry that also drives TOML load and save dispatch, so it is correct by construction: adding a stage per the procedure in config.cpp updates this automatically, and no second list can drift out of sync.

Exposed because consumers need the inventory, not just whatever happened to execute — a downstream benchmark harness invalidating cached results per stage has to know a stage exists even when no current pipeline uses it.

Returns
Stage type names, e.g. {"Lorenzo", "LorenzoQuant", "Quantizer", ...}.

◆ stageFingerprints()

std::vector< StageFingerprintInfo > fz::stageFingerprints ( )

Per-stage source fingerprints for THIS build.

Each fingerprint is a sha256 (truncated to 16 hex chars) over the stage's own sources plus the transitive closure of its repo-local #includes, generated at build time by scripts/gen_stage_fingerprints.py.

The transitive part is what makes it useful: stages share infrastructure and include each other, so hashing only a stage's own directory would miss a change to the memory pool or to a transform it inlines. A change to a shared header moves every dependent stage's fingerprint; a change to one kernel moves exactly one.

Intended use is cache invalidation: a consumer that recorded these alongside a result can re-run only the entries whose stages have since changed, instead of re-running everything or trusting a stale number. Compare fingerprints for equality only — they carry no ordering.

Deliberately conservative: comment and formatting edits move the fingerprint too, because proving an edit is semantically inert is not something a hash can do, and a needless re-run is much cheaper than a wrong cached result.

Returns
One entry per registered stage, in registry order.

◆ calculateStatistics()

template<typename T >
ReconstructionStats fz::calculateStatistics ( const T *  d_original,
const T *  d_decompressed,
size_t  n 
)

Compute reconstruction statistics between two device arrays.

Parameters
d_originalDevice pointer to original data.
d_decompressedDevice pointer to reconstructed data.
nNumber of elements.

◆ registerStageHeaderFactory()

void fz::registerStageHeaderFactory ( StageType  type,
StageHeaderFactory  fn 
)

Register (or, for a duplicate StageType, replace) a header factory.

◆ hasStageHeaderFactory()

bool fz::hasStageHeaderFactory ( StageType  type)

True if a header factory is registered for type. For coverage tests.

◆ createStage()

Stage * fz::createStage ( StageType  type,
const uint8_t *  config,
size_t  config_size 
)

Reconstruct a Stage from a serialized FZM header. Used by the decompressor to rebuild the inverse pipeline from the file. Throws if no factory is registered for type.

◆ rleValuesOffset()

template<typename T >
constexpr size_t fz::rleValuesOffset ( )
constexpr

Byte offset of the values section within the packed RLE wire format, rounded up to alignof(T). The 4-byte num_runs header alone only guarantees 4-byte alignment; for 8-byte T (int64_t/uint64_t) the values section must start on an 8-byte boundary or the reinterpret_cast<T*> reads/writes in rle_pack_kernel/execute() fault with an unaligned 64-bit load (found via the RLE_8 word-size round-trip test).

◆ rleChunkedValuesOffset()

template<typename T >
constexpr size_t fz::rleChunkedValuesOffset ( size_t  num_chunks)
constexpr

Byte offset of the values section within the chunked wire format, given the chunk count. The offset table is num_chunks + 1 uint32_t entries following the num_chunks header word; the values section is then rounded up to alignof(T) for the same reason as rleValuesOffset<T>().

◆ resolveApproxRelMode()

ErrorBoundMode fz::resolveApproxRelMode ( ErrorBoundMode  mode,
const char *  stage_name 
)
inline

Resolve an error-bound mode for a stage that has no exact point-wise REL path.

LorenzoQuantStage and GInterpStage quantize prediction residuals against one global tolerance, so a per-element relative bound cannot be threaded through them. Historically both accepted REL and silently applied the eb × max(|data|) approximation; that mode is now spelled PREL. REL is still accepted here as a deprecated alias so existing configs keep running, but it warns — if you need the real guarantee, use QuantizerStage.

Parameters
modeRequested mode.
stage_nameStage name, for the warning message.
Returns
PREL when mode == REL, otherwise mode unchanged.

◆ launchLorenzoDeltaCentered1D()

template<typename T >
void fz::launchLorenzoDeltaCentered1D ( const T *  d_input,
T *  d_output,
T *  d_means,
size_t  n,
fz::stream_t  stream,
unsigned  block_threads 
)

Block-mode forward with per-block mean centering. Writes one mean per block to d_means (ceil(n / block_threads) elements) and centers only the first residual of each block.

◆ launchLorenzoSegmentedScan()

template<typename T >
void fz::launchLorenzoSegmentedScan ( const T *  d_input,
const T *  d_means,
T *  d_output,
size_t  n,
fz::stream_t  stream,
unsigned  block_threads,
int  passes 
)

Unified block-mode inverse: passes segmented prefix sums (1 = LZ1, 2 = LZ2) followed by a uniform + mu when d_means is non-null. One CTA per reset segment with several elements per thread, so the CTA width no longer tracks the segment length.

◆ launchLorenzo2Delta1D()

template<typename T >
void fz::launchLorenzo2Delta1D ( const T *  d_input,
T *  d_output,
T *  d_means,
size_t  n,
fz::stream_t  stream,
unsigned  block_threads 
)

Block-mode second-order (LZ2) forward. d_means may be nullptr (no centering); when non-null it also writes one mean per block.

Variable Documentation

◆ kBackendSupportsGraphCapture

constexpr bool fz::kBackendSupportsGraphCapture = true
inlineconstexpr

True for backends with a mature CUDA-Graph-equivalent capture API (CUDA, HIP).

◆ FZM_MAGIC

constexpr uint32_t fz::FZM_MAGIC = 0x464D5A32
constexpr

FZM magic number ("FZM2" in little-endian).

◆ FZM_VERSION_MAJOR

constexpr uint8_t fz::FZM_VERSION_MAJOR = 3
constexpr

Version encoding: high byte = major, low byte = minor.

Major mismatch → throw. Minor mismatch → warn and continue. Pre-split files stored a bare integer (e.g. 3); those are treated as major = value, minor = 0, so FZM_VERSION = 0x0300 is backward-compatible.

v3.0 → v3.1: FZMHeaderCore grew from 72 to 80 bytes; added flags, data_checksum, and header_checksum fields.

◆ FZM_LEGACY_HEADER_CORE_SIZE

constexpr size_t fz::FZM_LEGACY_HEADER_CORE_SIZE = 72
constexpr

FZMHeaderCore size for v3.0 files (before checksums). Used by readHeader() to avoid overrunning the stage array.

◆ FZM_STAGE_FLAG_PRIMARY_SOURCE

constexpr uint16_t fz::FZM_STAGE_FLAG_PRIMARY_SOURCE = 0x1
constexpr

FZMStageInfo::stage_flags bits. Set on exactly the stage Pipeline::setPrimarySource() designated (or, if unset, the pipeline's sole/first-discovered source) – see buildHeader() and Pipeline::buildSourceSizesFromHeader(). Needed because a stage bound via bindExternalInput() alongside other real connections (e.g. Cdf97OutlierCorrectStage) is invisible to the plain "no other stage produces any of my inputs" source test buildSourceSizesFromHeader() uses for everything else – decompressFromFile() has no live Pipeline to ask. Absent (0) on any archive written before this flag existed; the old is-source heuristic remains the fallback for those.