[Libclc-dev] [PATCH 1/2] Add cross for double3 and double4
Tom Stellard
tom at stellard.net
Tue Mar 11 17:55:58 PDT 2014
On Tue, Mar 11, 2014 at 11:28:33PM +0000, Jeroen Ketema wrote:
>
> Good that you raised this question: This is code I lifted from our OpenCL static race detection tool (GPUVerify), which is not the most rigorous environment to test the code in (due to the way the tool treats floating point operations). So, suggestions how I can better test this are welcome.
>
We use piglit for testing: http://cgit.freedesktop.org/piglit and I
usually try to add a test there when I implement a new builtin. If
you have access to an OpenCL implementation, you could try to add tests
there. See tests/cl/program/execute and generated_tests/*-cl-*.py for
some good test examples.
-Tom
> Jeroen
>
> On 11 Mar 2014, at 23:16, Tom Stellard <tom at stellard.net> wrote:
>
> > On Tue, Mar 11, 2014 at 06:59:16PM +0000, Jeroen Ketema wrote:
> >
> > Both these patches look good. How are you testing these?
> >
> > -Tom
> >
> >> ---
> >> generic/include/clc/geometric/cross.h | 5 +++++
> >> generic/lib/geometric/cross.cl | 14 ++++++++++++++
> >> 2 files changed, 19 insertions(+)
> >>
> >> diff --git a/generic/include/clc/geometric/cross.h b/generic/include/clc/geometric/cross.h
> >> index 74117c0..eee0cc8 100644
> >> --- a/generic/include/clc/geometric/cross.h
> >> +++ b/generic/include/clc/geometric/cross.h
> >> @@ -1,2 +1,7 @@
> >> _CLC_OVERLOAD _CLC_DECL float3 cross(float3 p0, float3 p1);
> >> _CLC_OVERLOAD _CLC_DECL float4 cross(float4 p0, float4 p1);
> >> +
> >> +#ifdef cl_khr_fp64
> >> +_CLC_OVERLOAD _CLC_DECL double3 cross(double3 p0, double3 p1);
> >> +_CLC_OVERLOAD _CLC_DECL double4 cross(double4 p0, double4 p1);
> >> +#endif
> >> diff --git a/generic/lib/geometric/cross.cl b/generic/lib/geometric/cross.cl
> >> index 4c1bc6f..3b4ca6c 100644
> >> --- a/generic/lib/geometric/cross.cl
> >> +++ b/generic/lib/geometric/cross.cl
> >> @@ -9,3 +9,17 @@ _CLC_OVERLOAD _CLC_DEF float4 cross(float4 p0, float4 p1) {
> >> return (float4)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z,
> >> p0.x*p1.y - p0.y*p1.x, 0.f);
> >> }
> >> +
> >> +#ifdef cl_khr_fp64
> >> +#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> >> +
> >> +_CLC_OVERLOAD _CLC_DEF double3 cross(double3 p0, double3 p1) {
> >> + return (double3)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z,
> >> + p0.x*p1.y - p0.y*p1.x);
> >> +}
> >> +
> >> +_CLC_OVERLOAD _CLC_DEF double4 cross(double4 p0, double4 p1) {
> >> + return (double4)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z,
> >> + p0.x*p1.y - p0.y*p1.x, 0.f);
> >> +}
> >> +#endif
> >> --
> >> 1.8.3.4 (Apple Git-47)
> >>
> >>
> >> _______________________________________________
> >> Libclc-dev mailing list
> >> Libclc-dev at pcc.me.uk
> >> http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev
>
More information about the Libclc-dev
mailing list