Gemma4 Mtp Decoder#

class Gemma4MTPDecoder : public trt_edgellm::rt::DecodingStrategy#

Gemma4 assistant MTP decoder.

This class owns the Gemma4-specific draft-engine binding path. The assistant has no draft KV cache: its past_key_values_* inputs are zero-copy aliases to the base target KV cache selected by kv_sharing_map.

Public Functions

Gemma4MTPDecoder(
DecodingRuntimeContext &runtime,
std::filesystem::path const &engineDir,
SpecDecodeDraftingConfig const &draftingConfig,
cudaStream_t stream,
)#
inline virtual DecodingStrategyKind kind() const noexcept override#
inline virtual char const *name() const noexcept override#
inline virtual bool isSpeculative() const noexcept override#
virtual bool decodeStep(DecodingInferenceContext &context) override#
virtual bool captureCudaGraphs(cudaStream_t stream) override#
virtual int64_t getRequiredContextMemorySize(
) const noexcept override#
virtual void setContextMemory(Tensor &memory) override#
virtual bool hasSystemPromptKVCache(
SystemPromptCacheKey const &key,
) const override#
virtual void restoreSystemPromptKVCache(
SystemPromptCacheKey const &key,
int32_t batchIdx,
cudaStream_t stream,
) override#
virtual bool runSystemPromptPrefill(
DecodingInferenceContext &context,
) override#
virtual void saveSystemPromptKVCache(
SystemPromptCacheKey const &key,
std::string const &prompt,
std::vector<tokenizer::Rank> const &tokenizedPrompt,
int32_t promptIdsLength,
cudaStream_t stream,
) override#
virtual void resetForNewSequences(
Tensor &reuseLengths,
cudaStream_t stream,
) override#
virtual void onBatchEvict(
std::vector<int32_t> const &batchMapping,
int32_t oldActiveBatch,
int32_t newActiveBatch,
Tensor &deviceBatchMapping,
cudaStream_t stream,
) override#