I wonder, what is advantage of using cpu emulator? I understand that instructions are executed on cpu. And what...? Anyway I can not to enter kernel and debugging inside.
BRT_RUNTIME = cal
mkdir brookgenfiles | "$(BROOKROOT)\sdk\bin\brcc_d.exe" -p cal -o "$(ProjectDir)\brookgenfiles\$(InputName)" "$(InputPath)"
Ouput is broken yet. Why?
I just use the simple test in this case.
kernel void motion_estimation(unsigned char src,
unsigned char ref,
out double sad<>,
out int mvx<>,
out int mvy<>
// Output position
int2 vPos = instance().xy;
int i = vPos.x; // width
int j = vPos.y; // height
int ix = i * 16;
int jy = j * 16;
sad = 2.0;
That's it. So, no templates. With -p cal option output sad contains garbage. With -p cpu everything is ok (2.0 value).
Something is going wrong. It seems you are running your code under CPU backend. Make sure you close your visual studo or command prompt after changing environment variable and then open it again to read the updated env variable.
if ((sad >= testsad) && (mvlength > abs(y) + abs(x)))
sad = testsad;
mvlength = abs(y) + abs(x);
mvy = y;
mvx = x;
ERROR--1: In Binary expression: Mismatched operands: both must have same type and same number of components
1> Statement: sad >= testsad && mvlength > abs(y) + abs(x) in sad >= testsad && mvlength > abs(y) + abs(x)
1> Expression : sad >= testsad, Type : double
1> Expression : mvlength > abs(y) + abs(x), Type : int
Try to do this : if (((int)sad >= (int)testsad) && (mvlength > abs(y) + abs(x))) and this condition never is true.