arm_neon.h 是否缺少所有 float16_t 类型?
我正在使用 NEON SIMD 指令编写 Android 应用程序的一部分,针对 Cortex A8 处理器。根据本参考手册,NEON支持16位和 32 位浮点数,即 float16_t
和 float32_t
。当我尝试使用 float16_t
及其所有关联的向量类型时,我收到一条错误,指出该类型未声明。当查看arm_neon.h
的内容时,我发现这个类型确实是未声明的。
这是有原因的吗? ARM的Advanced SIMD显然支持这样的数据类型和指令。有人遇到/解决过这个问题吗?它在任何地方都有记录吗?
I'm using NEON SIMD instruction to write a part of an Android app, targeting Cortex A8 processors. According to this reference manual, NEON supports 16-bit and 32-bit floats, that is float16_t
and float32_t
. When I tried using float16_t
and all of its associated vector types, I got an error saying that this type is undeclared. When looking through contents of arm_neon.h
, I found that this type is indeed undeclared.
Is there a reason for this? ARM's Advanced SIMD obviously supports such data types and instructions. Has anyone encountered / resolved this? Is it documented anywhere?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Cortex-A8 处理器在硬件中不支持 16 位浮点。
Cortex-A9 处理器确实具有在 16 位和 32 位浮点之间进行转换的指令,但这就是您所获得的全部内容(这就是 IEEE 上应该提供的全部内容) -754系统——float16不用于算术,仅用于紧凑存储)。使用模型是加载 float16 数据,将其转换为 float32 进行算术,然后在存储之前转换回 float16。
Cortex-A8 processors do not support 16-bit floats in hardware.
Cortex-A9 processors do have instructions to convert between 16- and 32-bit floating-point, but that's all you get (and that's all that should be provided on an IEEE-754 system -- float16 is not intended for arithmetic, only for compact storage). The usage model is to load float16 data, convert it to float32 to do your arithmetic, and then convert back to float16 before storing.
您能否在链接的文档中指定调用这些 16 位浮点运算的示例部分?我看到定义了很多 16 位整数运算。你用的是ARM的编译器还是gcc?你说的是 SIMD 还是 NEON?
“NEON™ 技术建立在 SIMD 概念的基础上,具有专用模块,可提供 128 位宽的矢量运算,而 ARMv6 架构中的 SIMD 为 32 位宽。”
编辑:
我尝试了这个,没有编译器抱怨:
使用这个命令行:
使用 codesourcery lite 2011.03
Can you specify an example section in the document you linked where these 16 bit float operations are called out? I see quite a few 16 bit integer operations defined. Are you using ARM's compiler or gcc? And are you talking about SIMD or NEON?
"NEON™ technology builds on the concept of SIMD with a dedicated module to provide 128-bit wide vector operations, compared to the 32bit wide SIMD in the ARMv6 architecture."
EDIT:
I tried this with no compiler complaints:
using this command line:
Using codesourcery lite 2011.03
嗯,对SIMD指令不太熟悉。您发布的文档没有提到 float16_t,而是也使用了车道数(例如 float16x4_t)
另外,您是否尝试过“Float16_t”而不是“float16_t”?
这是我的家用笔记本电脑,因此我无法访问 ARM 编译器,但明天我会尝试在办公室重新检查这一点
Hmm, not too familiar with SIMD instructions. The document you posted does not mention float16_t, but instead uses the number of lanes as well (e.g. float16x4_t)
Also, did you try "Float16_t" instead of "float16_t" ?
This is my home laptop, so I don't have access to the ARM compiler, but I'll try and recheck this tomorrow in the office