Debian Codegraph @

src/thirdparty/Symforce-Caspar/generated/f64/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(double* Point_step_k,
15 unsigned int Point_step_k_num_alloc,
16 double* Point_p_kp1,
17 unsigned int Point_p_kp1_num_alloc,
18 const double* const alpha,
19 double* 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[8192];
24
25 double r0, r1, r2, r3, r4;
26
27 if (global_thread_idx < problem_size) {
28 ReadIdx2<1024, double, double, double2>(
29 Point_step_k, 0 * Point_step_k_num_alloc, global_thread_idx, r0, r1);
30 ReadIdx2<1024, double, double, double2>(
31 Point_p_kp1, 0 * Point_p_kp1_num_alloc, global_thread_idx, r2, r3);
32 };
33 LoadUnique<1, double, double>(alpha, 0, (double*)inout_shared);
34 if (global_thread_idx < problem_size) {
35 ReadShared1<double>((double*)inout_shared, 0, r4);
36 };
37 __syncthreads();
38 if (global_thread_idx < problem_size) {
39 r2 = fma(r2, r4, r0);
40 r3 = fma(r3, r4, r1);
41 WriteIdx2<1024, double, double, double2>(out_Point_step_kp1,
42 0 * out_Point_step_kp1_num_alloc,
43 global_thread_idx,
44 r2,
45 r3);
46 ReadIdx1<1024, double, double, double>(
47 Point_step_k, 2 * Point_step_k_num_alloc, global_thread_idx, r3);
48 ReadIdx1<1024, double, double, double>(
49 Point_p_kp1, 2 * Point_p_kp1_num_alloc, global_thread_idx, r2);
50 r4 = fma(r2, r4, r3);
51 WriteIdx1<1024, double, double, double>(out_Point_step_kp1,
52 2 * out_Point_step_kp1_num_alloc,
53 global_thread_idx,
54 r4);
55 };
56 }
57
58 void PointUpdateStep(double* Point_step_k,
59 unsigned int Point_step_k_num_alloc,
60 double* Point_p_kp1,
61 unsigned int Point_p_kp1_num_alloc,
62 const double* const alpha,
63 double* out_Point_step_kp1,
64 unsigned int out_Point_step_kp1_num_alloc,
65 size_t problem_size) {
66 if (problem_size == 0) {
67 return;
68 }
69
70 const int n_blocks = (problem_size + 1024 - 1) / 1024;
71 PointUpdateStepKernel<<<n_blocks, 1024>>>(Point_step_k,
72 Point_step_k_num_alloc,
73 Point_p_kp1,
74 Point_p_kp1_num_alloc,
75 alpha,
76 out_Point_step_kp1,
77 out_Point_step_kp1_num_alloc,
78 problem_size);
79 }
80
81 } // namespace caspar