diff --git a/include/boost/compute/algorithm/gather.hpp b/include/boost/compute/algorithm/gather.hpp index b2f725d5..24c5c727 100644 --- a/include/boost/compute/algorithm/gather.hpp +++ b/include/boost/compute/algorithm/gather.hpp @@ -36,7 +36,6 @@ public: OutputIterator result) { m_count = iterator_range_size(first, last); - m_offset = first.get_index(); *this << "const uint i = get_global_id(0);\n" << @@ -50,12 +49,11 @@ public: return event(); } - return exec_1d(queue, m_offset, m_count); + return exec_1d(queue, 0, m_count); } private: size_t m_count; - size_t m_offset; }; } // end detail namespace diff --git a/test/test_gather.cpp b/test/test_gather.cpp index 6696c6a9..2d6af2c8 100644 --- a/test/test_gather.cpp +++ b/test/test_gather.cpp @@ -34,6 +34,11 @@ BOOST_AUTO_TEST_CASE(gather_int) indices.begin(), indices.end(), input.begin(), output.begin(), queue ); CHECK_RANGE_EQUAL(int, 5, output, (1, 5, 2, 4, 3)); + + compute::gather( + indices.begin() + 1, indices.end(), input.begin(), output.begin(), queue + ); + CHECK_RANGE_EQUAL(int, 5, output, (5, 2, 4, 3, 3)); } BOOST_AUTO_TEST_CASE(copy_index_then_gather)