Build-in "cross( float4, float4 )" function returns invalid values on K8 core kernel

Discussion created by redditisgreat on Jan 8, 2010
Latest reply on Feb 11, 2010 by genaganna

compiled on an Athlon64 X2


float4 n =  cross( ab, -ca ) ;

n = normalize( n );  // result fucks up this line ==> n = (NaN,NaN,NaN,NaN)

</code> is computed corectly but n.w is not 0 as per spec. but NaN. But only some of the time.

More specifically, for some builds of the same kernel it works and for some it doesn't.

I build the same Cl program multiple times with different compile-time constants (subproblem size) as build options. The compiletime constant has no influence on the parameters of the "cross" call though, it is related to other parts of the code.

There is one problematic subproblem size lets say it's 6.

If I define  a


clBuildProgram( ... , "-D SUBSIZE=N", ... )

// setup Kernel parameter

// run Kernel

// evaluate results


like this.

The undefined behavior happens whenever I run multiple testcases like

testcase<4>(); testcase<6>();


testcase<6>(); testcase<4>();

but not in

testcase<6>(); testcase<6>();




I know I can work arround te problem by simply setting the n.w = 0.0; but this undefined behavior makes me nervous and I'd like to know what's going on.