Gaurav,
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.
The purpose of CPU backend code is for debugging only. You can debug inside kernel if you disable line generation in cpp file (use -nl option)
Gaurav,
BRT_RUNTIME = cal
mkdir brookgenfiles | "$(BROOKROOT)\sdk\bin\brcc_d.exe" -p cal -o "$(ProjectDir)\brookgenfiles\$(InputName)" "$(InputPath)"
Ouput is broken yet. Why?
That is strange. Are you sure it works without -p cal option? I mean how did you test it with template error? Could you post the test case?
I just use the simple test in this case.
kernel void motion_estimation(unsigned char src[],
unsigned char ref[],
int width,
int height,
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.
You are right. I tried to restart VS, but it did not help.
The windows restart helps.
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.
brcc returns the same type from conditional expressions as of operands. You can try this-
if ((int)(sad >= testsad) && (mvlength > abs(y) + abs(x)))
No, I suppose your variant is incorrect. I have checked.
The correct:
if (((int)sad >= (int)testsad) && (mvlength > abs(y) + abs(x)))
I just figured out it.