2 Copyright (c) 2012 Advanced Micro Devices, Inc.
4 This software is provided 'as-is', without any express or implied warranty.
5 In no event will the authors be held liable for any damages arising from the use of this software.
6 Permission is granted to anyone to use this software for any purpose,
7 including commercial applications, and to alter it and redistribute it freely,
8 subject to the following restrictions:
10 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
11 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
12 3. This notice may not be removed or altered from any source distribution.
14 //Originally written by Takahiro Harada
20 #include <AdlPrimitives/Math/Math.h>
21 #include <AdlPrimitives/Sort/SortData.h>
22 #include <AdlPrimitives/Fill/Fill.h>
38 template<DeviceType TYPE>
39 class BoundSearch : public BoundSearchBase
42 typedef Launcher::BufferInfo BufferInfo;
46 const Device* m_device;
47 Kernel* m_lowerSortDataKernel;
48 Kernel* m_upperSortDataKernel;
49 Kernel* m_subtractKernel;
50 Buffer<int4>* m_constBuffer;
53 typename Fill<TYPE>::Data* m_fillData;
57 Data* allocate(const Device* deviceData, int maxSize = 0);
60 void deallocate(Data* data);
62 // src has to be src[i].m_key <= src[i+1].m_key
64 void execute(Data* data, Buffer<SortData>& src, u32 nSrc, Buffer<u32>& dst, u32 nDst, Option option = BOUND_LOWER );
67 // void execute(Data* data, Buffer<u32>& src, Buffer<u32>& dst, int n, Option option = );
70 #include <AdlPrimitives/Search/BoundSearchHost.inl>
71 #include <AdlPrimitives/Search/BoundSearch.inl>