• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can
5  * be found in the LICENSE file.
6  *
7  */
8 
9 #pragma once
10 
11 //
12 //
13 //
14 
15 #include <CL/opencl.h>
16 #include <stdint.h>
17 #include <stdbool.h>
18 
19 //
20 //
21 //
22 
23 #include "hs_cl_target.h"
24 
25 //
26 //
27 //
28 
29 struct hs_cl *
30 hs_cl_create(struct hs_cl_target const * const target,
31              cl_context                        context,
32              cl_device_id                      device_id);
33 
34 
35 //
36 //
37 //
38 
39 void
40 hs_cl_release(struct hs_cl * const hs);
41 
42 //
43 // Determine what padding will be applied to the input and output
44 // buffers.
45 //
46 // Always check to see if the allocated buffers are large enough.
47 //
48 // count                    : number of keys
49 // count + count_padded_in  : additional keys required for sorting
50 // count + count_padded_out : additional keys required for merging
51 //
52 
53 void
54 hs_cl_pad(struct hs_cl const * const hs,
55           uint32_t             const count,
56           uint32_t           * const count_padded_in,
57           uint32_t           * const count_padded_out);
58 
59 //
60 // Sort the keys in the vin buffer and store them in the vout buffer.
61 //
62 // If vout is NULL then the sort will be performed in place.
63 //
64 // The implementation assumes the command queue is out-of-order.
65 //
66 
67 void
68 hs_cl_sort(struct hs_cl const * const hs,
69            cl_command_queue           cq,
70            uint32_t             const wait_list_size,
71            cl_event           *       wait_list,
72            cl_event           *       event,
73            cl_mem                     vin,
74            cl_mem                     vout,
75            uint32_t             const count,
76            uint32_t             const count_padded_in,
77            uint32_t             const count_padded_out,
78            bool                 const linearize);
79 
80 //
81 //
82 //
83