Android NEON 库

发布于 2024-11-27 01:22:12 字数 317 浏览 3 评论 0原文

有没有其他针对 math-neon 优化的免费矢量库? 我想在我的代码中利用霓虹灯,我有很多对象,我正在做很多简单的矢量物理数学,比如矢量相加,相乘,点它们,这些是 3d 向量,但如果我能做很多Faster 2d 应该也可以,问题是,值得使用 neon 吗?例如,让我们取 100000 个点,我需要计算它们的运动、碰撞等。我目前正在使用我自己的数学,它基于内联函数,可以说我也想使用带有矩阵的假设霓虹灯库,目前我我正在使用glm,它做得很好,但是它可以更快吗?在我的例子中,ndk 中的 arm-abi 和 arm7-abi 之间的速度优势约为 30%,neon 可以更快吗?或者我的代码在编译时会被转换为 neon?

Is there any other free vector library optimized for neon that math-neon?
I would like to get advantage of neon in my code, i have lot of objects and i am doing lot of simple vector physics-math, like adding vectors, multiplying, dotting them, those are 3d vectors but if i could make it a lot faster 2d should be ok too, the question is, is it worth using neon? for example lets take 100000 points, i need to calculate their movement, collisions etc. I am currently using my own math, and its based on inline functions, lets say that i would like to use my hypothetical neon library with matrices too, currently i am using glm for that, and its doing fine, but could it be faster? Speed advantage between arm-abi and arm7-abi in ndk is about 30 percent in my case, can neon be faster or maybe my code is translated to neon in compile time?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

薄凉少年不暖心 2024-12-04 01:22:12

您可以检查eigen。它具有特殊代码,当激活 neon 指令支持时会激活该代码。

You can check eigen. It has special code that it is activated when neon instruction support is activated.

伏妖词 2024-12-04 01:22:12

就像其他人提到的那样,您应该研究 Eigen,它可能对您来说已经足够好了。但如果您想要充分的性能(远优于 30% 增益,更像是 300% 增益),您应该自己使用 NEON 代码,并确保整个内部循环完全用 NEON 编写(而不是任何 CPU 或 VFP 代码)。

如果您只是 NEON 优化循环的一部分而不是整个循环,您会受到重大惩罚,因此 NEON 代码可能只比常规 C 代码快 30%,甚至可能慢。但完整的 NEON 循环通常可以为您带来 300% - 2000% 的加速!

如果您正在为 ARM Cortex-A9 进行开发,那么 NEON C Intrinsics 应该足够好,但对于 ARM Cortex-A8 设备,您通常需要 NEON 汇编代码才能获得全部性能。我在“http://www.shervinemami.info/ 提供了有关如何 NEON 优化整个循环的更多信息armAssembly.html"

Like someone else mentioned, you should look into Eigen, it is probably good enough for you. But if you want full performance (much better than 30% gain, more like 300% gain), you should use NEON code yourself and make sure your entire inner loop is written completely with NEON (not any CPU or VFP code).

If you just NEON optimize part of your loop instead of the entire loop, you get major penalties and so the NEON code is perhaps just 30% faster or perhaps even slower than regular C code. But a full NEON loop can often give you 300% - 2000% speedup!

If you are developing for an ARM Cortex-A9 then NEON C Intrinsics should be good enough, but for ARM Cortex-A8 devices you usually need NEON Assembly code to get full performance. I give some more info on how to NEON optimize your whole loop at "http://www.shervinemami.info/armAssembly.html"

一腔孤↑勇 2024-12-04 01:22:12

如果目标架构支持,即为 armeabi-v7a 编译,则代码将针对 NEON 进行编译。为此,只需将 armeabi-v7a 添加到应用的 Application.mk 文件中的目标列表中即可。

Code is compiled for NEON if the target architecture supports it, namely, if it is compiled for armeabi-v7a. To do this, simply add armeabi-v7a to the list of targets in your app's Application.mk file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文