AnsweredAssumed Answered

Using inline assembly in OpenCL kernels (still not perfect)..

Question asked by oscarbarenys1 on Mar 4, 2013
Latest reply on Mar 16, 2013 by oscarbarenys1


much to my surprise is possible now to include asm() statements that include AMDIL instructions and that will pass down to AMDIL code generation..

still I'm not able to pass  variables to registers correctly:

this is similar to NV OCL

for example getting access to cycle counter:

    asm ("mov r2,Tmr2");

can work I think but using like:

int counter;

asm ("mov %0,Tmr2","=r"(counter));

doesn't work..

also related I'm asking if needing of op and arg modifiers to be set for example a line of OpenCL code has:

double r=a+b;

which seeing AMDIL code can be

dadd r1.xy__, r2.xyxy, r3.xyxy_neg(yw)

assuming inline asm works we need something like:

asm ("dadd r1, %0, %1": "d"(a), "d"(b) );

and op modifiers will be automatically  fixed or basically all modifiers like swizzling set i.e.:

asm ("dadd r1.xy__, %0.xyxy, %1.xyxy_neg(yw)": "d"(a), "d"(b) );

Many thanks..