载入中...
搜索中...
未找到
KernelGen.h
浏览该文件的文档.
1#ifndef EVE_TENSOR_KERNELGEN_H
2#define EVE_TENSOR_KERNELGEN_H
3
4#include "tensor/Optimizer.h"
5
6#include <string>
7#include <vector>
8
9namespace eve::tensor {
10
24struct KernelSpec {
25 std::string pass1; // empty when single-pass
26 std::string pass2; // always set
27 int groupsX1 = 0, groupsY1 = 1, groupsZ1 = 1;
28 int groupsX2 = 0, groupsY2 = 1, groupsZ2 = 1;
29 int inputCount = 0; // total group input buffers
30 int inputsReadPass1 = 0; // leading inputs bound in pass1
31 int statsCount = 0; // per-row stats buffers (allocated by the runtime)
32 int statsSize = 0; // elements per stats buffer (rows)
33 bool twoPass = false;
34
35 // Weight-only quantization of a matmul B / embedding table input.
36 // qDtype == 0 means fp32 storage. int8/int4 add a per-group scales buffer.
37 int qDtype = 0; // static_cast<int>(DType)
38 int qGroup = 0; // elements per scale group
39 int scalesBinding = -1; // storage binding of the scales buffer
40 int outputBinding = -1; // storage binding of the output (override)
41};
42
48bool generateKernel(const Graph &graph, const FusedGroup &group, KernelSpec &out);
49
55bool generateMatMulVariant(const Graph &graph, const FusedGroup &group, bool tiled,
56 KernelSpec &out);
57
59constexpr int kMaxKernelBindings = 8;
60
61} // namespace eve::tensor
62
63#endif // EVE_TENSOR_KERNELGEN_H
const FusedGroup & group
const Graph & graph
bool generateKernel(const Graph &graph, const FusedGroup &group, KernelSpec &out)
constexpr int kMaxKernelBindings
Definition KernelGen.h:59
bool generateMatMulVariant(const Graph &graph, const FusedGroup &group, bool tiled, KernelSpec &out)