Giter Club home page Giter Club logo

boost.simd's Introduction

boost.simd's People

Contributors

ccharly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

boost.simd's Issues

build instructions?

Any chance build instructions could be added to the README.md file? (Even if that just means that you can use the include/boost folder as-is). It looks like that might be the case (although you'll need Boost.dispatch present as well)

The regular mkdir build && cmake .. doesn't seem to generate a set of headers that can be popped in; is it only used for the unit tests now?

FWIW, when I attempt to include all the top-level headers in the boost/simd folder (bundled in a package RcppParallel), I get the following error:

> Rcpp::sourceCpp('inst/examples/boost-simd/boost-simd-variance.cpp')
In file included from boost-simd-variance.cpp:7:
In file included from /Users/kevin/Library/R/3.2/library/RcppParallel/include/RcppParallel.h:64:
In file included from /Users/kevin/Library/R/3.2/library/RcppParallel/include/RcppParallel/SIMD.h:6:
In file included from /Users/kevin/Library/R/3.2/library/RcppParallel/include/boost/simd/arithmetic.hpp:59:
/Users/kevin/Library/R/3.2/library/RcppParallel/include/boost/simd/function/fabs.hpp:45:10: fatal error: 'boost/simd/arch/common/scalar/function/fabs.hpp' file not found
#include <boost/simd/arch/common/scalar/function/fabs.hpp>
         ^

(you mentioned that this repository was in the middle of a refactor; let me know if it's okay if I report these kinds of things or if you'd prefer that I just sit patient)

Sign flipper constants

Add a way to create constants that can be used for flipping the sign of floating point values by simple XORing.

It has to be a constant so that we can easily choose which elements in the vector will have their sign flipped.

Complete shuffle

Current shuffle branch stops at SSEx shuffle type

  • AVX like shuffle
  • VMX like shuffle

problem with idivround and clang 3.7

with clang 3.7, with float and double scalar mode:
idivround2even(one,mzero) produces valmax instead of valmin

idivround2even is merely here iround2even(a0/a1) and the direct call of this writing produces the correct result.

Also,all work fine with clang 3.6

I have this problem with x86-64 sse-4.2
Can you confirm the problem ?

copysign not optimal

it seems that copysign is defined as:
bitwise_or(bitofsign(a1), boost::simd::abs(a0));

while afaict it could be simplified to:
bitwise_or(bitofsign(a1), a0);

or am i missing something?

Dot Examples

dot.cpp:11:29: fatal error: boost/simd/io.hpp: No such file or directory
compilation terminated.

I am trying to run the examples given but it seems arduous since libs which don't exist are mentioned, or am I missing something?

Further the folder /simd/function/ is mislabelled functions in the dot.cpp example... simple errors I know but it makes understanding how to use the package a little more difficult

Aggregate used for larger pack

The automatic generation of a tuple of pack when the size given to a pack is larger than a native SIMD register size may be quite dangerous for inexperienced users. The similarities between this and an std::array combined with the fact that this facilitates the writing of inefficient code makes me think that this option should be blocked by default and only enabled through the definition of a macro. For example, if one wishes to subtract a constant from a large pack, the following code may seem sensible:

(SIZE is larger than cardinal of native SIMD vector)
pack<int, SIZE> a //fill a with data
pack<int, SIZE> sub = constant_data; //data to subtract
pack<int, SIZE> res = a - sub;

In this case here, the code generated is very inefficient and it cannot be caught by the boost.simd during the code generation process. Any user testing boost.simd with such a trivial example could easily believe that boost.SIMD generates very poor code and is not a high performance library. Also, the ability to simdize code requires thinking at the register level and having some understanding of how registers and simd instructions work. The use of a higher level abstraction than the native register does not encourage such thinking so may lead to poor code, also very few algorithms are amenable for use with such an abstraction. For these reasons I propose that pack<T, N> be deactivated by default.

Optimized reduction

Use shuffle to reimplement all_reduce and subsequent numerical reduction
Require #145

  • all_reduce
  • splatted modifier
  • autofold / all_reduce combo
  • sum,prod,min,max

function sign with LLONG_MIN

code

#include <boost/simd/sdk/simd/pack.hpp>
#include <boost/simd/sdk/simd/io.hpp>
#include <boost/simd/include/functions/load.hpp>
#include <boost/simd/include/functions/groups.hpp>
#include <boost/simd/include/functions/evaluate.hpp>
#include <boost/simd/include/functions/sign.hpp>

#include <iostream>

using namespace std;
using namespace boost::simd;

int main()
{
    typedef boost::simd::pack<long long, 2> p_l_t;

    long long arr[2] = {LLONG_MIN, LLONG_MAX};

    p_l_t a = load<p_l_t>((long long *)arr);

    cout << sign(a) << endl;

    return 0;
}

boost.simd version

3.1.0

boost version

1_59_0

compiler version

clang++ 3.7

issue

output is:
(0, 1)

why not

(-1, 1)

sse_ -> sse1_

I always found that sse_ was quite ambiguous as it used in both the site and the family for SSE1. We should definitely add sse1_ tag and use it instead.

Very slow nt2::abs on complex

(moving from serge-sans-paille/pythran#433)

The following c++ code:

#include <complex>
#include <nt2/sdk/complex/complex.hpp>
#include <nt2/include/functions/abs.hpp>

int main(int argc, char**argv) {
  std::complex<double> c0;
  std::complex<double> c1 = nt2::abs(c0);
  return c1.real() ==0;
}   

when compiled using a (frozen) version of nt2 / boost.simd, is twice as slow as std::abs... A quick look at the generated assembly points out an unexpected

    movsd   %xmm2, (%rsp)
    call    ilogb

ilogb? what for?

Aliases

There is a huge amount of aliases in boost.simd. Is this really necessary? I fail to see how this enhances the library. In my opinion, it adds clutter to the library and makes it more difficult to maintain and use.

I recommend deprecating all alias functions and removing them in a future release.

Opinions please!

Examples include modulo = mod, remainder = rem, drem = rem...etc

Turn horner into variadic

The horner macro used heavily to compute the polynomials used in transcendental functions could be turned in a variadic functor, now that we use C++11

use of C++11 cmath

from c++11 cmath garantees implementation of a bunch of our functions in std::

In think we have

  1. to provide access to these function by a call style toto(x, std_) that will call std::toto(x)
  2. to bench these functions against our scalar versions

update README.md

  • remove reference to boost dispatch as it's now all inclusive
  • fix the code example which is wrong (pack(T*) require aligned memory)

divfix function cannot support long long and char type?

code

#include <boost/simd/sdk/simd/pack.hpp>
#include <boost/simd/sdk/simd/io.hpp>
#include <boost/simd/include/functions/load.hpp>
#include <boost/simd/include/functions/groups.hpp>
#include <boost/simd/include/functions/split.hpp>
#include <boost/simd/include/functions/evaluate.hpp>
#include <boost/simd/include/functions/divfix.hpp>
#include <boost/simd/include/functions/divround.hpp>
#include <boost/simd/include/functions/trunc.hpp>
#include <boost/simd/include/functions/round.hpp>


#include <iostream>

using std::cout;
using std::endl;

using namespace boost::simd;

int trunc()
{
    typedef pack<long long, 2> p_l_t;

    p_l_t a(123, 178);
    p_l_t b(10, 10);

    //p_l_t a(12345, 178987);
    //p_l_t b(100, 1000);

    auto c = divfix(a, b) * b;

    auto d = evaluate(c);

    cout << c << endl;
    cout << d << endl;

    return 0;
}

boost.simd version

3.1.0

boost version

1_59_0

compiler version

clang++ 3.7

issue

/home/saibing/my/clion-1.1.1/bin/cmake/bin/cmake --build /home/saibing/.clion11/system/cmake/generated/83b82977/83b82977/Debug --target simd -- -j 4
Scanning dependencies of target simd
[ 12%] Building CXX object CMakeFiles/simd.dir/trunc.cpp.o
In file included from /home/saibing/git/mynote/languages/c++/boost.simd/trunc.cpp:13:
In file included from /home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/simd/include/functions/divfix.hpp:4:
In file included from /home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/simd/arithmetic/include/functions/divfix.hpp:6:
/home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/simd/arithmetic/functions/simd/common/divfix.hpp:42:14: error: no viable conversion from 'native<int, [2 * ...]>' to 'native<long long, [2 * ...]>'
      return groups(d0, d1);
             ^~~~~~~~~~~~~~
/home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/simd/dsl/functions/generic/run.hpp:207:14: note: in instantiation of member function 'boost::simd::ext::implement<boost::simd::tag::divfix_ (boost::dispatch::meta::simd_<boost::dispatch::meta::int_<boost::simd::native<long long, boost::simd::tag::sse_, void> >, boost::simd::tag::sse_>, boost::dispatch::meta::simd_<boost::dispatch::meta::int_<boost::simd::native<long long, boost::simd::tag::sse_, void> >, boost::simd::tag::sse_>), boost::dispatch::tag::cpu_, void>::operator()' requested here
      return typename dispatch::meta::dispatch_call<
             ^
/home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/simd/dsl/functions/generic/run.hpp:210:26: note: in instantiation of member function 'boost::simd::ext::implement<boost::simd::tag::run_ (boost::dispatch::meta::node_<boost::simd::expression<boost::proto::exprns_::expr<boost::simd::tag::divfix_, boost::proto::argsns_::list2<boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &> >, 2>, boost::simd::native<long long, boost::simd::tag::sse_, void> >, boost::dispatch::meta::unspecified_<boost::simd::tag::divfix_>, mpl_::long_<2>, boost::simd::domain>), boost::dispatch::tag::formal_, void>::operator()' requested here
      ( BOOST_PP_ENUM(n, M1, ~) );
                         ^
/home/saibing/gocode/code/c/boost_1_56_0/boost/preprocessor/repetition/enum.hpp:35:79: note: expanded from macro 'BOOST_PP_ENUM_1'
#    define BOOST_PP_ENUM_1(c, m, d) BOOST_PP_REPEAT_1(c, BOOST_PP_ENUM_M_1, (m, d))
                                                                              ^
/home/saibing/gocode/code/c/boost_1_56_0/boost/preprocessor/repetition/repeat.hpp:38:63: note: expanded from macro 'BOOST_PP_REPEAT_1'
# define BOOST_PP_REPEAT_1(c, m, d) BOOST_PP_REPEAT_1_I(c, m, d)
                                                              ^
/home/saibing/gocode/code/c/boost_1_56_0/boost/preprocessor/repetition/repeat.hpp:43:66: note: expanded from macro 'BOOST_PP_REPEAT_1_I'
# define BOOST_PP_REPEAT_1_I(c, m, d) BOOST_PP_REPEAT_1_ ## c(m, d)
                                                                 ^
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/home/saibing/gocode/code/c/boost_1_56_0/boost/preprocessor/repetition/enum.hpp:53:70: note: expanded from macro 'BOOST_PP_ENUM_M_1_IM'
#    define BOOST_PP_ENUM_M_1_IM(z, n, im) BOOST_PP_ENUM_M_1_I(z, n, im)
                                                                     ^
/home/saibing/gocode/code/c/boost_1_56_0/boost/preprocessor/repetition/enum.hpp:62:63: note: expanded from macro 'BOOST_PP_ENUM_M_1_I'
# define BOOST_PP_ENUM_M_1_I(z, n, m, d) BOOST_PP_COMMA_IF(n) m(z, n, d)
                                                              ^
/home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/simd/dsl/functions/generic/run.hpp:84:5: note: expanded from macro 'M1'
    typename dispatch::meta::dispatch_call<                                                        \
    ^
/home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/simd/dsl/functions/run.hpp:24:3: note: in instantiation of member function 'boost::simd::ext::implement<boost::simd::tag::run_ (boost::dispatch::meta::node_<boost::simd::expression<boost::proto::exprns_::expr<boost::proto::tagns_::tag::multiplies, boost::proto::argsns_::list2<boost::simd::expression<boost::proto::exprns_::expr<boost::simd::tag::divfix_, boost::proto::argsns_::list2<boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &> >, 2>, boost::simd::native<long long, boost::simd::tag::sse_, void> >, boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &> >, 2>, boost::simd::native<long long, boost::simd::tag::sse_, void> >, boost::dispatch::meta::unspecified_<boost::simd::tag::multiplies_>, mpl_::long_<2>, boost::simd::domain>), boost::dispatch::tag::formal_, void>::operator()' requested here
  BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL(tag::run_, run, (A0&), 1)
  ^
/home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/dispatch/functor/preprocessor/function.hpp:198:10: note: expanded from macro 'BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL'
  return typename boost::dispatch::meta::                                      \
         ^
/home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/simd/dsl/functions/generic/evaluate.hpp:31:14: note: in instantiation of function template specialization 'boost::simd::run<boost::simd::expression<boost::proto::exprns_::expr<boost::proto::tagns_::tag::multiplies, boost::proto::argsns_::list2<boost::simd::expression<boost::proto::exprns_::expr<boost::simd::tag::divfix_, boost::proto::argsns_::list2<boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &> >, 2>, boost::simd::native<long long, boost::simd::tag::sse_, void> >, boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &> >, 2>, boost::simd::native<long long, boost::simd::tag::sse_, void> > >' requested here
      return run(a0);
             ^
/home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/simd/dsl/functions/evaluate.hpp:20:3: note: in instantiation of member function 'boost::simd::ext::implement<boost::simd::tag::evaluate_ (boost::dispatch::meta::ast_<boost::simd::expression<boost::proto::exprns_::expr<boost::proto::tagns_::tag::multiplies, boost::proto::argsns_::list2<boost::simd::expression<boost::proto::exprns_::expr<boost::simd::tag::divfix_, boost::proto::argsns_::list2<boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &> >, 2>, boost::simd::native<long long, boost::simd::tag::sse_, void> >, boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &> >, 2>, boost::simd::native<long long, boost::simd::tag::sse_, void> >, boost::simd::domain>), boost::dispatch::tag::formal_, void>::operator()' requested here
  BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL(tag::evaluate_, evaluate, (A0&), 1)
  ^
/home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/dispatch/functor/preprocessor/function.hpp:198:10: note: expanded from macro 'BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL'
  return typename boost::dispatch::meta::                                      \
         ^
/home/saibing/git/mynote/languages/c++/boost.simd/trunc.cpp:38:14: note: in instantiation of function template specialization 'boost::simd::evaluate<boost::simd::expression<boost::proto::exprns_::expr<boost::proto::tagns_::tag::multiplies, boost::proto::argsns_::list2<boost::simd::expression<boost::proto::exprns_::expr<boost::simd::tag::divfix_, boost::proto::argsns_::list2<boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &> >, 2>, boost::simd::native<long long, boost::simd::tag::sse_, void> >, boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const boost::simd::native<long long, boost::simd::tag::sse_, void> &>, 0>, const boost::simd::native<long long, boost::simd::tag::sse_, void> &> >, 2>, boost::simd::native<long long, boost::simd::tag::sse_, void> > >' requested here
    auto d = evaluate(c);
             ^
/home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/simd/sdk/simd/native.hpp:49:31: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'typename boost::dispatch::meta::result_of<typename boost::dispatch::meta::dispatch_call<tag::groups_ (const native<long, sse_, void> &, const native<long, sse_, void> &)>::type (const native<long, sse_, void> &, const native<long, sse_, void> &)>::type' (aka 'native<int, ::boost::simd::tag::sse_>') to 'const boost::simd::native<long long, boost::simd::tag::sse_, void> &' for 1st argument
  struct BOOST_SIMD_MAY_ALIAS native
                              ^
/home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/simd/sdk/simd/native.hpp:119:23: note: candidate constructor not viable: no known conversion from 'typename boost::dispatch::meta::result_of<typename boost::dispatch::meta::dispatch_call<tag::groups_ (const native<long, sse_, void> &, const native<long, sse_, void> &)>::type (const native<long, sse_, void> &, const native<long, sse_, void> &)>::type' (aka 'native<int, ::boost::simd::tag::sse_>') to 'native_type' (aka '__m128i') for 1st argument
    BOOST_FORCEINLINE native(native_type s) : data_(s) {}
                      ^
/home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/simd/sdk/simd/native.hpp:145:23: note: candidate function
    BOOST_FORCEINLINE operator native_type &      ()        { return data_; }
                      ^
/home/saibing/gocode/code/c/boost-simd-3.1.0/boost-simd/include/boost/simd/sdk/simd/native.hpp:148:23: note: candidate function
    BOOST_FORCEINLINE operator native_type const& ()  const { return data_; }
                      ^
1 error generated.
CMakeFiles/simd.dir/build.make:134: recipe for target 'CMakeFiles/simd.dir/trunc.cpp.o' failed
make[3]: *** [CMakeFiles/simd.dir/trunc.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/simd.dir/all' failed
make[2]: *** [CMakeFiles/simd.dir/all] Error 2
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/simd.dir/rule' failed
make[1]: *** [CMakeFiles/simd.dir/rule] Error 2
Makefile:118: recipe for target 'simd' failed
make: *** [simd] Error 2

boost::simd minus

The following code generates a huge amount of unnecessary instructions. Compiled with g++-4.9 with sse4.2. Plus generates correct instructions.

bs::pack full_out, full_arr, full_128;
full_out = full_arr - full_128;

400a4b: 4c 8d 6c 24 30 lea 0x30(%rsp),%r13
400a50: 48 8d bc 24 c0 00 00 lea 0xc0(%rsp),%rdi
400a57: 00
400a58: 4c 89 a4 24 c0 00 00 mov %r12,0xc0(%rsp)
400a5f: 00
400a60: 48 c7 84 24 c8 00 00 movq $0x0,0xc8(%rsp)
400a67: 00 00 00 00 00
400a6c: 4c 89 ac 24 b0 00 00 mov %r13,0xb0(%rsp)
400a73: 00
400a74: 48 c7 84 24 b8 00 00 movq $0x0,0xb8(%rsp)
400a7b: 00 00 00 00 00
400a80: e8 7b 02 00 00 callq 400d00 <boost::simd::detail::pack_proxy<boost::simd::pack<int, 4ul, boost::simd::sse_> const>::operator int() const>
400a85: 48 8d bc 24 b0 00 00 lea 0xb0(%rsp),%rdi
400a8c: 00
400a8d: 41 89 c6 mov %eax,%r14d
400a90: e8 6b 02 00 00 callq 400d00 <boost::simd::detail::pack_proxy<boost::simd::pack<int, 4ul, boost::simd::sse_> const>::operator int() const>
400a95: 48 8d bc 24 a0 00 00 lea 0xa0(%rsp),%rdi
400a9c: 00
400a9d: 44 29 f0 sub %r14d,%eax
400aa0: 4c 89 a4 24 a0 00 00 mov %r12,0xa0(%rsp)
400aa7: 00
400aa8: 89 44 24 08 mov %eax,0x8(%rsp)
400aac: 48 c7 84 24 a8 00 00 movq $0x1,0xa8(%rsp)
400ab3: 00 01 00 00 00
400ab8: 4c 89 ac 24 90 00 00 mov %r13,0x90(%rsp)
400abf: 00
400ac0: 48 c7 84 24 98 00 00 movq $0x1,0x98(%rsp)
400ac7: 00 01 00 00 00
400acc: e8 2f 02 00 00 callq 400d00 <boost::simd::detail::pack_proxy<boost::simd::pack<int, 4ul, boost::simd::sse_> const>::operator int() const>
400ad1: 48 8d bc 24 90 00 00 lea 0x90(%rsp),%rdi
400ad8: 00
400ad9: 41 89 c7 mov %eax,%r15d
400adc: e8 1f 02 00 00 callq 400d00 <boost::simd::detail::pack_proxy<boost::simd::pack<int, 4ul, boost::simd::sse_> const>::operator int() const>
400ae1: 48 8d bc 24 80 00 00 lea 0x80(%rsp),%rdi
400ae8: 00
400ae9: 44 29 f8 sub %r15d,%eax
400aec: 4c 89 a4 24 80 00 00 mov %r12,0x80(%rsp)
400af3: 00
400af4: 41 89 c6 mov %eax,%r14d
400af7: 48 c7 84 24 88 00 00 movq $0x2,0x88(%rsp)
400afe: 00 02 00 00 00
400b03: 4c 89 6c 24 70 mov %r13,0x70(%rsp)
400b08: 48 c7 44 24 78 02 00 movq $0x2,0x78(%rsp)
400b0f: 00 00
400b11: e8 ea 01 00 00 callq 400d00 <boost::simd::detail::pack_proxy<boost::simd::pack<int, 4ul, boost::simd::sse_> const>::operator int() const>
400b16: 48 8d 7c 24 70 lea 0x70(%rsp),%rdi
400b1b: 41 89 c7 mov %eax,%r15d
400b1e: e8 dd 01 00 00 callq 400d00 <boost::simd::detail::pack_proxy<boost::simd::pack<int, 4ul, boost::simd::sse_> const>::operator int() const>
400b23: 48 8d 7c 24 60 lea 0x60(%rsp),%rdi
400b28: 44 29 f8 sub %r15d,%eax
400b2b: 4c 89 64 24 60 mov %r12,0x60(%rsp)
400b30: 89 44 24 0c mov %eax,0xc(%rsp)
400b34: 48 c7 44 24 68 03 00 movq $0x3,0x68(%rsp)
400b3b: 00 00
400b3d: 4c 89 6c 24 50 mov %r13,0x50(%rsp)
400b42: 48 c7 44 24 58 03 00 movq $0x3,0x58(%rsp)
400b49: 00 00
400b4b: e8 b0 01 00 00 callq 400d00 <boost::simd::detail::pack_proxy<boost::simd::pack<int, 4ul, boost::simd::sse_> const>::operator int() const>
400b50: 48 8d 7c 24 50 lea 0x50(%rsp),%rdi
400b55: 41 89 c4 mov %eax,%r12d
400b58: e8 a3 01 00 00 callq 400d00 <boost::simd::detail::pack_proxy<boost::simd::pack<int, 4ul, boost::simd::sse_> const>::operator int() const>

Guided fallback documentation

Hi

(first: sorry for add my question as issue but i don't find suitable devel/user mailing list on boost simd only (i found boost::simd subject in boost mailing list))

I currently code an image library which use tensor like container
and i want to use boost::simd facilities whenever is possible :)
Eg

  • Use it when a "view" on tensor leads to aligned datas (no stride at all or no stride in the least significant dimensions)
  • BUT fallback to no simd "operator" when i use a "stridedview"

In https://github.com/jfalcou/boost-con-2011/blob/master/simd/simd.pdf
You exposed default fallback where no suitable architecture is found
I want to "manually" fallback regarding stride presence/absence, but i don't know how

Thanks for your help
Regards
TR

Support for maskable operations

To prepare the new trend of maskable operation in SIMD ISA, I am proposing to extend the mask() modifier from pointer to arbitrary values.

  • f(p) will call f on p.
  • f( mask(p,cond,def) ) will call or emulate a maskable f

I also ponder proposing p[cond] as a short-cut for mask(p,cond,p) so :

asb( p[cond] )  

means computes abs(p) where cond is true and let it alone if not.

Though ?

pack<T,N> alignment

It is legitimate to align pack on the sizeof(pack < T > ::storage_type) to be able to perform
aligned loads when pack corresponds to a native simd vector.

But this is not correct for all pack<T,N>
alignement on sizeof(pack < T,N > ::storage_type) is not needed if N is greater than pack < T > ::static_size

Perhaps for all Ns sizeof(pack < T > ::storage_type) can do the job.

I don't really know where to enforce that or it's only to be a documentation part ?

functions name changes

at the end of the migration process all selxxx functions should be renamed ifxxx
and also genmask and genmaskc,. The old names should be turnied to aliases (or not).

All this to have a more coherent naming scheme


After discussions tasks to do:

  • remove b_ aliases
  • remove l_ aliases
  • change div* implementation
  • change i* implementation
  • saturated operations decorator

type casts for boost.simd types

it would be great to be able to cast between packs (or other boost.simd types) of the same size with an API function ... e.g. from pack<float, N> to pack<double, N>

Make a list of breaking API changes

Some changes has been made on the API and contents of boost.SIMD compared to the old nT2-embedded version. Those changes were mainly motivated by return fo experience, better algorithms designed since or general refactoring.

A list of those changes shoudl eb put in the doc.

Error compiling the README example

Hi, I've followed the steps outlined in the README: successfully compiled Boost.SIMD, installed it into a temporary directory and attempted to compile main.cpp.

Unfortunately, compilation failed with

/tmp/main.cpp:9:16:   required from here
/tmp/boost.simd.install/include/boost/simd/arch/x86/sse1/simd/function/splat.hpp:34:25: error: invalid static_cast from type ‘const float [4]’ to type ‘float’
       return _mm_set1_ps( static_cast<float>(v) );

Configuration: Ubuntu 15.10, Boost 1.60 and

$ g++ --version
g++ (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

pack type convert error

code

#include <boost/simd/sdk/simd/pack.hpp> 
#include <boost/simd/sdk/simd/io.hpp>
#include <boost/simd/include/functions/load.hpp>
#include <boost/simd/include/functions/evaluate.hpp>
#include <boost/simd/operator/include/functions/plus.hpp>
#include <iostream>

using namespace std;
using namespace boost::simd;

#define SECONDS_IN_ONE_DAY      86400

template <typename T>
class op_boost_utc_add
{
    typedef boost::simd::pack<T, 16 / sizeof(T)> p_t;
    const p_t seconds_in_one_day = boost::simd::splat<p_t>(SECONDS_IN_ONE_DAY);

public:
    p_t operator()(p_t const &a0, p_t const &a1, p_t const &delta)
    {
        return evaluate(a0 + (seconds_in_one_day * a1) + delta);
    }
};

int main()
{
    typedef boost::simd::pack<long long, 2> p_l_t;

    p_l_t a(10, 100);
    p_l_t b(10, 100);
    p_l_t c(1, 1);

    p_l_t r = op_boost_utc_add<long long>()(a, b, c);

    cout << r << endl;                                                               

    return 0;
}   

boost.simd version

3.1.0

boost version

1_59_0

compiler version

  • clang++ 3.6
  • gcc 4.8.2

issue

gcc compile error, but clang++ is ok.

[d257414 boost]$g++ -g -o add add.cpp -I${BOOST_ROOT_DIR} -I${BOOST_SIMD_DIR}/include -msse4.1 -std=c++11
add.cpp: In constructor ‘constexpr op_boost_utc_add<long long int>::op_boost_utc_add()’:
add.cpp:45:7: error: conversion from ‘boost::dispatch::meta::result_of<boost::simd::ext::implement<boost::simd::tag::splat_(boost::dispatch::meta::scalar_<boost::dispatch::meta::fundamental_<int> >, boost::dispatch::meta::target_<boost::dispatch::meta::ast_<boost::dispatch::meta::as_<boost::simd::pack<long long int, 2ul> >, boost::simd::domain> >), boost::dispatch::tag::cpu_, void>(int, boost::dispatch::meta::as_<boost::simd::pack<long long int, 2ul> >), void>::type {aka boost::simd::expression<boost::proto::exprns_::expr<boost::simd::tag::splat_, boost::proto::argsns_::list2<boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<int>, 0l>, int>, boost::simd::expression<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::dispatch::meta::as_<boost::simd::native<long long int, boost::simd::tag::sse_, void> > >, 0l>, boost::dispatch::meta::as_<boost::simd::native<long long int, boost::simd::tag::sse_, void> > > >, 2l>, boost::simd::native<long long int, boost::simd::tag::sse_, void> >}’ to non-scalar type ‘const p_t {aka const boost::simd::pack<long long int, 2ul>}’ requested
 class op_boost_utc_add
       ^
add.cpp: In function ‘int main()’:
add.cpp:66:43: note: synthesized method ‘constexpr op_boost_utc_add<long long int>::op_boost_utc_add()’ first required here 
     p_l_t r = op_boost_utc_add<long long>()(a, b, c);
                                           ^
[d257414 boost]$clang++ -g -o add add.cpp -I${BOOST_ROOT_DIR} -I${BOOST_SIMD_DIR}/include -msse4.1 -std=c++11 -stdlib=libc++ -lc++abi
[d257414 boost]

combine on scalars

the following code compiles:
pack<float, 4> x = combine( pack<float, 2>(0.f), pack<float, 2>(0.f) );

but trying to do the same with scalars fails:
pack<float, 2> y = combine( 0.f, 0.f );

likewise, one-element packs are not allowed:
pack<float, 2> x = combine( pack<float, 1>(0.f), pack<float, 1>(0.f) );

this makes it a bit troublesome to generic write code that supports both scalar and vector types ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.