File size: 1,008 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/model_package.h"
#include "ling3/w4_linear.h"
#include <memory>
#include <string>

namespace ling3 {
// Keeps the original W4 path and an explicit experimental official-weight bridge.
class Linear {
public:
    Linear(const ModelPackage &,const std::string &,W4LinearConfig);
    ~Linear();
    W4RunTimings Run(std::span<const float>,std::span<float>);
    W4RunTimings RunBatch(std::span<const float>,std::size_t,std::span<float>);
    W4RunTimings RunBatchWithWeights(std::span<const float>,std::size_t,const Linear &,std::span<float>);
    W4RunTimings RunBatchQuantizedRows(std::span<const std::int8_t>,std::span<const float>,std::span<const std::size_t>,const Linear &,std::span<float>);
    void PrepareBatch(std::size_t,bool indexed=false);
    float PrepareInput(std::span<const float>);
    W4RunTimings RunPrepared(float,std::span<float>);
    void ShareInputFrom(Linear &);
    void SetSingleCore(int);
private:
    struct Impl;
    std::unique_ptr<Impl> impl_;
};
}