Debian Codegraph @

src/thirdparty/Symforce-Caspar/generated/f32/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 float* PinholePose_precond_diag,
15 unsigned int PinholePose_precond_diag_num_alloc,
16 const float* const diag,
17 float* PinholePose_p,
18 unsigned int PinholePose_p_num_alloc,
19 float* 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[4096];
24
25 float r0, r1, r2, r3, r4, r5, r6, r7, r8;
26
27 if (global_thread_idx < problem_size) {
28 ReadIdx4<1024, float, float, float4>(PinholePose_precond_diag,
29 0 * PinholePose_precond_diag_num_alloc,
30 global_thread_idx,
31 r0,
32 r1,
33 r2,
34 r3);
35 };
36 LoadUnique<1, float, float>(diag, 0, (float*)inout_shared);
37 if (global_thread_idx < problem_size) {
38 ReadShared1<float>((float*)inout_shared, 0, r4);
39 };
40 __syncthreads();
41 if (global_thread_idx < problem_size) {
42 r0 = r0 * r4;
43 ReadIdx4<1024, float, float, float4>(PinholePose_p,
44 0 * PinholePose_p_num_alloc,
45 global_thread_idx,
46 r5,
47 r6,
48 r7,
49 r8);
50 r0 = r0 * r5;
51 r1 = r1 * r4;
52 r1 = r1 * r6;
53 r2 = r2 * r4;
54 r2 = r2 * r7;
55 r3 = r3 * r4;
56 r3 = r3 * r8;
57 AddIdx4<1024, float, float, float4>(out_PinholePose_w,
58 0 * out_PinholePose_w_num_alloc,
59 global_thread_idx,
60 r0,
61 r1,
62 r2,
63 r3);
64 ReadIdx2<1024, float, float, float2>(PinholePose_precond_diag,
65 4 * PinholePose_precond_diag_num_alloc,
66 global_thread_idx,
67 r3,
68 r2);
69 r3 = r3 * r4;
70 ReadIdx2<1024, float, float, float2>(
71 PinholePose_p, 4 * PinholePose_p_num_alloc, global_thread_idx, r1, r0);
72 r3 = r3 * r1;
73 r4 = r2 * r4;
74 r4 = r4 * r0;
75 AddIdx2<1024, float, float, float2>(out_PinholePose_w,
76 4 * out_PinholePose_w_num_alloc,
77 global_thread_idx,
78 r3,
79 r4);
80 };
81 }
82
83 void PinholePoseStartWContribute(
84 float* PinholePose_precond_diag,
85 unsigned int PinholePose_precond_diag_num_alloc,
86 const float* const diag,
87 float* PinholePose_p,
88 unsigned int PinholePose_p_num_alloc,
89 float* out_PinholePose_w,
90 unsigned int out_PinholePose_w_num_alloc,
91 size_t problem_size) {
92 if (problem_size == 0) {
93 return;
94 }
95
96 const int n_blocks = (problem_size + 1024 - 1) / 1024;
97 PinholePoseStartWContributeKernel<<<n_blocks, 1024>>>(
98 PinholePose_precond_diag,
99 PinholePose_precond_diag_num_alloc,
100 diag,
101 PinholePose_p,
102 PinholePose_p_num_alloc,
103 out_PinholePose_w,
104 out_PinholePose_w_num_alloc,
105 problem_size);
106 }
107
108 } // namespace caspar