• 文档 >
  • TBE CPU 自动向量化
快捷方式

TBE CPU 自动向量化

FP8/16/32 自动向量化实现方法

template<typename InType, typename IndexType, typename OffsetType, typename OutType> static bool ALWAYS_INLINE EmbeddingSpMDM_autovec (const int64_t block_size, const int64_t output_size, const int64_t index_size, const int64_t data_size, const InType *input, const IndexType *indices, const OffsetType *offsets_or_lengths, const float *weights, bool normalize_by_lengths, OutType *out, const bool is_weight_positional, const bool use_offsets, const int64_t output_stride, const int64_t input_stride, const bool no_bag, const bool is_bf16_out, const bool is_bf16_in)

方法 EmbeddingSpMDM_ref 的 FP32 权重类型的自动向量化版本。

模板参数:
  • InType – 输入数据类型(使用 uint8_t

  • IndexType – 索引数据类型(使用 int64_t

  • OffsetType – 偏移数据类型(使用 int32_t

  • OutType – 输出数据类型(使用 float

参数:
  • block_size – 块中的元素数量(int64_t

  • output_size – 输出中的元素数量(int64_t

  • index_size – 索引中的元素数量(int64_t

  • data_size – 数据中的元素数量(int64_t

  • input – 输入地址(InType*

  • indices – 索引地址(IndexType*

  • offsets_or_lengths – 偏移地址或长度地址(OffsetType*

  • weights – 求和权重;可选,对于非加权求和可为 null(float*

  • normalize_by_lengths – 是否按长度进行归一化(bool

  • out – 输出地址(OutType*

  • is_weight_positional – 如果为 true,权重是位置性的;对于 FP32 自动向量化实现,设置为 falsebool

  • use_offsets – 如果为 true,将使用偏移而不是长度;对于 FP32 自动向量化实现,设置为 truebool

  • output_stride – 如果为 -1,则 output_stride 等于 block_size;对于 FP32 自动向量化实现,设置为 -1(int64_t

  • input_stride – 如果为 -1,则 input_stride 等于 block_size;对于 FP32 自动向量化实现,设置为 -1(int64_t

  • scale_bias_last – 如果为 true,scale 和 bias 出现在每行的末尾;对于 FP32 自动向量化实现,设置为 truebool

  • no_bag – 如果为 true,则没有 embedding bag;对于 FP32 自动向量化实现,设置为 falsebool

  • is_bf16_out – 如果为 true,输出为 BFLOAT16 类型;对于 FP32 自动向量化实现,设置为 falsebool

  • is_bf16_in – 如果为 true,输入为 BFLOAT16 类型;对于 FP32 自动向量化实现,设置为 falsebool

template<typename IndexType, typename OffsetType, typename OutType> static bool ALWAYS_INLINE EmbeddingSpMDMFP8_autovec (const int64_t block_size, const int64_t output_size, const int64_t index_size, const int64_t data_size, const uint8_t *input, const IndexType *indices, const OffsetType *offsets_or_lengths, const float *weights, bool normalize_by_lengths, OutType *out, const bool is_weight_positional, const bool use_offsets, const int64_t output_stride, const int64_t input_stride, const int exponent_bits, const int exponent_bias, const bool is_bf16_out)

方法 EmbeddingSpMDM_ref 的 FP8 权重类型的自动向量化版本。

模板参数:
  • InType – 输入数据类型(使用 uint8_t

  • IndexType – 索引数据类型(使用 int64_t

  • OffsetType – 偏移数据类型(使用 int32_t

  • OutType – 输出数据类型(使用 float

参数:
  • block_size – 块中的元素数量(int64_t

  • output_size – 输出中的元素数量(int64_t

  • index_size – 索引中的元素数量(int64_t

  • data_size – 数据中的元素数量(int64_t

  • input – 输入地址(InType*

  • indices – 索引地址(IndexType*

  • offsets_or_lengths – 偏移地址或长度地址(OffsetType*

  • weights – 求和权重;可选,对于非加权求和可为 null(float*

  • normalize_by_lengths – 是否按长度进行归一化(bool

  • out – 输出地址(OutType*

  • is_weight_positional – 如果为 true,权重是位置性的;对于 FP8 自动向量化实现,设置为 falsebool

  • use_offsets – 如果为 true,将使用偏移而不是长度;对于 FP8 自动向量化实现,设置为 truebool

  • output_stride – 如果为 -1,则 output_stride 等于 block_size;对于 FP8 自动向量化实现,设置为 -1(int64_t

  • exponent_bits – 指数中使用的位数

  • exponent_bias – 指数中使用的偏差

  • is_bf16_out – 如果为 true,输出为 BFLOAT16 类型;对于 FP8 自动向量化实现,设置为 falsebool

文档

查阅 PyTorch 的全面开发者文档

查看文档

教程

获取面向初学者和高级开发者的深入教程

查看教程

资源

查找开发资源并获得问题解答

查看资源