Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Dnn::ITransformerBlock< TDeviceType, TPrecision > Class Template Referenceabstractexport

Polymorphic inference interface for one transformer block. More...

Inheritance diagram for Mila::Dnn::ITransformerBlock< TDeviceType, TPrecision >:
Mila::Dnn::GemmaBlock< TDeviceType, TPrecision, false, TWeightQuantization, TKvCachePolicy, kDelegatedFeedForward, kMixtureOfExperts > Mila::Dnn::GemmaBlock< TDeviceType, TPrecision, true, TWeightQuantization, NoKvCompression, kDelegatedFeedForward, kMixtureOfExperts > Mila::Dnn::QwenAttentionBlock< TDeviceType, TPrecision, TWeightPlan, TKvCachePolicy > Mila::Dnn::QwenDeltaNetBlock< TDeviceType, TPrecision, TWeightPlan > Mila::Dnn::GemmaBlock< TDeviceType, TPrecision, kGlobal, TWeightQuant, TKvPolicy, kDelegatedFeedForward, kMixtureOfExperts > Mila::Dnn::QwenAttentionBlock< TDeviceType, TPrecision, TWeightPlan, TKvPolicy > Mila::Dnn::QwenDeltaNetBlock< TDeviceType, TPrecision, TWeightPlan >

Public Types

using MR = typename DeviceTypeTraits<TDeviceType>::memory_resource
using TensorType = Tensor<TPrecision, MR>

Public Member Functions

virtual TensorType & decode (const TensorType &input, dim_t position)=0
 Single-token decode at an absolute position (T == 1).
virtual TensorType & prefill (const TensorType &input, dim_t position_offset)=0
 Chunked prefill: process [B, T_chunk, model_dim] at an absolute offset.
virtual void resetKvCache ()=0
 Reset the KV cache (new generation session).
virtual bool rewindKvCache (dim_t position)=0
 Rewind the KV cache fill position for prompt-prefix reuse.
virtual void setState (const GqaState &state)=0
 Wire the shared GQA transient workspace (owned by the transformer).
virtual bool supportsKvCache () const noexcept=0
 True when the block's attention supports the KV-cache inference path.

Detailed Description

template<DeviceType TDeviceType, TensorDataType TPrecision>
class Mila::Dnn::ITransformerBlock< TDeviceType, TPrecision >

Polymorphic inference interface for one transformer block.

Template Parameters
TDeviceTypeCompile-time device.
TPrecisionActivation/compute precision (must match across the block list).

Member Function Documentation

◆ decode()

◆ prefill()

◆ resetKvCache()

◆ rewindKvCache()

◆ setState()

◆ supportsKvCache()


The documentation for this class was generated from the following file: