Debian Codegraph @

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

raw
1 #include "kernel_PinholeFocal_update_p.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 PinholeFocalUpdatePKernel(float* PinholeFocal_z,
15 unsigned int PinholeFocal_z_num_alloc,
16 float* PinholeFocal_p_k,
17 unsigned int PinholeFocal_p_k_num_alloc,
18 const float* const beta,
19 float* out_PinholeFocal_p_kp1,
20 unsigned int out_PinholeFocal_p_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;
26
27 if (global_thread_idx < problem_size) {
28 ReadIdx2<1024, float, float, float2>(PinholeFocal_p_k,
29 0 * PinholeFocal_p_k_num_alloc,
30 global_thread_idx,
31 r0,
32 r1);
33 ReadIdx2<1024, float, float, float2>(PinholeFocal_z,
34 0 * PinholeFocal_z_num_alloc,
35 global_thread_idx,
36 r2,
37 r3);
38 };
39 LoadUnique<1, float, float>(beta, 0, (float*)inout_shared);
40 if (global_thread_idx < problem_size) {
41 ReadShared1<float>((float*)inout_shared, 0, r4);
42 };
43 __syncthreads();
44 if (global_thread_idx < problem_size) {
45 r0 = fmaf(r0, r4, r2);
46 r4 = fmaf(r1, r4, r3);
47 WriteIdx2<1024, float, float, float2>(out_PinholeFocal_p_kp1,
48 0 * out_PinholeFocal_p_kp1_num_alloc,
49 global_thread_idx,
50 r0,
51 r4);
52 };
53 }
54
55 void PinholeFocalUpdateP(float* PinholeFocal_z,
56 unsigned int PinholeFocal_z_num_alloc,
57 float* PinholeFocal_p_k,
58 unsigned int PinholeFocal_p_k_num_alloc,
59 const float* const beta,
60 float* out_PinholeFocal_p_kp1,
61 unsigned int out_PinholeFocal_p_kp1_num_alloc,
62 size_t problem_size) {
63 if (problem_size == 0) {
64 return;
65 }
66
67 const int n_blocks = (problem_size + 1024 - 1) / 1024;
68 PinholeFocalUpdatePKernel<<<n_blocks, 1024>>>(
69 PinholeFocal_z,
70 PinholeFocal_z_num_alloc,
71 PinholeFocal_p_k,
72 PinholeFocal_p_k_num_alloc,
73 beta,
74 out_PinholeFocal_p_kp1,
75 out_PinholeFocal_p_kp1_num_alloc,
76 problem_size);
77 }
78
79 } // namespace caspar