MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / sort0Iterative

Function sort0Iterative

src/backend/oneapi/kernel/sort.hpp:29–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28template<typename T>
29void sort0Iterative(Param<T> val, bool isAscending) {
30 auto dpl_policy = ::oneapi::dpl::execution::make_device_policy(getQueue());
31 for (int w = 0; w < val.info.dims[3]; w++) {
32 int valW = w * val.info.strides[3];
33 for (int z = 0; z < val.info.dims[2]; z++) {
34 int valWZ = valW + z * val.info.strides[2];
35 for (int y = 0; y < val.info.dims[1]; y++) {
36 int valOffset = valWZ + y * val.info.strides[1];
37
38 auto buf_begin = ::oneapi::dpl::begin(*val.data) + valOffset;
39 auto buf_end = buf_begin + val.info.dims[0];
40 if (isAscending) {
41 std::sort(dpl_policy, buf_begin, buf_end,
42 [](auto lhs, auto rhs) { return lhs < rhs; });
43 // std::less<T>()); // mangled name errors in icx for now
44 } else {
45 std::sort(dpl_policy, buf_begin, buf_end,
46 [](auto lhs, auto rhs) { return lhs > rhs; });
47 // std::greater<T>()); // mangled name errors in icx for now
48 }
49 }
50 }
51 }
52 ONEAPI_DEBUG_FINISH(getQueue());
53}
54
55template<typename T>
56void sortBatched(Param<T> pVal, int dim, bool isAscending) {

Callers

nothing calls this directly

Calls 3

beginFunction · 0.85
getQueueFunction · 0.50
sortFunction · 0.50

Tested by

no test coverage detected