File indexing completed on 2025-01-18 09:30:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_BALLOT_HPP
0012 #define BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_BALLOT_HPP
0013
0014 #include <boost/compute/function.hpp>
0015 #include <boost/compute/types/fundamental.hpp>
0016
0017 namespace boost {
0018 namespace compute {
0019 namespace detail {
0020
0021 template<class T>
0022 class nvidia_ballot : public function<uint_(T)>
0023 {
0024 public:
0025 nvidia_ballot()
0026 : function<uint_(T)>("nvidia_ballot")
0027 {
0028 this->set_source(
0029 "inline uint nvidia_ballot(const uint x)\n"
0030 "{\n"
0031 " uint result;\n"
0032 " asm volatile(\n"
0033 " \"setp.ne.u32 %%p1, %1, 0;\"\n"
0034 " \"vote.ballot.b32 %0, %%p1;\"\n"
0035 " : \"=r\"(result)\n"
0036 " : \"r\"(x)\n"
0037 " );\n"
0038 " return result;\n"
0039 "}\n"
0040 );
0041 }
0042 };
0043
0044 }
0045 }
0046 }
0047
0048 #endif