[vsipl++] [patch] Use new dispatch for matvec functions
Stefan Seefeld
stefan at codesourcery.com
Fri Nov 7 17:27:43 UTC 2008
Don McCoy wrote:
> Index: src/vsip/core/cvsip/matvec.hpp
> ===================================================================
> --- src/vsip/core/cvsip/matvec.hpp (revision 225932)
> +++ src/vsip/core/cvsip/matvec.hpp (working copy)
> @@ -158,31 +158,34 @@
>
> } // namespace vsip::impl::cvsip
>
> +namespace dispatcher
> +{
> +
> template <typename T,
> - typename Block1,
> - typename Block2>
> -struct Evaluator<Op_prod_vv_dot, Return_scalar<T>, Op_list_2<Block1, Block2>,
> - Cvsip_tag>
> + typename Block0,
> + typename Block1>
> +struct Evaluator<Op_prod_vv_dot, Cvsip_tag,
> + Return_scalar<T>(Block0 const&, Block1 const&)>
> {
> typedef cvsip::Op_traits<T> traits;
>
> static bool const ct_valid =
> traits::valid &&
> + Type_equal<T, typename Block0::value_type>::value &&
> Type_equal<T, typename Block1::value_type>::value &&
> - Type_equal<T, typename Block2::value_type>::value &&
> // check that direct access is supported
> - Ext_data_cost<Block1>::value == 0 &&
> - Ext_data_cost<Block2>::value == 0;
> + Ext_data_cost<Block0>::value == 0 &&
> + Ext_data_cost<Block1>::value == 0;
>
> - static bool rt_valid(Block1 const&, Block2 const&) { return true;}
> + static bool rt_valid(Block0 const&, Block1 const&) { return true;}
>
> - static T exec(Block1 const& a, Block2 const& b)
> + static T exec(Block0 const& a, Block1 const& b)
> {
> VSIP_IMPL_COVER_FCN("Op_prod_vv_dot/cvsip", exec);
> assert(a.size(1, 0) == b.size(1, 0));
>
> - Ext_data<Block1> ext_a(const_cast<Block1&>(a));
> - Ext_data<Block2> ext_b(const_cast<Block2&>(b));
> + Ext_data<Block0 const> ext_a(a);
I suggest to put documentation comments into the above to clarify what
is happening:
The ct_valid expression evaluates whether this backend can be used
without temporaries (Ext_data_cost<>::value == 0). However, the
evaluator remains usable ('valid') even if that isn't the case, as
Ext_data<> will evaluate expressions prior to the actual operation is run.
> Index: src/vsip/core/general_evaluator.hpp
> ===================================================================
> --- src/vsip/core/general_evaluator.hpp (revision 225932)
> +++ src/vsip/core/general_evaluator.hpp (working copy)
> @@ -61,6 +61,40 @@
> static bool const ct_valid = false;
> };
>
I'd propose we start with a new file instead of lumping parts of two
dispatcher harnesses into the same. That will only confuse us, even
though in the long run we aim at eliminating one of the two entirely.
What about simply /src/vsip/core/dispatch.hpp ? (We already do similar
things in other cases, e.g. core/profile.hpp and opt/profile.hpp...)
Thanks,
Stefan
More information about the vsipl++
mailing list