Debian Codegraph @

src/thirdparty/Symforce-Caspar/generated/f64/kernel_PinholePose_start_w_contribute.cu

raw
1 #include "kernel_PinholePose_start_w_contribute.h"
2 #include "memops.cuh"
3 #include <cooperative_groups.h>
4 #include <cooperative_groups/details/partitioning.h>
5 #include <cooperative_groups/memcpy_async.h>
6 #include <cooperative_groups/reduce.h>
7 #include <cuda_runtime.h>
8
9 namespace cg = cooperative_groups;
10
11 namespace caspar {
12
13 __global__ void __launch_bounds__(1024, 1) PinholePoseStartWContributeKernel(
14 double* PinholePose_precond_diag,
15 unsigned int PinholePose_precond_diag_num_alloc,
16 const double* const diag,
17 double* PinholePose_p,
18 unsigned int PinholePose_p_num_alloc,
19 double* out_PinholePose_w,
20 unsigned int out_PinholePose_w_num_alloc,
21 size_t problem_size) {
22 const int global_thread_idx = blockIdx.x * blockDim.x + threadIdx.x;
23 __shared__ uint8_t inout_shared[8192];
24
25 double r0, r1, r2, r3, r4;
26
27 if (global_thread_idx < problem_size) {
28 ReadIdx2<1024, double, double, double2>(
29 PinholePose_precond_diag,
30 0 * PinholePose_precond_diag_num_alloc,
31 global_thread_idx,
32 r0,
33 r1);
34 };
35 LoadUnique<1, double, double>(diag, 0, (double*)inout_shared);
36 if (global_thread_idx < problem_size) {
37 ReadShared1<double>((double*)inout_shared, 0, r2);
38 };
39 __syncthreads();
40 if (global_thread_idx < problem_size) {
41 r0 = r0 * r2;
42 ReadIdx2<1024, double, double, double2>(
43 PinholePose_p, 0 * PinholePose_p_num_alloc, global_thread_idx, r3, r4);
44 r0 = r0 * r3;
45 r1 = r1 * r2;
46 r1 = r1 * r4;
47 AddIdx2<1024, double, double, double2>(out_PinholePose_w,
48 0 * out_PinholePose_w_num_alloc,
49 global_thread_idx,
50 r0,
51 r1);
52 ReadIdx2<1024, double, double, double2>(
53 PinholePose_precond_diag,
54 2 * PinholePose_precond_diag_num_alloc,
55 global_thread_idx,
56 r1,
57 r0);
58 r1 = r1 * r2;
59 ReadIdx2<1024, double, double, double2>(
60 PinholePose_p, 2 * PinholePose_p_num_alloc, global_thread_idx, r4, r3);
61 r1 = r1 * r4;
62 r0 = r0 * r2;
63 r0 = r0 * r3;
64 AddIdx2<1024, double, double, double2>(out_PinholePose_w,
65 2 * out_PinholePose_w_num_alloc,
66 global_thread_idx,
67 r1,
68 r0);
69 ReadIdx2<1024, double, double, double2>(
70 PinholePose_precond_diag,
71 4 * PinholePose_precond_diag_num_alloc,
72 global_thread_idx,
73 r0,
74 r1);
75 r0 = r0 * r2;
76 ReadIdx2<1024, double, double, double2>(
77 PinholePose_p, 4 * PinholePose_p_num_alloc, global_thread_idx, r3, r4);
78 r0 = r0 * r3;
79 r2 = r1 * r2;
80 r2 = r2 * r4;
81 AddIdx2<1024, double, double, double2>(out_PinholePose_w,
82 4 * out_PinholePose_w_num_alloc,
83 global_thread_idx,
84 r0,
85 r2);
86 };
87 }
88
89 void PinholePoseStartWContribute(
90 double* PinholePose_precond_diag,
91 unsigned int PinholePose_precond_diag_num_alloc,
92 const double* const diag,
93 double* PinholePose_p,
94 unsigned int PinholePose_p_num_alloc,
95 double* out_PinholePose_w,
96 unsigned int out_PinholePose_w_num_alloc,
97 size_t problem_size) {
98 if (problem_size == 0) {
99 return;
100 }
101
102 const int n_blocks = (problem_size + 1024 - 1) / 1024;
103 PinholePoseStartWContributeKernel<<<n_blocks, 1024>>>(
104 PinholePose_precond_diag,
105 PinholePose_precond_diag_num_alloc,
106 diag,
107 PinholePose_p,
108 PinholePose_p_num_alloc,
109 out_PinholePose_w,
110 out_PinholePose_w_num_alloc,
111 problem_size);
112 }
113
114 } // namespace caspar