Debian Codegraph @

src/thirdparty/Symforce-Caspar/generated/f32/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 float* PinholePose_step,
16 unsigned int PinholePose_step_num_alloc,
17 float* PinholePose_precond_diag,
18 unsigned int PinholePose_precond_diag_num_alloc,
19 const float* const diag,
20 float* PinholePose_njtr,
21 unsigned int PinholePose_njtr_num_alloc,
22 float* 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[4096];
26
27 __shared__ float out_PinholePose_pred_dec_local[1];
28
29 float 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 ReadIdx4<1024, float, float, float4>(PinholePose_step,
34 0 * PinholePose_step_num_alloc,
35 global_thread_idx,
36 r0,
37 r1,
38 r2,
39 r3);
40 ReadIdx4<1024, float, float, float4>(PinholePose_njtr,
41 0 * PinholePose_njtr_num_alloc,
42 global_thread_idx,
43 r4,
44 r5,
45 r6,
46 r7);
47 ReadIdx4<1024, float, float, float4>(PinholePose_precond_diag,
48 0 * PinholePose_precond_diag_num_alloc,
49 global_thread_idx,
50 r8,
51 r9,
52 r10,
53 r11);
54 r12 = r2 * r10;
55 };
56 LoadUnique<1, float, float>(diag, 0, (float*)inout_shared);
57 if (global_thread_idx < problem_size) {
58 ReadShared1<float>((float*)inout_shared, 0, r13);
59 };
60 __syncthreads();
61 if (global_thread_idx < problem_size) {
62 r12 = fmaf(r13, r12, r6);
63 r6 = r0 * r8;
64 r6 = fmaf(r13, r6, r4);
65 r6 = fmaf(r0, r6, r2 * r12);
66 r12 = r1 * r9;
67 r12 = fmaf(r13, r12, r5);
68 r5 = r3 * r11;
69 r5 = fmaf(r13, r5, r7);
70 ReadIdx2<1024, float, float, float2>(PinholePose_step,
71 4 * PinholePose_step_num_alloc,
72 global_thread_idx,
73 r7,
74 r4);
75 ReadIdx2<1024, float, float, float2>(PinholePose_njtr,
76 4 * PinholePose_njtr_num_alloc,
77 global_thread_idx,
78 r14,
79 r15);
80 ReadIdx2<1024, float, float, float2>(PinholePose_precond_diag,
81 4 * PinholePose_precond_diag_num_alloc,
82 global_thread_idx,
83 r16,
84 r17);
85 r18 = r7 * r16;
86 r18 = fmaf(r13, r18, r14);
87 r14 = r4 * r17;
88 r14 = fmaf(r13, r14, r15);
89 r6 = fmaf(r1, r12, r6);
90 r6 = fmaf(r3, r5, r6);
91 r6 = fmaf(r7, r18, r6);
92 r6 = fmaf(r4, r14, r6);
93 };
94 SumStore<float>(out_PinholePose_pred_dec_local,
95 (float*)inout_shared,
96 0,
97 global_thread_idx < problem_size,
98 r6);
99 SumFlushFinal<float>(
100 out_PinholePose_pred_dec_local, out_PinholePose_pred_dec, 1);
101 }
102
103 void PinholePosePredDecreaseTimesTwo(
104 float* PinholePose_step,
105 unsigned int PinholePose_step_num_alloc,
106 float* PinholePose_precond_diag,
107 unsigned int PinholePose_precond_diag_num_alloc,
108 const float* const diag,
109 float* PinholePose_njtr,
110 unsigned int PinholePose_njtr_num_alloc,
111 float* const out_PinholePose_pred_dec,
112 size_t problem_size) {
113 if (problem_size == 0) {
114 return;
115 }
116
117 const int n_blocks = (problem_size + 1024 - 1) / 1024;
118 PinholePosePredDecreaseTimesTwoKernel<<<n_blocks, 1024>>>(
119 PinholePose_step,
120 PinholePose_step_num_alloc,
121 PinholePose_precond_diag,
122 PinholePose_precond_diag_num_alloc,
123 diag,
124 PinholePose_njtr,
125 PinholePose_njtr_num_alloc,
126 out_PinholePose_pred_dec,
127 problem_size);
128 }
129
130 } // namespace caspar