载入中...
搜索中...
未找到
eve::tensor 命名空间参考

命名空间

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

enum class eve::tensor::DType : uint8_t
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 

在文件 Tensor.h22 行定义.

◆ GroupKind

enum class eve::tensor::GroupKind : uint8_t
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.h21 行定义.

◆ OpType

enum class eve::tensor::OpType : uint8_t
strong
枚举值
Placeholder 
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 

在文件 Graph.h19 行定义.

函数说明

◆ dtypeName()

const char * eve::tensor::dtypeName ( DType  dtype)

在文件 Tensor.cpp26 行定义.

引用了 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.cpp972 行定义.

引用了 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.cpp1000 行定义.

引用了 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.cpp328 行定义.

引用了 data , 以及 v.

被这些函数引用 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.cpp498 行定义.

引用了 Alias , 以及 eve::tensor::OptimizedGraph::groups.

◆ Module_IMPL()

eve::tensor::Module_IMPL ( TF  ,
new   TF() 
)

◆ optimizeGraph()

◆ parseDType()

bool eve::tensor::parseDType ( const std::string &  name,
DType out 
)

在文件 Tensor.cpp39 行定义.

引用了 Float32, Fp16, Fp4E2M1, Fp8E4M3, Int32, Int4, Int8 , 以及 name.

被这些函数引用 eve::tensor::TF::cast() , 以及 eve::tensor::TF::quantizeWeight().

变量说明

◆ kMaxKernelBindings

constexpr int eve::tensor::kMaxKernelBindings = 8
constexpr

Max storage bindings available per generated kernel.

在文件 KernelGen.h59 行定义.