Debian Codegraph @

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

raw
1 #include "kernel_PinholePose_pred_decrease_times_two.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)
14 PinholePosePredDecreaseTimesTwoKernel(
15 double* PinholePose_step,
16 unsigned int PinholePose_step_num_alloc,
17 double* PinholePose_precond_diag,
18 unsigned int PinholePose_precond_diag_num_alloc,
19 const double* const diag,
20 double* PinholePose_njtr,
21 unsigned int PinholePose_njtr_num_alloc,
22 double* const out_PinholePose_pred_dec,
23 size_t problem_size) {
24 const int global_thread_idx = blockIdx.x * blockDim.x + threadIdx.x;
25 __shared__ uint8_t inout_shared[8192];
26
27 __shared__ double out_PinholePose_pred_dec_local[1];
28
29 double r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15,
30 r16, r17, r18;
31
32 if (global_thread_idx < problem_size) {
33 ReadIdx2<1024, double, double, double2>(PinholePose_step,
34 2 * PinholePose_step_num_alloc,
35 global_thread_idx,
36 r0,
37 r1);
38 ReadIdx2<1024, double, double, double2>(PinholePose_njtr,
39 2 * PinholePose_njtr_num_alloc,
40 global_thread_idx,
41 r2,
42 r3);
43 ReadIdx2<1024, double, double, double2>(
44 PinholePose_precond_diag,
45 2 * PinholePose_precond_diag_num_alloc,
46 global_thread_idx,
47 r4,
48 r5);
49 r6 = r0 * r4;
50 };
51 LoadUnique<1, double, double>(diag, 0, (double*)inout_shared);
52 if (global_thread_idx < problem_size) {
53 ReadShared1<double>((double*)inout_shared, 0, r7);
54 };
55 __syncthreads();
56 if (global_thread_idx < problem_size) {
57 r6 = fma(r7, r6, r2);
58 ReadIdx2<1024, double, double, double2>(PinholePose_step,
59 0 * PinholePose_step_num_alloc,
60 global_thread_idx,
61 r2,
62 r8);
63 ReadIdx2<1024, double, double, double2>(PinholePose_njtr,
64 0 * PinholePose_njtr_num_alloc,
65 global_thread_idx,
66 r9,
67 r10);
68 ReadIdx2<1024, double, double, double2>(
69 PinholePose_precond_diag,
70 0 * PinholePose_precond_diag_num_alloc,
71 global_thread_idx,
72 r11,
73 r12);
74 r13 = r2 * r11;
75 r13 = fma(r7, r13, r9);
76 r13 = fma(r2, r13, r0 * r6);
77 r6 = r8 * r12;
78 r6 = fma(r7, r6, r10);
79 r10 = r1 * r5;
80 r10 = fma(r7, r10, r3);
81 ReadIdx2<1024, double, double, double2>(PinholePose_step,
82 4 * PinholePose_step_num_alloc,
83 global_thread_idx,
84 r3,
85 r9);
86 ReadIdx2<1024, double, double, double2>(PinholePose_njtr,
87 4 * PinholePose_njtr_num_alloc,
88 global_thread_idx,
89 r14,
90 r15);
91 ReadIdx2<1024, double, double, double2>(
92 PinholePose_precond_diag,
93 4 * PinholePose_precond_diag_num_alloc,
94 global_thread_idx,
95 r16,
96 r17);
97 r18 = r3 * r16;
98 r18 = fma(r7, r18, r14);
99 r14 = r9 * r17;
100 r14 = fma(r7, r14, r15);
101 r13 = fma(r8, r6, r13);
102 r13 = fma(r1, r10, r13);
103 r13 = fma(r3, r18, r13);
104 r13 = fma(r9, r14, r13);
105 };
106 SumStore<double>(out_PinholePose_pred_dec_local,
107 (double*)inout_shared,
108 0,
109 global_thread_idx < problem_size,
110 r13);
111 SumFlushFinal<double>(
112 out_PinholePose_pred_dec_local, out_PinholePose_pred_dec, 1);
113 }
114
115 void PinholePosePredDecreaseTimesTwo(
116 double* PinholePose_step,
117 unsigned int PinholePose_step_num_alloc,
118 double* PinholePose_precond_diag,
119 unsigned int PinholePose_precond_diag_num_alloc,
120 const double* const diag,
121 double* PinholePose_njtr,
122 unsigned int PinholePose_njtr_num_alloc,
123 double* const out_PinholePose_pred_dec,
124 size_t problem_size) {
125 if (problem_size == 0) {
126 return;
127 }
128
129 const int n_blocks = (problem_size + 1024 - 1) / 1024;
130 PinholePosePredDecreaseTimesTwoKernel<<<n_blocks, 1024>>>(
131 PinholePose_step,
132 PinholePose_step_num_alloc,
133 PinholePose_precond_diag,
134 PinholePose_precond_diag_num_alloc,
135 diag,
136 PinholePose_njtr,
137 PinholePose_njtr_num_alloc,
138 out_PinholePose_pred_dec,
139 problem_size);
140 }
141
142 } // namespace caspar