Debian Codegraph @

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

raw
1 #include "kernel_PinholePose_update_step_first.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) PinholePoseUpdateStepFirstKernel(
14 double* PinholePose_p_kp1,
15 unsigned int PinholePose_p_kp1_num_alloc,
16 const double* const alpha,
17 double* out_PinholePose_step_kp1,
18 unsigned int out_PinholePose_step_kp1_num_alloc,
19 size_t problem_size) {
20 const int global_thread_idx = blockIdx.x * blockDim.x + threadIdx.x;
21 __shared__ uint8_t inout_shared[8192];
22
23 double r0, r1, r2;
24
25 if (global_thread_idx < problem_size) {
26 ReadIdx2<1024, double, double, double2>(PinholePose_p_kp1,
27 0 * PinholePose_p_kp1_num_alloc,
28 global_thread_idx,
29 r0,
30 r1);
31 };
32 LoadUnique<1, double, double>(alpha, 0, (double*)inout_shared);
33 if (global_thread_idx < problem_size) {
34 ReadShared1<double>((double*)inout_shared, 0, r2);
35 };
36 __syncthreads();
37 if (global_thread_idx < problem_size) {
38 r0 = r0 * r2;
39 r1 = r1 * r2;
40 WriteIdx2<1024, double, double, double2>(
41 out_PinholePose_step_kp1,
42 0 * out_PinholePose_step_kp1_num_alloc,
43 global_thread_idx,
44 r0,
45 r1);
46 ReadIdx2<1024, double, double, double2>(PinholePose_p_kp1,
47 2 * PinholePose_p_kp1_num_alloc,
48 global_thread_idx,
49 r1,
50 r0);
51 r1 = r1 * r2;
52 r0 = r0 * r2;
53 WriteIdx2<1024, double, double, double2>(
54 out_PinholePose_step_kp1,
55 2 * out_PinholePose_step_kp1_num_alloc,
56 global_thread_idx,
57 r1,
58 r0);
59 ReadIdx2<1024, double, double, double2>(PinholePose_p_kp1,
60 4 * PinholePose_p_kp1_num_alloc,
61 global_thread_idx,
62 r0,
63 r1);
64 r0 = r0 * r2;
65 r2 = r1 * r2;
66 WriteIdx2<1024, double, double, double2>(
67 out_PinholePose_step_kp1,
68 4 * out_PinholePose_step_kp1_num_alloc,
69 global_thread_idx,
70 r0,
71 r2);
72 };
73 }
74
75 void PinholePoseUpdateStepFirst(double* PinholePose_p_kp1,
76 unsigned int PinholePose_p_kp1_num_alloc,
77 const double* const alpha,
78 double* out_PinholePose_step_kp1,
79 unsigned int out_PinholePose_step_kp1_num_alloc,
80 size_t problem_size) {
81 if (problem_size == 0) {
82 return;
83 }
84
85 const int n_blocks = (problem_size + 1024 - 1) / 1024;
86 PinholePoseUpdateStepFirstKernel<<<n_blocks, 1024>>>(
87 PinholePose_p_kp1,
88 PinholePose_p_kp1_num_alloc,
89 alpha,
90 out_PinholePose_step_kp1,
91 out_PinholePose_step_kp1_num_alloc,
92 problem_size);
93 }
94
95 } // namespace caspar