Debian Codegraph @

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

raw
1 #include "kernel_Point_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 PointUpdateStepKernel(float* Point_step_k,
15 unsigned int Point_step_k_num_alloc,
16 float* Point_p_kp1,
17 unsigned int Point_p_kp1_num_alloc,
18 const float* const alpha,
19 float* out_Point_step_kp1,
20 unsigned int out_Point_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;
26
27 if (global_thread_idx < problem_size) {
28 ReadIdx3<1024, float, float, float4>(Point_step_k,
29 0 * Point_step_k_num_alloc,
30 global_thread_idx,
31 r0,
32 r1,
33 r2);
34 ReadIdx3<1024, float, float, float4>(
35 Point_p_kp1, 0 * Point_p_kp1_num_alloc, global_thread_idx, r3, r4, r5);
36 };
37 LoadUnique<1, float, float>(alpha, 0, (float*)inout_shared);
38 if (global_thread_idx < problem_size) {
39 ReadShared1<float>((float*)inout_shared, 0, r6);
40 };
41 __syncthreads();
42 if (global_thread_idx < problem_size) {
43 r3 = fmaf(r3, r6, r0);
44 r4 = fmaf(r4, r6, r1);
45 r6 = fmaf(r5, r6, r2);
46 WriteIdx3<1024, float, float, float4>(out_Point_step_kp1,
47 0 * out_Point_step_kp1_num_alloc,
48 global_thread_idx,
49 r3,
50 r4,
51 r6);
52 };
53 }
54
55 void PointUpdateStep(float* Point_step_k,
56 unsigned int Point_step_k_num_alloc,
57 float* Point_p_kp1,
58 unsigned int Point_p_kp1_num_alloc,
59 const float* const alpha,
60 float* out_Point_step_kp1,
61 unsigned int out_Point_step_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 PointUpdateStepKernel<<<n_blocks, 1024>>>(Point_step_k,
69 Point_step_k_num_alloc,
70 Point_p_kp1,
71 Point_p_kp1_num_alloc,
72 alpha,
73 out_Point_step_kp1,
74 out_Point_step_kp1_num_alloc,
75 problem_size);
76 }
77
78 } // namespace caspar