在GPU整数位运算性能 [英] Performance of integer and bitwise operations on GPU

查看:2077
本文介绍了在GPU整数位运算性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然GPU是应该与浮点数据类型的使用,我很感兴趣,能多快GPU工艺位运算。这些都是CPU以最快的速度,但GPU模拟位运算或者他们在硬件上完全计算的?我打算使用它们里面有写GLSL着色器程序。此外,我会想,如果按位运算有充分的preformance,整数数据类型应该还可以,但我需要了解它的确认。

Though GPUs are supposed for use with floating point data types, I'd be interested in how fast can GPU process bitwise operations. These are the fastest possible on CPU, but does GPU emulate bitwise operations or are they fully computed on hardware? I'm planning to use them inside shader programs written with GLSL. Also I'd suppose that if bitwise operations have full preformance, integer data types should have also, but I need confirmation on that.

要更precise,有针对性版本的OpenGL 3.2和GLSL 1.5。应该运行这个硬件是任何的Radeon HD显卡和GeForce 8系列和更新..如果有相关的位运算/整数处理速度OpenGL和GLSL的较新版本的一些大的变化,我会很高兴,如果你'会指出来。

To be more precise, targeted versions are OpenGL 3.2 and GLSL 1.5. Hardware that should run this is any Radeon HD graphics card and GeForce series 8 and newer.. If there are some major changes in newer versions of OpenGL and GLSL related to processing speeds of bitwise operations/integers, I'd be glad if you'll point them out.

推荐答案

这个问题是部分答案
在GPU 整数计算​​

This question was partially answered Integer calculations on GPU

在短期现代GPU拥有32位数据的等效INT和FP性能。所以,你的逻辑操作会以相同的速度运行。

In short modern GPUs have equivalent INT and FP performance for 32bit data. So your logical operations will run at the same speed.

从编程的角度来看,如果你正在处理标量整型数据,你会失去效能。类似的GPU平行,包装业务工作。

From a programming perspective you will lose performance if you are dealing with SCALAR integer data. GPUs like working with PARALLEL and PACKED operations.

for(int i=0; i<LEN_VEC4; i++)
    VEC4[i] = VEC4[i] * VEC4[i]; // (x,y,z,w) * (x,y,z,w)

如果你正在做这样的事情...

If you're doing something like...

for(int i=0; i<LEN_VEC4; i++)
    VEC4[i].w = (VEC4[i].x & 0xF0F0F0F0) | (VEC4[i].z ^ 0x0F0F0F0F) ^ VEC4[i].w;

...你会遇到性能问题的同一矢量的元素做许多不同的操作。

...doing many different operations on elements of the same vector you will run into performance problems.

这篇关于在GPU整数位运算性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆