Consider the following:
% cat bug1.br
#include
#include
kernel void test(int x, int y, float a<>, out float b <>
{
b = 42;
}
int main(int argc, char **argv)
{
float in_data[10];
float out_data[10];
float a < 10 >;
float b < 10 >;
int i, j;
for (i = 0; i < 10; i++)
in_data[ i ] = 11 * i;
streamRead(a, in_data);
streamRead(b, in_data);
test(0, 0, a, b);
streamWrite(b, out_data);
for (i = 0; i < 10; i++)
printf("%i ", (int) out_data[ i ]);
printf("\n");
return 0;
}
% brcc bug1.br
% g++ bug1.cpp -I/opt/amd/brook/sdk/include -lbrook -L/opt/amd/brook/sdk/lib -o bug1
% env DISPLAY=:0 BRT_RUNTIME=cal ./bug1
0 11 22 33 44 55 66 77 88 99
% uname -a
Linux brook.hrl.com 2.6.18-92.1.18.el5 #1 SMP Wed Nov 5 09:00:19 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
% brcc -v 2>&1 |head -2
Brook+ Compiler
Version: 1.01.0a Built: Oct 10 2008, 14:33:31
% rpm -q fglrx64_7_1_0 xorg-x11-server-Xorg
fglrx64_7_1_0-8.531-1
xorg-x11-server-Xorg-1.1.1-48.41.el5_2.1
% cat /etc/redhat-release
Red Hat Enterprise Linux Client release 5.2 (Tikanga)
% lspci|grep VGA
02:00.0 VGA compatible controller: ATI Technologies Inc Unknown device 9452
% grep -2 "Version: 8.53" /var/log/Xorg.0.log
(II) fglrx(0): Kernel Module Version Information:
(II) fglrx(0): Name: fglrx
(II) fglrx(0): Version: 8.53.4
(II) fglrx(0): Date: Aug 30 2008
(II) fglrx(0): Desc: ATI FireGL DRM kernel module
% grep Chipset /var/log/Xorg.0.log
(--) Chipset Supported AMD Graphics Processor (0x9452) found
(--) fglrx(0): Chipset: "AMD FireStream 9250" (Chipset = 0x9452)
It would seem that either the kernel is having no effect, or it is having effect somewhere other than where the stream b is.
Any of the following makes it work correctly:
- Reducing the number of arguments (dropping x, y, or a)
- Using float instead of int for x, y, or both
- Using the cpu runtime
- Using non-AMD brook 0.5_beta1 and running on a Tesla card using the ogl backend.
P.S. Came across this when posting some of my brook code (which I was running on Tesla) to work with brook+ ant FireStream 9250.