命名空间 | |
| namespace | kernels |
| namespace | q |
类 | |
| class | CompiledFunction |
| Optimized / scheduled graph ready to run with feeds. 更多... | |
| class | Func |
Trace builder — TF2 tf.function analogue (tf.func in scripts). While active, TF ops record into this graph. 更多... | |
| struct | FusedGroup |
| class | GpuProgram |
| GPU execution of a compiled tensor Graph via generated compute shaders. 更多... | |
| class | Graph |
| struct | GraphNode |
| struct | KernelSpec |
| struct | OptimizedGraph |
| class | Tensor |
| float32 / int32 tensor (rank 1–6), row-major. Eager: owns a buffer. Symbolic: node in a Func graph (no buffer until run). 更多... | |
| class | TF |
TF2-like namespace module. Script: tf <- eve.TF(); Default eager; tf.func() traces a graph for compile/run. 更多... | |
枚举 | |
| enum class | OpType : uint8_t { Placeholder = 0 , Const , Add , Sub , Multiply , Divide , AddScalar , SubScalar , MulScalar , DivScalar , Neg , Abs , Sqrt , Exp , Log , Sin , Cos , Tanh , Relu , Sigmoid , Gelu , Silu , PowScalar , Clamp , MaximumScalar , MinimumScalar , Where , MatMul , Transpose , Permute , Reshape , Flatten , Softmax , LogSoftmax , LayerNorm , RMSNorm , Conv1d , Conv2d , MaxPool2d , AvgPool2d , Embedding , Concat , Slice , ReduceSum , ReduceMean , ReduceMin , ReduceMax , ArgMax , Cast , ScaledDotProductAttention , Resize2d } |
| enum class | GroupKind : uint8_t { Elementwise , MatMul , Conv1d , Conv2d , MaxPool2d , AvgPool2d , Softmax , LayerNorm , RMSNorm , Reduce , ArgMax , Embedding , Concat , Slice , Permute , Sdpa , Resize2d , Alias } |
| enum class | DType : uint8_t { Float32 = 0 , Int32 = 1 , Fp16 = 2 , Fp8E4M3 = 3 , Fp4E2M1 = 4 , Int8 = 5 , Int4 = 6 } |
| Tensor element types. 更多... | |
函数 | |
| bool | gpuReduce (const float *data, int size, int op, float &outResult) |
| GPU-accelerated reduction for large eager tensors. op: 0 = sum, 1 = min, 2 = max. Returns false (caller should fall back to CPU) when Vulkan/gpgpu isn't available. | |
| bool | generateKernel (const Graph &graph, const FusedGroup &group, KernelSpec &out) |
| bool | generateMatMulVariant (const Graph &graph, const FusedGroup &group, bool tiled, KernelSpec &out) |
| OptimizedGraph | optimizeGraph (const Graph &graph, int outputNode) |
| int | groupKernelCount (const OptimizedGraph &opt) |
| const char * | dtypeName (DType dtype) |
| bool | parseDType (const std::string &name, DType &out) |
| Module_IMPL (TF, new TF()) | |
变量 | |
| constexpr int | kMaxKernelBindings = 8 |
枚举类型说明
◆ DType
|
strong |
Tensor element types.
Script-visible tensors are float32; int32 tensors are used for index data (argmax outputs, embedding lookups, cast("int32")). Int32 values are stored losslessly as floats for |v| < 2^24, which comfortably covers model vocabularies / sequence lengths / simulation ids used in games.
| 枚举值 | |
|---|---|
| Float32 | |
| Int32 | |
| Fp16 | |
| Fp8E4M3 | |
| Fp4E2M1 | |
| Int8 | |
| Int4 | |
◆ GroupKind
|
strong |
Kernel group produced by the optimizer (AITemplate-style fusion).
A group is either:
- an Elementwise chain: multiple graph nodes fused into ONE generated kernel; nodes inside the chain never materialize a buffer;
- a MatMul / Conv group with an optional bias + elementwise epilogue fused into the same kernel;
- a single specialized op kernel (softmax, layernorm, attention, ...);
- an Alias (reshape / flatten / cast): no kernel, output aliases input.
| 枚举值 | |
|---|---|
| Elementwise | |
| MatMul | |
| Conv1d | |
| Conv2d | |
| MaxPool2d | |
| AvgPool2d | |
| Softmax | |
| LayerNorm | |
| RMSNorm | |
| Reduce | |
| ArgMax | |
| Embedding | |
| Concat | |
| Slice | |
| Permute | |
| Sdpa | |
| Resize2d | |
| Alias | |
在文件 Optimizer.h 第 21 行定义.
◆ OpType
|
strong |
函数说明
◆ dtypeName()
| const char * eve::tensor::dtypeName | ( | DType | dtype | ) |
在文件 Tensor.cpp 第 26 行定义.
引用了 Float32, Fp16, Fp4E2M1, Fp8E4M3, Int32, Int4 , 以及 Int8.
被这些函数引用 eve::tensor::Tensor::getDtype().
◆ generateKernel()
| bool eve::tensor::generateKernel | ( | const Graph & | graph, |
| const FusedGroup & | group, | ||
| KernelSpec & | out | ||
| ) |
Generate the specialized GLSL kernel(s) for a fused group. Returns false when the group cannot be lowered (e.g. too many inputs for the fixed 8-binding descriptor layout) — callers fall back to the CPU interpreter.
在文件 KernelGen.cpp 第 972 行定义.
引用了 Alias, ArgMax, AvgPool2d, Concat, Conv1d, Conv2d, Elementwise, Embedding, graph, group, eve::tensor::FusedGroup::kind, LayerNorm, MatMul, MaxPool2d, Permute, Reduce, Resize2d, RMSNorm, Sdpa, Slice , 以及 Softmax.
被这些函数引用 eve::tensor::GpuProgram::tryBuild().
◆ generateMatMulVariant()
| bool eve::tensor::generateMatMulVariant | ( | const Graph & | graph, |
| const FusedGroup & | group, | ||
| bool | tiled, | ||
| KernelSpec & | out | ||
| ) |
Generate a specific matmul variant for autotuning (tiled=false: thread-per- output naive; tiled=true: shared-memory 16x16 tiles). Only rank-2 matmuls support the tiled variant.
在文件 KernelGen.cpp 第 1000 行定义.
引用了 graph, group, eve::tensor::FusedGroup::kind , 以及 MatMul.
被这些函数引用 eve::tensor::GpuProgram::tryBuild().
◆ gpuReduce()
| bool eve::tensor::gpuReduce | ( | const float * | data, |
| int | size, | ||
| int | op, | ||
| float & | outResult | ||
| ) |
GPU-accelerated reduction for large eager tensors. op: 0 = sum, 1 = min, 2 = max. Returns false (caller should fall back to CPU) when Vulkan/gpgpu isn't available.
在文件 GpuBackend.cpp 第 328 行定义.
被这些函数引用 eve::tensor::TF::reduceMax(), eve::tensor::TF::reduceMin() , 以及 eve::tensor::TF::reduceSum().
◆ groupKernelCount()
| int eve::tensor::groupKernelCount | ( | const OptimizedGraph & | opt | ) |
Number of groups that need GPU kernels (i.e. not Alias).
在文件 Optimizer.cpp 第 498 行定义.
引用了 Alias , 以及 eve::tensor::OptimizedGraph::groups.
◆ Module_IMPL()
| eve::tensor::Module_IMPL | ( | TF | , |
| new | TF() | ||
| ) |
◆ optimizeGraph()
| OptimizedGraph eve::tensor::optimizeGraph | ( | const Graph & | graph, |
| int | outputNode | ||
| ) |
Optimize a traced graph:
- dead-code elimination + topological sort;
- constant folding of elementwise chains over Const nodes;
- elementwise chain fusion into FusedGroups;
- matmul/conv bias + activation epilogue fusion;
- static memory planning with buffer reuse.
在文件 Optimizer.cpp 第 175 行定义.
引用了 a, Add, Alias, b, eve::tensor::FusedGroup::biasNode, c, Cast, Const, Conv1d, Conv2d, Elementwise, eve::tensor::FusedGroup::epilogue, Flatten, graph, eve::tensor::OptimizedGraph::groupOrder, eve::tensor::OptimizedGraph::groups, id, idx, eve::tensor::GraphNode::in0, eve::tensor::GraphNode::in1, eve::tensor::FusedGroup::inputs, eve::tensor::kernels::isElementwiseOp(), eve::tensor::FusedGroup::kind, m, MatMul, n, eve::tensor::Graph::node(), eve::tensor::Graph::nodeCount(), eve::tensor::FusedGroup::nodes, eve::tensor::OptimizedGraph::nodeSlot, ok, eve::tensor::OptimizedGraph::order, eve::tensor::FusedGroup::outputNode, eve::tensor::OptimizedGraph::outputNode, p, eve::tensor::OptimizedGraph::persistentSlots, Placeholder, Reshape, s, eve::tensor::GraphNode::size, eve::tensor::OptimizedGraph::slotSize, eve::tensor::GraphNode::type , 以及 u.
◆ parseDType()
| bool eve::tensor::parseDType | ( | const std::string & | name, |
| DType & | out | ||
| ) |
在文件 Tensor.cpp 第 39 行定义.
引用了 Float32, Fp16, Fp4E2M1, Fp8E4M3, Int32, Int4, Int8 , 以及 name.
被这些函数引用 eve::tensor::TF::cast() , 以及 eve::tensor::TF::quantizeWeight().
变量说明
◆ kMaxKernelBindings
|
constexpr |
Max storage bindings available per generated kernel.
在文件 KernelGen.h 第 59 行定义.