|
| void | setInverse (bool inv) override |
| |
| void | setByteTransparent (bool on) |
| |
| 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 output_index) const override |
| |
| uint8_t | getInputDataType (size_t) const override |
| |
| size_t | serializeHeader (size_t output_index, 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 |
| |
| virtual size_t | getRequiredInputAlignment () const |
| |
| virtual std::vector< std::string > | getOutputNames () const |
| |
| int | getOutputIndex (const std::string &name) const |
| |
| virtual void | saveState () |
| |
| 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 bool | isGraphCompatible () const |
| |
| virtual size_t | estimateScratchBytes (const std::vector< size_t > &input_sizes) const |
| |
template<typename TIn, typename TOut = typename std::make_unsigned<TIn>::type>
class fz::ZigzagStage< TIn, TOut >
Element-wise zigzag encode/decode stage. Forward: TIn[] → TOut[]; inverse: TOut[] → TIn[].
- Template Parameters
-
| TIn | Signed integer type. |
| TOut | Corresponding unsigned type (same width as TIn). |
template<typename TIn , typename TOut = typename std::make_unsigned<TIn>::type>
Byte-transparent mode (default off). When enabled, the stage opts out of finalize() type checking by reporting DataType::UNKNOWN on both ports, while still applying the same sizeof(TIn)-word zigzag transform.
This is what lets ZigzagStage act as the LC framework's TCMS component (Two's-Complement → Magnitude-Sign) inside a byte-stream chain: LC's TCMS_N operates on a raw byte stream as N-byte words regardless of the upstream element type, so the typed default (which would reject, e.g., a uint16 codes port feeding Zigzag<int8_t>, or a UINT8 byte stream feeding Zigzag<int64_t>) must be relaxed for the chain to connect.
template<typename TIn , typename TOut = typename std::make_unsigned<TIn>::type>
| void fz::ZigzagStage< TIn, TOut >::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 return false from isGraphCompatible() and 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.
template<typename TIn , typename TOut = typename std::make_unsigned<TIn>::type>
Expected DataType of the given input port.
Used by Pipeline::finalize() to detect type mismatches between connected stages before any execution. Return DataType::UNKNOWN to opt out of checking — byte-transparent stages (Bitshuffle, RZE, RRE) and mock stages must return UNKNOWN; finalize() skips any connection where either side is UNKNOWN.
Reimplemented from fz::Stage.