Debian Codegraph @

src/thirdparty/Symforce-Caspar/generated/f32/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 float* PinholePose_p_kp1,
15 unsigned int PinholePose_p_kp1_num_alloc,
16 const float* const alpha,
17 float* 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[4096];
22
23 float r0, r1, r2, r3, r4;
24
25 if (global_thread_idx < problem_size) {
26 ReadIdx4<1024, float, float, float4>(PinholePose_p_kp1,
27 0 * PinholePose_p_kp1_num_alloc,
28 global_thread_idx,
29 r0,
30 r1,
31 r2,
32 r3);
33 };
34 LoadUnique<1, float, float>(alpha, 0, (float*)inout_shared);
35 if (global_thread_idx < problem_size) {
36 ReadShared1<float>((float*)inout_shared, 0, r4);
37 };
38 __syncthreads();
39 if (global_thread_idx < problem_size) {
40 r0 = r0 * r4;
41 r1 = r1 * r4;
42 r2 = r2 * r4;
43 r3 = r3 * r4;
44 WriteIdx4<1024, float, float, float4>(
45 out_PinholePose_step_kp1,
46 0 * out_PinholePose_step_kp1_num_alloc,
47 global_thread_idx,
48 r0,
49 r1,
50 r2,
51 r3);
52 ReadIdx2<1024, float, float, float2>(PinholePose_p_kp1,
53 4 * PinholePose_p_kp1_num_alloc,
54 global_thread_idx,
55 r3,
56 r2);
57 r3 = r3 * r4;
58 r4 = r2 * r4;
59 WriteIdx2<1024, float, float, float2>(
60 out_PinholePose_step_kp1,
61 4 * out_PinholePose_step_kp1_num_alloc,
62 global_thread_idx,
63 r3,
64 r4);
65 };
66 }
67
68 void PinholePoseUpdateStepFirst(float* PinholePose_p_kp1,
69 unsigned int PinholePose_p_kp1_num_alloc,
70 const float* const alpha,
71 float* out_PinholePose_step_kp1,
72 unsigned int out_PinholePose_step_kp1_num_alloc,
73 size_t problem_size) {
74 if (problem_size == 0) {
75 return;
76 }
77
78 const int n_blocks = (problem_size + 1024 - 1) / 1024;
79 PinholePoseUpdateStepFirstKernel<<<n_blocks, 1024>>>(
80 PinholePose_p_kp1,
81 PinholePose_p_kp1_num_alloc,
82 alpha,
83 out_PinholePose_step_kp1,
84 out_PinholePose_step_kp1_num_alloc,
85 problem_size);
86 }
87
88 } // namespace caspar