|
| void | setInverse (bool inv) override |
| void | setNBits (uint8_t nbits) |
| void | setBase (T base) |
| void | setShift (uint8_t shift) |
| void | setAutoDetect (bool enable) |
| void | setAutoBase (bool enable) |
| void | setAutoShift (bool enable) |
| void | setAdaptive (bool enable) |
| void | execute (fz::stream_t stream, MemoryPool *pool, const std::vector< void * > &inputs, const std::vector< void * > &outputs, const std::vector< size_t > &sizes) override |
| std::string | getName () const override |
| std::vector< size_t > | estimateOutputSizes (const std::vector< size_t > &input_sizes) const override |
| std::unordered_map< std::string, size_t > | getActualOutputSizesByName () const override |
| size_t | getActualOutputSize (int index) const override |
| uint16_t | getStageTypeId () const override |
| uint8_t | getOutputDataType (size_t) const override |
| uint8_t | getInputDataType (size_t) const override |
| size_t | serializeHeader (size_t, uint8_t *buf, size_t max_size) const override |
| void | deserializeHeader (const uint8_t *buf, size_t size) override |
| size_t | getMaxHeaderSize (size_t) const override |
| void | saveState () override |
| virtual size_t | getRequiredInputAlignment () const |
| virtual std::vector< std::string > | getOutputNames () const |
| int | getOutputIndex (const std::string &name) const |
| virtual std::vector< std::string > | getRunNotes () const |
| virtual void | setDims (const std::array< size_t, 3 > &dims) |
| virtual void | onFinalize (size_t, MemoryPool *) |
| virtual size_t | estimateDeviceFootprintBytes (size_t) const |
| virtual size_t | estimatePinnedFootprintBytes (size_t) const |
| virtual void | postStreamSync (fz::stream_t stream) |
| virtual void | setTerminalOutput (bool terminal) |
| virtual size_t | estimateScratchBytes (const std::vector< size_t > &input_sizes) const |
| virtual FusionSpec | getFusionSpec () const |
| virtual FusedOpDecl | getFusedOp () const |
| virtual FusionSpec | getInverseFusionSpec () const |
| virtual FusedOpDecl | getInverseFusedOp () const |
| virtual size_t | getFusedInverseElementCount () const |
| virtual double | getFusedForwardQuantStep () const |
| virtual double | getFusedInverseDequantStep () const |
| virtual EncodingOracleDecl | getEncodingOracle () const |
| virtual bool | bindDownstreamEncodingOracle (const EncodingOracleDecl &) |
| virtual std::vector< FusedAuxOutputDecl > | getFusedAuxOutputs () const |
| virtual void | primeFusedForwardState (const FusedPrimeContext &) |
| virtual void | setFusedArchiveResult (size_t, size_t) |
| virtual void | setFusedInverseResult (size_t) |
| virtual void | setFusedSideOutput (int, size_t) |
template<typename T>
class fz::BitpackStage< T >
Bit-packing stage.
Forward: T[] → uint8_t[] Pack (v - base) >> shift using only the low nbits bits. Inverse: uint8_t[] → T[] Unpack, then restore (packed << shift) + base.
- Template Parameters
-
| T | Input element type: uint8_t, uint16_t, or uint32_t. |
Set the number of bits per element.
Must be a power of two between 1 and 8*sizeof(T) inclusive. Allowed values: uint8_t : 1, 2, 4, 8 uint16_t : 1, 2, 4, 8, 16 uint32_t : 1, 2, 4, 8, 16, 32
Ignored during forward execute when setAutoDetect(true) is active.
Enable automatic bit-width detection.
When true, forward execute scans the input for its maximum value and selects the smallest valid power-of-two nbits that covers the shifted, base-subtracted range. The chosen nbits is stored in the serialized header so the inverse pass can unpack correctly.
After compress(), getNBits() reflects the detected value.
Auto-detect adds a host sync inside execute() to read the scanned value.
template<typename T>
| void fz::BitpackStage< T >::execute |
( |
fz::stream_t | stream, |
|
|
MemoryPool * | pool, |
|
|
const std::vector< void * > & | inputs, |
|
|
const std::vector< void * > & | outputs, |
|
|
const std::vector< size_t > & | sizes ) |
|
overridevirtual |
Execute the stage. Inputs, outputs, and sizes are device pointers/bytes.
Stages may call cudaStreamSynchronize(stream) or issue blocking D2H copies when the algorithm requires it (e.g. Huffman histogram readback for codebook construction, ANS renormalization tables). Such stages must document the sync points.
Note: the DAG dispatches sibling nodes (same topological level) via a sequential CPU loop, each enqueuing to its own stream. A sync inside execute() blocks the CPU from dispatching subsequent siblings until the synced stream is idle — this delays parallel branches in wide DAGs. In a linear pipeline there are no siblings and no extra cost.
Implements fz::Stage.