xref: /libCEED/rust/libceed-sys/c-src/include/ceed/jit-source/hip/hip-gen-templates.h (revision 688b547317fb91b3911fc39af1ff501a468744ac)
15aed82e4SJeremy L Thompson // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
29e201c85SYohann // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
39e201c85SYohann //
49e201c85SYohann // SPDX-License-Identifier: BSD-2-Clause
59e201c85SYohann //
69e201c85SYohann // This file is part of CEED:  http://github.com/ceed
79e201c85SYohann 
89e201c85SYohann /// @file
99e201c85SYohann /// Internal header for HIP backend macro and type definitions for JiT source
10c0b5abf0SJeremy L Thompson #include <ceed/types.h>
119e201c85SYohann 
129e201c85SYohann //------------------------------------------------------------------------------
139e201c85SYohann // Load matrices for basis actions
149e201c85SYohann //------------------------------------------------------------------------------
159e201c85SYohann template <int P, int Q>
16f815fac9SJeremy L Thompson inline __device__ void LoadMatrix(SharedData_Hip &data, const CeedScalar *__restrict__ d_B, CeedScalar *B) {
172b730f8bSJeremy L Thompson   for (CeedInt i = data.t_id; i < P * Q; i += blockDim.x * blockDim.y * blockDim.z) B[i] = d_B[i];
189e201c85SYohann }
199e201c85SYohann 
209e201c85SYohann //------------------------------------------------------------------------------
219e201c85SYohann // 1D
229e201c85SYohann //------------------------------------------------------------------------------
239e201c85SYohann 
249e201c85SYohann //------------------------------------------------------------------------------
259e201c85SYohann // L-vector -> E-vector, offsets provided
269e201c85SYohann //------------------------------------------------------------------------------
27672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int P_1d>
28f815fac9SJeremy L Thompson inline __device__ void ReadLVecStandard1d(SharedData_Hip &data, const CeedInt num_nodes, const CeedInt elem, const CeedInt *__restrict__ indices,
29672b0f2aSSebastian Grimberg                                           const CeedScalar *__restrict__ d_u, CeedScalar *__restrict__ r_u) {
30672b0f2aSSebastian Grimberg   if (data.t_id_x < P_1d) {
319e201c85SYohann     const CeedInt node = data.t_id_x;
32672b0f2aSSebastian Grimberg     const CeedInt ind  = indices[node + elem * P_1d];
33672b0f2aSSebastian Grimberg 
34672b0f2aSSebastian Grimberg     for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[comp] = d_u[ind + COMP_STRIDE * comp];
359e201c85SYohann   }
369e201c85SYohann }
379e201c85SYohann 
389e201c85SYohann //------------------------------------------------------------------------------
399e201c85SYohann // L-vector -> E-vector, strided
409e201c85SYohann //------------------------------------------------------------------------------
41672b0f2aSSebastian Grimberg template <int NUM_COMP, int P_1d, int STRIDES_NODE, int STRIDES_COMP, int STRIDES_ELEM>
42f815fac9SJeremy L Thompson inline __device__ void ReadLVecStrided1d(SharedData_Hip &data, const CeedInt elem, const CeedScalar *__restrict__ d_u, CeedScalar *__restrict__ r_u) {
43672b0f2aSSebastian Grimberg   if (data.t_id_x < P_1d) {
449e201c85SYohann     const CeedInt node = data.t_id_x;
459e201c85SYohann     const CeedInt ind  = node * STRIDES_NODE + elem * STRIDES_ELEM;
46672b0f2aSSebastian Grimberg 
47672b0f2aSSebastian Grimberg     for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[comp] = d_u[ind + comp * STRIDES_COMP];
489e201c85SYohann   }
499e201c85SYohann }
509e201c85SYohann 
519e201c85SYohann //------------------------------------------------------------------------------
529e201c85SYohann // E-vector -> L-vector, offsets provided
539e201c85SYohann //------------------------------------------------------------------------------
54672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int P_1d>
55f815fac9SJeremy L Thompson inline __device__ void WriteLVecStandard1d(SharedData_Hip &data, const CeedInt num_nodes, const CeedInt elem, const CeedInt *__restrict__ indices,
56672b0f2aSSebastian Grimberg                                            const CeedScalar *__restrict__ r_v, CeedScalar *__restrict__ d_v) {
57672b0f2aSSebastian Grimberg   if (data.t_id_x < P_1d) {
589e201c85SYohann     const CeedInt node = data.t_id_x;
59672b0f2aSSebastian Grimberg     const CeedInt ind  = indices[node + elem * P_1d];
60672b0f2aSSebastian Grimberg 
61672b0f2aSSebastian Grimberg     for (CeedInt comp = 0; comp < NUM_COMP; comp++) atomicAdd(&d_v[ind + COMP_STRIDE * comp], r_v[comp]);
629e201c85SYohann   }
639e201c85SYohann }
649e201c85SYohann 
659e201c85SYohann //------------------------------------------------------------------------------
669e201c85SYohann // E-vector -> L-vector, strided
679e201c85SYohann //------------------------------------------------------------------------------
68672b0f2aSSebastian Grimberg template <int NUM_COMP, int P_1d, int STRIDES_NODE, int STRIDES_COMP, int STRIDES_ELEM>
69f815fac9SJeremy L Thompson inline __device__ void WriteLVecStrided1d(SharedData_Hip &data, const CeedInt elem, const CeedScalar *__restrict__ r_v,
70672b0f2aSSebastian Grimberg                                           CeedScalar *__restrict__ d_v) {
71672b0f2aSSebastian Grimberg   if (data.t_id_x < P_1d) {
729e201c85SYohann     const CeedInt node = data.t_id_x;
739e201c85SYohann     const CeedInt ind  = node * STRIDES_NODE + elem * STRIDES_ELEM;
74672b0f2aSSebastian Grimberg 
75672b0f2aSSebastian Grimberg     for (CeedInt comp = 0; comp < NUM_COMP; comp++) d_v[ind + comp * STRIDES_COMP] += r_v[comp];
769e201c85SYohann   }
779e201c85SYohann }
789e201c85SYohann 
799e201c85SYohann //------------------------------------------------------------------------------
809e201c85SYohann // 2D
819e201c85SYohann //------------------------------------------------------------------------------
829e201c85SYohann 
839e201c85SYohann //------------------------------------------------------------------------------
849e201c85SYohann // L-vector -> E-vector, offsets provided
859e201c85SYohann //------------------------------------------------------------------------------
86672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int P_1d>
87f815fac9SJeremy L Thompson inline __device__ void ReadLVecStandard2d(SharedData_Hip &data, const CeedInt num_nodes, const CeedInt elem, const CeedInt *__restrict__ indices,
88672b0f2aSSebastian Grimberg                                           const CeedScalar *__restrict__ d_u, CeedScalar *__restrict__ r_u) {
89672b0f2aSSebastian Grimberg   if (data.t_id_x < P_1d && data.t_id_y < P_1d) {
90672b0f2aSSebastian Grimberg     const CeedInt node = data.t_id_x + data.t_id_y * P_1d;
91672b0f2aSSebastian Grimberg     const CeedInt ind  = indices[node + elem * P_1d * P_1d];
92672b0f2aSSebastian Grimberg 
93672b0f2aSSebastian Grimberg     for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[comp] = d_u[ind + COMP_STRIDE * comp];
949e201c85SYohann   }
959e201c85SYohann }
969e201c85SYohann 
979e201c85SYohann //------------------------------------------------------------------------------
989e201c85SYohann // L-vector -> E-vector, strided
999e201c85SYohann //------------------------------------------------------------------------------
100672b0f2aSSebastian Grimberg template <int NUM_COMP, int P_1d, int STRIDES_NODE, int STRIDES_COMP, int STRIDES_ELEM>
101f815fac9SJeremy L Thompson inline __device__ void ReadLVecStrided2d(SharedData_Hip &data, const CeedInt elem, const CeedScalar *__restrict__ d_u, CeedScalar *__restrict__ r_u) {
102672b0f2aSSebastian Grimberg   if (data.t_id_x < P_1d && data.t_id_y < P_1d) {
103672b0f2aSSebastian Grimberg     const CeedInt node = data.t_id_x + data.t_id_y * P_1d;
1049e201c85SYohann     const CeedInt ind  = node * STRIDES_NODE + elem * STRIDES_ELEM;
105672b0f2aSSebastian Grimberg 
106672b0f2aSSebastian Grimberg     for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[comp] = d_u[ind + comp * STRIDES_COMP];
1079e201c85SYohann   }
1089e201c85SYohann }
1099e201c85SYohann 
1109e201c85SYohann //------------------------------------------------------------------------------
1119e201c85SYohann // E-vector -> L-vector, offsets provided
1129e201c85SYohann //------------------------------------------------------------------------------
113672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int P_1d>
114f815fac9SJeremy L Thompson inline __device__ void WriteLVecStandard2d(SharedData_Hip &data, const CeedInt num_nodes, const CeedInt elem, const CeedInt *__restrict__ indices,
115672b0f2aSSebastian Grimberg                                            const CeedScalar *__restrict__ r_v, CeedScalar *__restrict__ d_v) {
116672b0f2aSSebastian Grimberg   if (data.t_id_x < P_1d && data.t_id_y < P_1d) {
117672b0f2aSSebastian Grimberg     const CeedInt node = data.t_id_x + data.t_id_y * P_1d;
118672b0f2aSSebastian Grimberg     const CeedInt ind  = indices[node + elem * P_1d * P_1d];
119672b0f2aSSebastian Grimberg 
120672b0f2aSSebastian Grimberg     for (CeedInt comp = 0; comp < NUM_COMP; comp++) atomicAdd(&d_v[ind + COMP_STRIDE * comp], r_v[comp]);
1219e201c85SYohann   }
1229e201c85SYohann }
1239e201c85SYohann 
1249e201c85SYohann //------------------------------------------------------------------------------
1259e201c85SYohann // E-vector -> L-vector, strided
1269e201c85SYohann //------------------------------------------------------------------------------
127672b0f2aSSebastian Grimberg template <int NUM_COMP, int P_1d, int STRIDES_NODE, int STRIDES_COMP, int STRIDES_ELEM>
128f815fac9SJeremy L Thompson inline __device__ void WriteLVecStrided2d(SharedData_Hip &data, const CeedInt elem, const CeedScalar *__restrict__ r_v,
129672b0f2aSSebastian Grimberg                                           CeedScalar *__restrict__ d_v) {
130672b0f2aSSebastian Grimberg   if (data.t_id_x < P_1d && data.t_id_y < P_1d) {
131672b0f2aSSebastian Grimberg     const CeedInt node = data.t_id_x + data.t_id_y * P_1d;
1329e201c85SYohann     const CeedInt ind  = node * STRIDES_NODE + elem * STRIDES_ELEM;
133672b0f2aSSebastian Grimberg 
134672b0f2aSSebastian Grimberg     for (CeedInt comp = 0; comp < NUM_COMP; comp++) d_v[ind + comp * STRIDES_COMP] += r_v[comp];
1359e201c85SYohann   }
1369e201c85SYohann }
1379e201c85SYohann 
1389e201c85SYohann //------------------------------------------------------------------------------
1399e201c85SYohann // 3D
1409e201c85SYohann //------------------------------------------------------------------------------
1419e201c85SYohann 
1429e201c85SYohann //------------------------------------------------------------------------------
1439e201c85SYohann // L-vector -> E-vector, offsets provided
1449e201c85SYohann //------------------------------------------------------------------------------
145672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int P_1d>
146f815fac9SJeremy L Thompson inline __device__ void ReadLVecStandard3d(SharedData_Hip &data, const CeedInt num_nodes, const CeedInt elem, const CeedInt *__restrict__ indices,
147672b0f2aSSebastian Grimberg                                           const CeedScalar *__restrict__ d_u, CeedScalar *__restrict__ r_u) {
148*688b5473SJeremy L Thompson   if (data.t_id_x < P_1d && data.t_id_y < P_1d) {
149672b0f2aSSebastian Grimberg     for (CeedInt z = 0; z < P_1d; z++) {
150672b0f2aSSebastian Grimberg       const CeedInt node = data.t_id_x + data.t_id_y * P_1d + z * P_1d * P_1d;
151672b0f2aSSebastian Grimberg       const CeedInt ind  = indices[node + elem * P_1d * P_1d * P_1d];
152672b0f2aSSebastian Grimberg 
153672b0f2aSSebastian Grimberg       for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[z + comp * P_1d] = d_u[ind + COMP_STRIDE * comp];
1549e201c85SYohann     }
1559e201c85SYohann   }
156*688b5473SJeremy L Thompson }
1579e201c85SYohann 
1589e201c85SYohann //------------------------------------------------------------------------------
1599e201c85SYohann // L-vector -> E-vector, strided
1609e201c85SYohann //------------------------------------------------------------------------------
161672b0f2aSSebastian Grimberg template <int NUM_COMP, int P_1d, int STRIDES_NODE, int STRIDES_COMP, int STRIDES_ELEM>
162f815fac9SJeremy L Thompson inline __device__ void ReadLVecStrided3d(SharedData_Hip &data, const CeedInt elem, const CeedScalar *__restrict__ d_u, CeedScalar *__restrict__ r_u) {
163*688b5473SJeremy L Thompson   if (data.t_id_x < P_1d && data.t_id_y < P_1d) {
164672b0f2aSSebastian Grimberg     for (CeedInt z = 0; z < P_1d; z++) {
165672b0f2aSSebastian Grimberg       const CeedInt node = data.t_id_x + data.t_id_y * P_1d + z * P_1d * P_1d;
1669e201c85SYohann       const CeedInt ind  = node * STRIDES_NODE + elem * STRIDES_ELEM;
167672b0f2aSSebastian Grimberg 
168672b0f2aSSebastian Grimberg       for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[z + comp * P_1d] = d_u[ind + comp * STRIDES_COMP];
1699e201c85SYohann     }
1709e201c85SYohann   }
171*688b5473SJeremy L Thompson }
1729e201c85SYohann 
1739e201c85SYohann //------------------------------------------------------------------------------
1749e201c85SYohann // E-vector -> Q-vector, offests provided
1759e201c85SYohann //------------------------------------------------------------------------------
176672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int Q_1d>
177f815fac9SJeremy L Thompson inline __device__ void ReadEVecSliceStandard3d(SharedData_Hip &data, const CeedInt nquads, const CeedInt elem, const CeedInt q,
178f815fac9SJeremy L Thompson                                                const CeedInt *__restrict__ indices, const CeedScalar *__restrict__ d_u,
179f815fac9SJeremy L Thompson                                                CeedScalar *__restrict__ r_u) {
180672b0f2aSSebastian Grimberg   if (data.t_id_x < Q_1d && data.t_id_y < Q_1d) {
181672b0f2aSSebastian Grimberg     const CeedInt node = data.t_id_x + data.t_id_y * Q_1d + q * Q_1d * Q_1d;
182672b0f2aSSebastian Grimberg     const CeedInt ind  = indices[node + elem * Q_1d * Q_1d * Q_1d];
183672b0f2aSSebastian Grimberg 
184672b0f2aSSebastian Grimberg     for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[comp] = d_u[ind + COMP_STRIDE * comp];
1859e201c85SYohann   }
1869e201c85SYohann }
1879e201c85SYohann 
1889e201c85SYohann //------------------------------------------------------------------------------
1899e201c85SYohann // E-vector -> Q-vector, strided
1909e201c85SYohann //------------------------------------------------------------------------------
191672b0f2aSSebastian Grimberg template <int NUM_COMP, int Q_1d, int STRIDES_NODE, int STRIDES_COMP, int STRIDES_ELEM>
192f815fac9SJeremy L Thompson inline __device__ void ReadEVecSliceStrided3d(SharedData_Hip &data, const CeedInt elem, const CeedInt q, const CeedScalar *__restrict__ d_u,
193672b0f2aSSebastian Grimberg                                               CeedScalar *__restrict__ r_u) {
194672b0f2aSSebastian Grimberg   if (data.t_id_x < Q_1d && data.t_id_y < Q_1d) {
195672b0f2aSSebastian Grimberg     const CeedInt node = data.t_id_x + data.t_id_y * Q_1d + q * Q_1d * Q_1d;
1969e201c85SYohann     const CeedInt ind  = node * STRIDES_NODE + elem * STRIDES_ELEM;
197672b0f2aSSebastian Grimberg 
198672b0f2aSSebastian Grimberg     for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[comp] = d_u[ind + comp * STRIDES_COMP];
1999e201c85SYohann   }
2009e201c85SYohann }
2019e201c85SYohann 
2029e201c85SYohann //------------------------------------------------------------------------------
2039e201c85SYohann // E-vector -> L-vector, offsets provided
2049e201c85SYohann //------------------------------------------------------------------------------
205672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int P_1d>
206f815fac9SJeremy L Thompson inline __device__ void WriteLVecStandard3d(SharedData_Hip &data, const CeedInt num_nodes, const CeedInt elem, const CeedInt *__restrict__ indices,
207672b0f2aSSebastian Grimberg                                            const CeedScalar *__restrict__ r_v, CeedScalar *__restrict__ d_v) {
208*688b5473SJeremy L Thompson   if (data.t_id_x < P_1d && data.t_id_y < P_1d) {
209672b0f2aSSebastian Grimberg     for (CeedInt z = 0; z < P_1d; z++) {
210672b0f2aSSebastian Grimberg       const CeedInt node = data.t_id_x + data.t_id_y * P_1d + z * P_1d * P_1d;
211672b0f2aSSebastian Grimberg       const CeedInt ind  = indices[node + elem * P_1d * P_1d * P_1d];
212672b0f2aSSebastian Grimberg 
213672b0f2aSSebastian Grimberg       for (CeedInt comp = 0; comp < NUM_COMP; comp++) atomicAdd(&d_v[ind + COMP_STRIDE * comp], r_v[z + comp * P_1d]);
2149e201c85SYohann     }
2159e201c85SYohann   }
216*688b5473SJeremy L Thompson }
2179e201c85SYohann 
2189e201c85SYohann //------------------------------------------------------------------------------
2199e201c85SYohann // E-vector -> L-vector, strided
2209e201c85SYohann //------------------------------------------------------------------------------
221672b0f2aSSebastian Grimberg template <int NUM_COMP, int P_1d, int STRIDES_NODE, int STRIDES_COMP, int STRIDES_ELEM>
222f815fac9SJeremy L Thompson inline __device__ void WriteLVecStrided3d(SharedData_Hip &data, const CeedInt elem, const CeedScalar *__restrict__ r_v,
223672b0f2aSSebastian Grimberg                                           CeedScalar *__restrict__ d_v) {
224*688b5473SJeremy L Thompson   if (data.t_id_x < P_1d && data.t_id_y < P_1d) {
225672b0f2aSSebastian Grimberg     for (CeedInt z = 0; z < P_1d; z++) {
226672b0f2aSSebastian Grimberg       const CeedInt node = data.t_id_x + data.t_id_y * P_1d + z * P_1d * P_1d;
2279e201c85SYohann       const CeedInt ind  = node * STRIDES_NODE + elem * STRIDES_ELEM;
228672b0f2aSSebastian Grimberg 
229672b0f2aSSebastian Grimberg       for (CeedInt comp = 0; comp < NUM_COMP; comp++) d_v[ind + comp * STRIDES_COMP] += r_v[z + comp * P_1d];
2309e201c85SYohann     }
2319e201c85SYohann   }
232*688b5473SJeremy L Thompson }
2339e201c85SYohann 
2349e201c85SYohann //------------------------------------------------------------------------------
2359e201c85SYohann // 3D collocated derivatives computation
2369e201c85SYohann //------------------------------------------------------------------------------
237672b0f2aSSebastian Grimberg template <int NUM_COMP, int Q_1d>
238f815fac9SJeremy L Thompson inline __device__ void GradColloSlice3d(SharedData_Hip &data, const CeedInt q, const CeedScalar *__restrict__ r_U, const CeedScalar *c_G,
2392b730f8bSJeremy L Thompson                                         CeedScalar *__restrict__ r_V) {
240672b0f2aSSebastian Grimberg   if (data.t_id_x < Q_1d && data.t_id_y < Q_1d) {
241672b0f2aSSebastian Grimberg     for (CeedInt comp = 0; comp < NUM_COMP; comp++) {
242672b0f2aSSebastian Grimberg       data.slice[data.t_id_x + data.t_id_y * T_1D] = r_U[q + comp * Q_1d];
2439e201c85SYohann       __syncthreads();
2449e201c85SYohann       // X derivative
245672b0f2aSSebastian Grimberg       r_V[comp + 0 * NUM_COMP] = 0.0;
246*688b5473SJeremy L Thompson       for (CeedInt i = 0; i < Q_1d; i++) {
247*688b5473SJeremy L Thompson         r_V[comp + 0 * NUM_COMP] += c_G[i + data.t_id_x * Q_1d] * data.slice[i + data.t_id_y * T_1D];
248*688b5473SJeremy L Thompson       }
2499e201c85SYohann       // Y derivative
250672b0f2aSSebastian Grimberg       r_V[comp + 1 * NUM_COMP] = 0.0;
251*688b5473SJeremy L Thompson       for (CeedInt i = 0; i < Q_1d; i++) {
252*688b5473SJeremy L Thompson         r_V[comp + 1 * NUM_COMP] += c_G[i + data.t_id_y * Q_1d] * data.slice[data.t_id_x + i * T_1D];
253*688b5473SJeremy L Thompson       }
2549e201c85SYohann       // Z derivative
255672b0f2aSSebastian Grimberg       r_V[comp + 2 * NUM_COMP] = 0.0;
256*688b5473SJeremy L Thompson       for (CeedInt i = 0; i < Q_1d; i++) {
257*688b5473SJeremy L Thompson         r_V[comp + 2 * NUM_COMP] += c_G[i + q * Q_1d] * r_U[i + comp * Q_1d];
258*688b5473SJeremy L Thompson       }
2599e201c85SYohann       __syncthreads();
2609e201c85SYohann     }
2619e201c85SYohann   }
2629e201c85SYohann }
2639e201c85SYohann 
2649e201c85SYohann //------------------------------------------------------------------------------
2659e201c85SYohann // 3D collocated derivatives transpose
2669e201c85SYohann //------------------------------------------------------------------------------
267672b0f2aSSebastian Grimberg template <int NUM_COMP, int Q_1d>
268f815fac9SJeremy L Thompson inline __device__ void GradColloSliceTranspose3d(SharedData_Hip &data, const CeedInt q, const CeedScalar *__restrict__ r_U, const CeedScalar *c_G,
2692b730f8bSJeremy L Thompson                                                  CeedScalar *__restrict__ r_V) {
270672b0f2aSSebastian Grimberg   if (data.t_id_x < Q_1d && data.t_id_y < Q_1d) {
271672b0f2aSSebastian Grimberg     for (CeedInt comp = 0; comp < NUM_COMP; comp++) {
2729e201c85SYohann       // X derivative
273672b0f2aSSebastian Grimberg       data.slice[data.t_id_x + data.t_id_y * T_1D] = r_U[comp + 0 * NUM_COMP];
2749e201c85SYohann       __syncthreads();
275*688b5473SJeremy L Thompson       for (CeedInt i = 0; i < Q_1d; i++) {
276*688b5473SJeremy L Thompson         r_V[q + comp * Q_1d] += c_G[data.t_id_x + i * Q_1d] * data.slice[i + data.t_id_y * T_1D];
277*688b5473SJeremy L Thompson       }
2789e201c85SYohann       __syncthreads();
2799e201c85SYohann       // Y derivative
280672b0f2aSSebastian Grimberg       data.slice[data.t_id_x + data.t_id_y * T_1D] = r_U[comp + 1 * NUM_COMP];
2819e201c85SYohann       __syncthreads();
282*688b5473SJeremy L Thompson       for (CeedInt i = 0; i < Q_1d; i++) {
283*688b5473SJeremy L Thompson         r_V[q + comp * Q_1d] += c_G[data.t_id_y + i * Q_1d] * data.slice[data.t_id_x + i * T_1D];
284*688b5473SJeremy L Thompson       }
2859e201c85SYohann       __syncthreads();
2869e201c85SYohann       // Z derivative
287*688b5473SJeremy L Thompson       for (CeedInt i = 0; i < Q_1d; i++) {
288*688b5473SJeremy L Thompson         r_V[i + comp * Q_1d] += c_G[i + q * Q_1d] * r_U[comp + 2 * NUM_COMP];
289*688b5473SJeremy L Thompson       }
2909e201c85SYohann     }
2919e201c85SYohann   }
2929e201c85SYohann }
293