I have this basic cross product declared like this in my kernel:
inline const Vec3 Cross(const Vec3 v1, const Vec3 v2)
{
Vec3 v;
v.x = v1.y*v2.z - v2.y*v1.z;
v.y = v1.z*v2.x - v2.z*v1.x;
v.z = v1.x*v2.y - v2.x*v1.y;
return v;
}
Though I get that floating point operations are generally speaking
order-dependent I was expecting given the simplicity of a cross product
that we'd still find Cross(v0,v1) = -Cross(v1,v0) yet when I build for the
avx2 target this is not what I'm seeing. For all other targets SSE2-AVX1 it
is working in the sense that the above property holds true.
Right now I'm working around by doing sort of a 96bit check if v0>v1 and if
it is then I swap the inputs but it's adding overhead. So I wanted to ask
if you guys would consider it a big or not on ispc side? Or is it simply
that I can't reasonably expect Cross(v0,v1) = -Cross(v1,v0) for the
generated code.
Thank you,
Morten S. Mikkelsen
--
You received this message because you are subscribed to the Google Groups
"Intel SPMD Program Compiler Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.