#pragma once
#include "../ggml-decoder.h"
#include "node_context.h"
namespace ov::frontend::ggml {
class RecurrentCacheFusion {
public:
RecurrentCacheFusion(const std::shared_ptr<GgmlDecoder> & decoder, const std::shared_ptr<TensorMap> & tensors);
OutputVector translate(int index, const NodeContext & context);
bool is_inplace_output(const std::string & name) const;
private:
struct Group {
int reset = -1, gather = -1, remainder = -1, concat = -1, compute = -1, writeback = -1;
std::string root_name;
bool enabled = false;
Output<Node> old_cache, conv;
};
std::shared_ptr<GgmlDecoder> m_decoder;
std::shared_ptr<TensorMap> m_tensors;
std::vector<Group> m_groups;
std::map<int, size_t> m_nodes;
};
}