lui*_*bal 2 programming-languages language-design simd
(对不起,如果这听起来像是一个咆哮,但这是一个真正的问题,我很欣赏真正的答案)
I understand that since C is so old, it might have not made sense to add it back then(MMX didn't even exist back then). But since then there was C99, and still there are no standard for SIMD variables(as far as I know).
By "SIMD variables", I mean something like:
vec2_int a = {2, 2};
vec2_int b = {3, 3};
a += b;
Run Code Online (Sandbox Code Playgroud)
I also understand that this can be done with structs and (in theory) the compiler should optimize it to use SIMD when appropriate anyway.
But I recently saw a post from Qt Labs which includes an example with types like "__m128i"(which look clearly non-standard), instead of relying on optimizations. Considering Qt is advertising this as greatly improving Qt's speed, I'm guessing compiler optimizations are being insufficient, at least for some programmers.
If it was just C, I'd think C was being stupid. But, as far as I know, newer languages such as C++, Java and C# don't include these either. C# has Mono.SIMD but it's not a primitive type(and since C# has a "decimal" keyword, I don't think they were trying to save types).
So here's what I'm noticing: Languages with vector primitive types seem to be the exception and not the rule. Because vector primitive types look so obvious, I'm guessing there's got to be some decent reasons NOT to include these types.
Does anyone here know why these types are so frequently excluded? Some links to rationales against adding them?
因为并非所有处理器都支持SIMD指令.C和C++(甚至Java和C#)等语言设计用于除台式计算机之外的不同类型的硬件,如微控制器.
目前,算法的矢量化不是自动的(尽管正在积极研究).必须明确编写"可矢量化"的算法,以利用执行环境的任何SIMD功能.
| 归档时间: |
|
| 查看次数: |
363 次 |
| 最近记录: |