File size: 703 Bytes
3fd1a35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once
#include "ling3/mla_stats.h"
#include <cstddef>
#include <cstdint>
#include <memory>
#include <span>
#include <string>

namespace ling3 {
// One workspace per decoder, shared by all six MLA layers. No persistent KV:
// checkpoint/rewind semantics continue to belong to the decoder's BF16 cache.
class MlaNpu {
public:
    MlaNpu();
    ~MlaNpu();
    void Prepare(std::size_t rows);
    bool Run(std::span<const float> q, std::span<const std::uint16_t> k,
        std::span<const std::uint16_t> v, std::size_t rows, std::size_t history,
        std::span<float> output);
    void CpuCall();
    MlaBackendStats Stats() const;
private:
    struct Impl;
    std::unique_ptr<Impl> impl_;
};
}