[Libclc-dev] [PATCH 2/4] spirv: remove step/smoothstep apis not defined for SPIR-V

David Airlie via Libclc-dev libclc-dev at lists.llvm.org
Fri Oct 11 15:13:41 PDT 2019


On Sat, Oct 12, 2019 at 7:17 AM Jan Vesely <jan.vesely at rutgers.edu> wrote:
>
> On Fri, 2019-09-27 at 10:59 +1000, Dave Airlie via Libclc-dev wrote:
> > ---
> >  libclc/generic/lib/common/smoothstep.cl | 3 ++-
> >  libclc/generic/lib/common/step.cl       | 3 ++-
> >  2 files changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/libclc/generic/lib/common/smoothstep.cl b/libclc/generic/lib/common/smoothstep.cl
> > index 68d1a13ab39..9ff41e13291 100644
> > --- a/libclc/generic/lib/common/smoothstep.cl
> > +++ b/libclc/generic/lib/common/smoothstep.cl
> > @@ -46,10 +46,11 @@ SMOOTH_STEP_DEF(double, double, SMOOTH_STEP_IMPL_D);
> >
> >  _CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, smoothstep, double, double, double);
> >
> > +#ifndef CLC_SPIRV // SPIRV doesn't define these
> >  SMOOTH_STEP_DEF(float, double, SMOOTH_STEP_IMPL_D);
> >  SMOOTH_STEP_DEF(double, float, SMOOTH_STEP_IMPL_D);
> >
> >  _CLC_V_S_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, smoothstep, float, float, double);
> >  _CLC_V_S_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, smoothstep, double, double, float);
> > -
> > +#endif
> >  #endif
> > diff --git a/libclc/generic/lib/common/step.cl b/libclc/generic/lib/common/step.cl
> > index 4b022f1316c..3ceec7b8be3 100644
> > --- a/libclc/generic/lib/common/step.cl
> > +++ b/libclc/generic/lib/common/step.cl
> > @@ -45,10 +45,11 @@ STEP_DEF(double, double);
> >  _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, step, double, double);
> >  _CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, step, double, double);
> >
> > +#ifndef CLC_SPIRV
> >  STEP_DEF(float, double);
> >  STEP_DEF(double, float);
> >
> >  _CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, step, float, double);
> >  _CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, step, double, float);
> > -
> > +#endif
> >  #endif
> Is it illegal to call step/smoothstep when targetting SPIR-V? or do
> the headers implement it as a macro?
> either way it'd be preferable to follow the existing overload
> mechanism rather than adding ifdefs across the sources (more in
> reponse to the cmake changes).

the SPIR-V spec doesn't define step/smoothstep with those interfaces,
it des define the others that are left unifdef, whether that is a
mistake or not I'm not sure.

If the SPIR-V spec never defines those APIs then no code will want to
access them in the libclc spir-v library.

I'm not sure how the exisiting overload mechanism can remove these
from the library completely, create empty impls?

Dave.



More information about the Libclc-dev mailing list