Debian Codegraph @

src/thirdparty/Symforce-Caspar/generated/f32/kernel_PinholePose_update_step.cu

raw
1 #include "kernel_PinholePose_update_step.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 PinholePoseUpdateStepKernel(float* PinholePose_step_k,
15 unsigned int PinholePose_step_k_num_alloc,
16 float* PinholePose_p_kp1,
17 unsigned int PinholePose_p_kp1_num_alloc,
18 const float* const alpha,
19 float* out_PinholePose_step_kp1,
20 unsigned int out_PinholePose_step_kp1_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_step_k,
29 0 * PinholePose_step_k_num_alloc,
30 global_thread_idx,
31 r0,
32 r1,
33 r2,
34 r3);
35 ReadIdx4<1024, float, float, float4>(PinholePose_p_kp1,
36 0 * PinholePose_p_kp1_num_alloc,
37 global_thread_idx,
38 r4,
39 r5,
40 r6,
41 r7);
42 };
43 LoadUnique<1, float, float>(alpha, 0, (float*)inout_shared);
44 if (global_thread_idx < problem_size) {
45 ReadShared1<float>((float*)inout_shared, 0, r8);
46 };
47 __syncthreads();
48 if (global_thread_idx < problem_size) {
49 r4 = fmaf(r4, r8, r0);
50 r5 = fmaf(r5, r8, r1);
51 r6 = fmaf(r6, r8, r2);
52 r7 = fmaf(r7, r8, r3);
53 WriteIdx4<1024, float, float, float4>(
54 out_PinholePose_step_kp1,
55 0 * out_PinholePose_step_kp1_num_alloc,
56 global_thread_idx,
57 r4,
58 r5,
59 r6,
60 r7);
61 ReadIdx2<1024, float, float, float2>(PinholePose_step_k,
62 4 * PinholePose_step_k_num_alloc,
63 global_thread_idx,
64 r7,
65 r6);
66 ReadIdx2<1024, float, float, float2>(PinholePose_p_kp1,
67 4 * PinholePose_p_kp1_num_alloc,
68 global_thread_idx,
69 r5,
70 r4);
71 r5 = fmaf(r5, r8, r7);
72 r8 = fmaf(r4, r8, r6);
73 WriteIdx2<1024, float, float, float2>(
74 out_PinholePose_step_kp1,
75 4 * out_PinholePose_step_kp1_num_alloc,
76 global_thread_idx,
77 r5,
78 r8);
79 };
80 }
81
82 void PinholePoseUpdateStep(float* PinholePose_step_k,
83 unsigned int PinholePose_step_k_num_alloc,
84 float* PinholePose_p_kp1,
85 unsigned int PinholePose_p_kp1_num_alloc,
86 const float* const alpha,
87 float* out_PinholePose_step_kp1,
88 unsigned int out_PinholePose_step_kp1_num_alloc,
89 size_t problem_size) {
90 if (problem_size == 0) {
91 return;
92 }
93
94 const int n_blocks = (problem_size + 1024 - 1) / 1024;
95 PinholePoseUpdateStepKernel<<<n_blocks, 1024>>>(
96 PinholePose_step_k,
97 PinholePose_step_k_num_alloc,
98 PinholePose_p_kp1,
99 PinholePose_p_kp1_num_alloc,
100 alpha,
101 out_PinholePose_step_kp1,
102 out_PinholePose_step_kp1_num_alloc,
103 problem_size);
104 }
105
106 } // namespace caspar