Debian Codegraph @

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

raw
1 #include "kernel_Point_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)
14 PointUpdateStepFirstKernel(double* Point_p_kp1,
15 unsigned int Point_p_kp1_num_alloc,
16 const double* const alpha,
17 double* out_Point_step_kp1,
18 unsigned int out_Point_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>(
27 Point_p_kp1, 0 * Point_p_kp1_num_alloc, global_thread_idx, r0, r1);
28 };
29 LoadUnique<1, double, double>(alpha, 0, (double*)inout_shared);
30 if (global_thread_idx < problem_size) {
31 ReadShared1<double>((double*)inout_shared, 0, r2);
32 };
33 __syncthreads();
34 if (global_thread_idx < problem_size) {
35 r0 = r0 * r2;
36 r1 = r1 * r2;
37 WriteIdx2<1024, double, double, double2>(out_Point_step_kp1,
38 0 * out_Point_step_kp1_num_alloc,
39 global_thread_idx,
40 r0,
41 r1);
42 ReadIdx1<1024, double, double, double>(
43 Point_p_kp1, 2 * Point_p_kp1_num_alloc, global_thread_idx, r1);
44 r2 = r1 * r2;
45 WriteIdx1<1024, double, double, double>(out_Point_step_kp1,
46 2 * out_Point_step_kp1_num_alloc,
47 global_thread_idx,
48 r2);
49 };
50 }
51
52 void PointUpdateStepFirst(double* Point_p_kp1,
53 unsigned int Point_p_kp1_num_alloc,
54 const double* const alpha,
55 double* out_Point_step_kp1,
56 unsigned int out_Point_step_kp1_num_alloc,
57 size_t problem_size) {
58 if (problem_size == 0) {
59 return;
60 }
61
62 const int n_blocks = (problem_size + 1024 - 1) / 1024;
63 PointUpdateStepFirstKernel<<<n_blocks, 1024>>>(Point_p_kp1,
64 Point_p_kp1_num_alloc,
65 alpha,
66 out_Point_step_kp1,
67 out_Point_step_kp1_num_alloc,
68 problem_size);
69 }
70
71 } // namespace caspar