Go to the documentation of this file.
8 static const char source_vxm[] = R
"(
11 __kernel void vxm_sparse_count(__global const uint* g_vi,
12 __global const TYPE* g_vx,
13 __global const uint* g_Ap,
14 __global const uint* g_Aj,
15 __global const TYPE* g_mask,
16 __global uint* g_size,
18 const uint gid = get_global_id(0); // id of v entry to touch
19 const uint gstride = get_global_size(0);// step between v entries
21 for (int idx = gid; idx < n; idx += gstride) {
22 const uint vi = g_vi[idx];
23 const TYPE vx = g_vx[idx];
25 const uint start = g_Ap[vi];
26 const uint end = g_Ap[vi + 1];
30 for (uint i = start; i < end; i++) {
31 if (OP_SELECT(g_mask[g_Aj[i]])) count += 1;
34 atomic_add(g_size, count);
38 __kernel void vxm_sparse_collect(__global const uint* g_vi,
39 __global const TYPE* g_vx,
40 __global const uint* g_Ap,
41 __global const uint* g_Aj,
42 __global const TYPE* g_Ax,
43 __global const TYPE* g_mask,
46 __global uint* g_roffset,
48 const uint gid = get_global_id(0); // id of v entry to touch
49 const uint gstride = get_global_size(0);// step between v entries
51 for (int idx = gid; idx < n; idx += gstride) {
52 const uint vi = g_vi[idx];
53 const TYPE vx = g_vx[idx];
55 const uint start = g_Ap[vi];
56 const uint end = g_Ap[vi + 1];
60 for (uint i = start; i < end; i++) {
61 if (OP_SELECT(g_mask[g_Aj[i]])) count += 1;
64 uint offset = atomic_add(g_roffset, count);
66 for (uint i = start; i < end; i++) {
67 const uint col_id = g_Aj[i];
69 if (OP_SELECT(g_mask[col_id])) {
70 g_ri[offset] = col_id;
71 g_rx[offset] = OP_BINARY1(vx, g_Ax[i]);