Skip to content

asc_float2hif8 (废弃)

产品支持情况

  • Ascend 950PR/Ascend 950DT:支持
  • Atlas A3 训练系列产品/Atlas A3 推理系列产品:不支持
  • Atlas A2 训练系列产品/Atlas A2 推理系列产品:不支持
  • Atlas 200I/500 A2 推理产品:不支持
  • Atlas 推理系列产品AI Core:不支持
  • Atlas 推理系列产品Vector Core:不支持
  • Atlas 训练系列产品:不支持

功能说明

头文件路径为:"c_api/reg_compute/reg_convert.h"

将float类型转化为hifloat8_t类型,并支持多种舍入模式,饱和/非饱和模式。

关于舍入模式和饱和/非饱和模式的详细说明,请参见舍入模式

由于源操作数与目的操作数类型位宽比为4:1,写入数据时需要将一个VL大小的数据分为四部分,根据不同接口选取索引0、索引1、索引2或者索引3。

函数原型

C++
// ROUND舍入模式,非饱和模式,数据写入索引为0的位置
__simd_callee__ inline void asc_float2hif8_rna(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// ROUND舍入模式,饱和模式,数据写入索引为0的位置
__simd_callee__ inline void asc_float2hif8_rna_sat(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// ROUND舍入模式,非饱和模式,数据写入索引为1的位置
__simd_callee__ inline void asc_float2hif8_rna_v2(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// ROUND舍入模式,饱和模式,数据写入索引为1的位置
__simd_callee__ inline void asc_float2hif8_rna_sat_v2(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// ROUND舍入模式,非饱和模式,数据写入索引为2的位置
__simd_callee__ inline void asc_float2hif8_rna_v3(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// ROUND舍入模式,饱和模式,数据写入索引为2的位置
__simd_callee__ inline void asc_float2hif8_rna_sat_v3(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// ROUND舍入模式,非饱和模式,数据写入索引为3的位置
__simd_callee__ inline void asc_float2hif8_rna_v4(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// ROUND舍入模式,饱和模式,数据写入索引为3的位置
__simd_callee__ inline void asc_float2hif8_rna_sat_v4(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// HYBRID舍入模式,非饱和模式,数据写入索引为0的位置
__simd_callee__ inline void asc_float2hif8_rh(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// HYBRID舍入模式,饱和模式,数据写入索引为0的位置
__simd_callee__ inline void asc_float2hif8_rh_sat(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// HYBRID舍入模式,非饱和模式,数据写入索引为1的位置
__simd_callee__ inline void asc_float2hif8_rh_v2(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// HYBRID舍入模式,饱和模式,数据写入索引为1的位置
__simd_callee__ inline void asc_float2hif8_rh_sat_v2(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// HYBRID舍入模式,非饱和模式,数据写入索引为2的位置
__simd_callee__ inline void asc_float2hif8_rh_v3(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// HYBRID舍入模式,饱和模式,数据写入索引为2的位置
__simd_callee__ inline void asc_float2hif8_rh_sat_v3(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// HYBRID舍入模式,非饱和模式,数据写入索引为3的位置
__simd_callee__ inline void asc_float2hif8_rh_v4(vector_hifloat8_t& dst, vector_float src, vector_bool mask)
// HYBRID舍入模式,饱和模式,数据写入索引为3的位置
__simd_callee__ inline void asc_float2hif8_rh_sat_v4(vector_hifloat8_t& dst, vector_float src, vector_bool mask)

参数说明

表1 参数说明

参数名输入/输出描述
dst输出目的操作数(矢量数据寄存器)。
src输入源操作数(矢量数据寄存器)。
mask输入源操作数掩码(掩码寄存器),用于指示在计算过程中哪些元素参与计算。对应位置为1时参与计算,为0时不参与计算。mask未筛选的元素在输出中置零。

矢量数据寄存器和掩码寄存器的详细说明请参见reg数据类型定义

返回值说明

流水类型

PIPE_V

约束说明

  • 开启饱和模式和非饱和模式时,需配置ctrl寄存器,ctrl寄存器的详细说明请参见asc_set_ctrl.md

调用示例

C++
vector_float src;
vector_hifloat8_t dst;
vector_bool mask;
asc_float2hif8_rna(dst, src, mask);

免责声明:本站内容由 asc-devkit 仓 master 分支自动编译生成,属于持续开发版本,可能存在缺陷,仅供预览与参考。如需稳定及商用资料,请查阅官方 昇腾社区