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 //------------------------------------------------------------------------------ 21*3a2968d6SJeremy L Thompson // AtPoints 22*3a2968d6SJeremy L Thompson //------------------------------------------------------------------------------ 23*3a2968d6SJeremy L Thompson 24*3a2968d6SJeremy L Thompson //------------------------------------------------------------------------------ 25*3a2968d6SJeremy L Thompson // L-vector -> single point 26*3a2968d6SJeremy L Thompson //------------------------------------------------------------------------------ 27*3a2968d6SJeremy L Thompson template <int NUM_COMP, int COMP_STRIDE, int NUM_PTS> 28*3a2968d6SJeremy L Thompson inline __device__ void ReadPoint(SharedData_Hip &data, const CeedInt elem, const CeedInt p, const CeedInt points_in_elem, 29*3a2968d6SJeremy L Thompson const CeedInt *__restrict__ indices, const CeedScalar *__restrict__ d_u, CeedScalar *r_u) { 30*3a2968d6SJeremy L Thompson const CeedInt ind = indices[p + elem * NUM_PTS]; 31*3a2968d6SJeremy L Thompson 32*3a2968d6SJeremy L Thompson for (CeedInt comp = 0; comp < NUM_COMP; comp++) { 33*3a2968d6SJeremy L Thompson r_u[comp] = d_u[ind + comp * COMP_STRIDE]; 34*3a2968d6SJeremy L Thompson } 35*3a2968d6SJeremy L Thompson } 36*3a2968d6SJeremy L Thompson 37*3a2968d6SJeremy L Thompson //------------------------------------------------------------------------------ 38*3a2968d6SJeremy L Thompson // Single point -> L-vector 39*3a2968d6SJeremy L Thompson //------------------------------------------------------------------------------ 40*3a2968d6SJeremy L Thompson template <int NUM_COMP, int COMP_STRIDE, int NUM_PTS> 41*3a2968d6SJeremy L Thompson inline __device__ void WritePoint(SharedData_Hip &data, const CeedInt elem, const CeedInt p, const CeedInt points_in_elem, 42*3a2968d6SJeremy L Thompson const CeedInt *__restrict__ indices, const CeedScalar *__restrict__ r_u, CeedScalar *d_u) { 43*3a2968d6SJeremy L Thompson if (p < points_in_elem) { 44*3a2968d6SJeremy L Thompson const CeedInt ind = indices[p + elem * NUM_PTS]; 45*3a2968d6SJeremy L Thompson 46*3a2968d6SJeremy L Thompson for (CeedInt comp = 0; comp < NUM_COMP; comp++) { 47*3a2968d6SJeremy L Thompson d_u[ind + comp * COMP_STRIDE] += r_u[comp]; 48*3a2968d6SJeremy L Thompson } 49*3a2968d6SJeremy L Thompson } 50*3a2968d6SJeremy L Thompson } 51*3a2968d6SJeremy L Thompson 52*3a2968d6SJeremy L Thompson //------------------------------------------------------------------------------ 539e201c85SYohann // 1D 549e201c85SYohann //------------------------------------------------------------------------------ 559e201c85SYohann 569e201c85SYohann //------------------------------------------------------------------------------ 579e201c85SYohann // L-vector -> E-vector, offsets provided 589e201c85SYohann //------------------------------------------------------------------------------ 59672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int P_1d> 60f815fac9SJeremy L Thompson inline __device__ void ReadLVecStandard1d(SharedData_Hip &data, const CeedInt num_nodes, const CeedInt elem, const CeedInt *__restrict__ indices, 61672b0f2aSSebastian Grimberg const CeedScalar *__restrict__ d_u, CeedScalar *__restrict__ r_u) { 62672b0f2aSSebastian Grimberg if (data.t_id_x < P_1d) { 639e201c85SYohann const CeedInt node = data.t_id_x; 64672b0f2aSSebastian Grimberg const CeedInt ind = indices[node + elem * P_1d]; 65672b0f2aSSebastian Grimberg 66672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[comp] = d_u[ind + COMP_STRIDE * comp]; 679e201c85SYohann } 689e201c85SYohann } 699e201c85SYohann 709e201c85SYohann //------------------------------------------------------------------------------ 719e201c85SYohann // L-vector -> E-vector, strided 729e201c85SYohann //------------------------------------------------------------------------------ 73672b0f2aSSebastian Grimberg template <int NUM_COMP, int P_1d, int STRIDES_NODE, int STRIDES_COMP, int STRIDES_ELEM> 74f815fac9SJeremy L Thompson inline __device__ void ReadLVecStrided1d(SharedData_Hip &data, const CeedInt elem, const CeedScalar *__restrict__ d_u, CeedScalar *__restrict__ r_u) { 75672b0f2aSSebastian Grimberg if (data.t_id_x < P_1d) { 769e201c85SYohann const CeedInt node = data.t_id_x; 779e201c85SYohann const CeedInt ind = node * STRIDES_NODE + elem * STRIDES_ELEM; 78672b0f2aSSebastian Grimberg 79672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[comp] = d_u[ind + comp * STRIDES_COMP]; 809e201c85SYohann } 819e201c85SYohann } 829e201c85SYohann 839e201c85SYohann //------------------------------------------------------------------------------ 849e201c85SYohann // E-vector -> L-vector, offsets provided 859e201c85SYohann //------------------------------------------------------------------------------ 86672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int P_1d> 87f815fac9SJeremy L Thompson inline __device__ void WriteLVecStandard1d(SharedData_Hip &data, const CeedInt num_nodes, const CeedInt elem, const CeedInt *__restrict__ indices, 88672b0f2aSSebastian Grimberg const CeedScalar *__restrict__ r_v, CeedScalar *__restrict__ d_v) { 89672b0f2aSSebastian Grimberg if (data.t_id_x < P_1d) { 909e201c85SYohann const CeedInt node = data.t_id_x; 91672b0f2aSSebastian Grimberg const CeedInt ind = indices[node + elem * P_1d]; 92672b0f2aSSebastian Grimberg 93672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) atomicAdd(&d_v[ind + COMP_STRIDE * comp], r_v[comp]); 949e201c85SYohann } 959e201c85SYohann } 969e201c85SYohann 979e201c85SYohann //------------------------------------------------------------------------------ 989e201c85SYohann // E-vector -> L-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 WriteLVecStrided1d(SharedData_Hip &data, const CeedInt elem, const CeedScalar *__restrict__ r_v, 102672b0f2aSSebastian Grimberg CeedScalar *__restrict__ d_v) { 103672b0f2aSSebastian Grimberg if (data.t_id_x < P_1d) { 1049e201c85SYohann const CeedInt node = data.t_id_x; 1059e201c85SYohann const CeedInt ind = node * STRIDES_NODE + elem * STRIDES_ELEM; 106672b0f2aSSebastian Grimberg 107672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) d_v[ind + comp * STRIDES_COMP] += r_v[comp]; 1089e201c85SYohann } 1099e201c85SYohann } 1109e201c85SYohann 1119e201c85SYohann //------------------------------------------------------------------------------ 1129e201c85SYohann // 2D 1139e201c85SYohann //------------------------------------------------------------------------------ 1149e201c85SYohann 1159e201c85SYohann //------------------------------------------------------------------------------ 1169e201c85SYohann // L-vector -> E-vector, offsets provided 1179e201c85SYohann //------------------------------------------------------------------------------ 118672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int P_1d> 119f815fac9SJeremy L Thompson inline __device__ void ReadLVecStandard2d(SharedData_Hip &data, const CeedInt num_nodes, const CeedInt elem, const CeedInt *__restrict__ indices, 120672b0f2aSSebastian Grimberg const CeedScalar *__restrict__ d_u, CeedScalar *__restrict__ r_u) { 121672b0f2aSSebastian Grimberg if (data.t_id_x < P_1d && data.t_id_y < P_1d) { 122672b0f2aSSebastian Grimberg const CeedInt node = data.t_id_x + data.t_id_y * P_1d; 123672b0f2aSSebastian Grimberg const CeedInt ind = indices[node + elem * P_1d * P_1d]; 124672b0f2aSSebastian Grimberg 125672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[comp] = d_u[ind + COMP_STRIDE * comp]; 1269e201c85SYohann } 1279e201c85SYohann } 1289e201c85SYohann 1299e201c85SYohann //------------------------------------------------------------------------------ 1309e201c85SYohann // L-vector -> E-vector, strided 1319e201c85SYohann //------------------------------------------------------------------------------ 132672b0f2aSSebastian Grimberg template <int NUM_COMP, int P_1d, int STRIDES_NODE, int STRIDES_COMP, int STRIDES_ELEM> 133f815fac9SJeremy L Thompson inline __device__ void ReadLVecStrided2d(SharedData_Hip &data, const CeedInt elem, const CeedScalar *__restrict__ d_u, CeedScalar *__restrict__ r_u) { 134672b0f2aSSebastian Grimberg if (data.t_id_x < P_1d && data.t_id_y < P_1d) { 135672b0f2aSSebastian Grimberg const CeedInt node = data.t_id_x + data.t_id_y * P_1d; 1369e201c85SYohann const CeedInt ind = node * STRIDES_NODE + elem * STRIDES_ELEM; 137672b0f2aSSebastian Grimberg 138672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[comp] = d_u[ind + comp * STRIDES_COMP]; 1399e201c85SYohann } 1409e201c85SYohann } 1419e201c85SYohann 1429e201c85SYohann //------------------------------------------------------------------------------ 1439e201c85SYohann // E-vector -> L-vector, offsets provided 1449e201c85SYohann //------------------------------------------------------------------------------ 145672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int P_1d> 146f815fac9SJeremy L Thompson inline __device__ void WriteLVecStandard2d(SharedData_Hip &data, const CeedInt num_nodes, const CeedInt elem, const CeedInt *__restrict__ indices, 147672b0f2aSSebastian Grimberg const CeedScalar *__restrict__ r_v, CeedScalar *__restrict__ d_v) { 148672b0f2aSSebastian Grimberg if (data.t_id_x < P_1d && data.t_id_y < P_1d) { 149672b0f2aSSebastian Grimberg const CeedInt node = data.t_id_x + data.t_id_y * P_1d; 150672b0f2aSSebastian Grimberg const CeedInt ind = indices[node + elem * P_1d * P_1d]; 151672b0f2aSSebastian Grimberg 152672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) atomicAdd(&d_v[ind + COMP_STRIDE * comp], r_v[comp]); 1539e201c85SYohann } 1549e201c85SYohann } 1559e201c85SYohann 1569e201c85SYohann //------------------------------------------------------------------------------ 1579e201c85SYohann // E-vector -> L-vector, strided 1589e201c85SYohann //------------------------------------------------------------------------------ 159672b0f2aSSebastian Grimberg template <int NUM_COMP, int P_1d, int STRIDES_NODE, int STRIDES_COMP, int STRIDES_ELEM> 160f815fac9SJeremy L Thompson inline __device__ void WriteLVecStrided2d(SharedData_Hip &data, const CeedInt elem, const CeedScalar *__restrict__ r_v, 161672b0f2aSSebastian Grimberg CeedScalar *__restrict__ d_v) { 162672b0f2aSSebastian Grimberg if (data.t_id_x < P_1d && data.t_id_y < P_1d) { 163672b0f2aSSebastian Grimberg const CeedInt node = data.t_id_x + data.t_id_y * P_1d; 1649e201c85SYohann const CeedInt ind = node * STRIDES_NODE + elem * STRIDES_ELEM; 165672b0f2aSSebastian Grimberg 166672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) d_v[ind + comp * STRIDES_COMP] += r_v[comp]; 1679e201c85SYohann } 1689e201c85SYohann } 1699e201c85SYohann 1709e201c85SYohann //------------------------------------------------------------------------------ 1719e201c85SYohann // 3D 1729e201c85SYohann //------------------------------------------------------------------------------ 1739e201c85SYohann 1749e201c85SYohann //------------------------------------------------------------------------------ 1759e201c85SYohann // L-vector -> E-vector, offsets provided 1769e201c85SYohann //------------------------------------------------------------------------------ 177672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int P_1d> 178f815fac9SJeremy L Thompson inline __device__ void ReadLVecStandard3d(SharedData_Hip &data, const CeedInt num_nodes, const CeedInt elem, const CeedInt *__restrict__ indices, 179672b0f2aSSebastian Grimberg const CeedScalar *__restrict__ d_u, CeedScalar *__restrict__ r_u) { 180688b5473SJeremy L Thompson if (data.t_id_x < P_1d && data.t_id_y < P_1d) { 181672b0f2aSSebastian Grimberg for (CeedInt z = 0; z < P_1d; z++) { 182672b0f2aSSebastian Grimberg const CeedInt node = data.t_id_x + data.t_id_y * P_1d + z * P_1d * P_1d; 183672b0f2aSSebastian Grimberg const CeedInt ind = indices[node + elem * P_1d * P_1d * P_1d]; 184672b0f2aSSebastian Grimberg 185672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[z + comp * P_1d] = d_u[ind + COMP_STRIDE * comp]; 1869e201c85SYohann } 1879e201c85SYohann } 188688b5473SJeremy L Thompson } 1899e201c85SYohann 1909e201c85SYohann //------------------------------------------------------------------------------ 1919e201c85SYohann // L-vector -> E-vector, strided 1929e201c85SYohann //------------------------------------------------------------------------------ 193672b0f2aSSebastian Grimberg template <int NUM_COMP, int P_1d, int STRIDES_NODE, int STRIDES_COMP, int STRIDES_ELEM> 194f815fac9SJeremy L Thompson inline __device__ void ReadLVecStrided3d(SharedData_Hip &data, const CeedInt elem, const CeedScalar *__restrict__ d_u, CeedScalar *__restrict__ r_u) { 195688b5473SJeremy L Thompson if (data.t_id_x < P_1d && data.t_id_y < P_1d) { 196672b0f2aSSebastian Grimberg for (CeedInt z = 0; z < P_1d; z++) { 197672b0f2aSSebastian Grimberg const CeedInt node = data.t_id_x + data.t_id_y * P_1d + z * P_1d * P_1d; 1989e201c85SYohann const CeedInt ind = node * STRIDES_NODE + elem * STRIDES_ELEM; 199672b0f2aSSebastian Grimberg 200672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[z + comp * P_1d] = d_u[ind + comp * STRIDES_COMP]; 2019e201c85SYohann } 2029e201c85SYohann } 203688b5473SJeremy L Thompson } 2049e201c85SYohann 2059e201c85SYohann //------------------------------------------------------------------------------ 2069e201c85SYohann // E-vector -> Q-vector, offests provided 2079e201c85SYohann //------------------------------------------------------------------------------ 208672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int Q_1d> 209f815fac9SJeremy L Thompson inline __device__ void ReadEVecSliceStandard3d(SharedData_Hip &data, const CeedInt nquads, const CeedInt elem, const CeedInt q, 210f815fac9SJeremy L Thompson const CeedInt *__restrict__ indices, const CeedScalar *__restrict__ d_u, 211f815fac9SJeremy L Thompson CeedScalar *__restrict__ r_u) { 212672b0f2aSSebastian Grimberg if (data.t_id_x < Q_1d && data.t_id_y < Q_1d) { 213672b0f2aSSebastian Grimberg const CeedInt node = data.t_id_x + data.t_id_y * Q_1d + q * Q_1d * Q_1d; 214672b0f2aSSebastian Grimberg const CeedInt ind = indices[node + elem * Q_1d * Q_1d * Q_1d]; 215672b0f2aSSebastian Grimberg 216672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[comp] = d_u[ind + COMP_STRIDE * comp]; 2179e201c85SYohann } 2189e201c85SYohann } 2199e201c85SYohann 2209e201c85SYohann //------------------------------------------------------------------------------ 2219e201c85SYohann // E-vector -> Q-vector, strided 2229e201c85SYohann //------------------------------------------------------------------------------ 223672b0f2aSSebastian Grimberg template <int NUM_COMP, int Q_1d, int STRIDES_NODE, int STRIDES_COMP, int STRIDES_ELEM> 224f815fac9SJeremy L Thompson inline __device__ void ReadEVecSliceStrided3d(SharedData_Hip &data, const CeedInt elem, const CeedInt q, const CeedScalar *__restrict__ d_u, 225672b0f2aSSebastian Grimberg CeedScalar *__restrict__ r_u) { 226672b0f2aSSebastian Grimberg if (data.t_id_x < Q_1d && data.t_id_y < Q_1d) { 227672b0f2aSSebastian Grimberg const CeedInt node = data.t_id_x + data.t_id_y * Q_1d + q * Q_1d * Q_1d; 2289e201c85SYohann const CeedInt ind = node * STRIDES_NODE + elem * STRIDES_ELEM; 229672b0f2aSSebastian Grimberg 230672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) r_u[comp] = d_u[ind + comp * STRIDES_COMP]; 2319e201c85SYohann } 2329e201c85SYohann } 2339e201c85SYohann 2349e201c85SYohann //------------------------------------------------------------------------------ 2359e201c85SYohann // E-vector -> L-vector, offsets provided 2369e201c85SYohann //------------------------------------------------------------------------------ 237672b0f2aSSebastian Grimberg template <int NUM_COMP, int COMP_STRIDE, int P_1d> 238f815fac9SJeremy L Thompson inline __device__ void WriteLVecStandard3d(SharedData_Hip &data, const CeedInt num_nodes, const CeedInt elem, const CeedInt *__restrict__ indices, 239672b0f2aSSebastian Grimberg const CeedScalar *__restrict__ r_v, CeedScalar *__restrict__ d_v) { 240688b5473SJeremy L Thompson if (data.t_id_x < P_1d && data.t_id_y < P_1d) { 241672b0f2aSSebastian Grimberg for (CeedInt z = 0; z < P_1d; z++) { 242672b0f2aSSebastian Grimberg const CeedInt node = data.t_id_x + data.t_id_y * P_1d + z * P_1d * P_1d; 243672b0f2aSSebastian Grimberg const CeedInt ind = indices[node + elem * P_1d * P_1d * P_1d]; 244672b0f2aSSebastian Grimberg 245672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) atomicAdd(&d_v[ind + COMP_STRIDE * comp], r_v[z + comp * P_1d]); 2469e201c85SYohann } 2479e201c85SYohann } 248688b5473SJeremy L Thompson } 2499e201c85SYohann 2509e201c85SYohann //------------------------------------------------------------------------------ 2519e201c85SYohann // E-vector -> L-vector, strided 2529e201c85SYohann //------------------------------------------------------------------------------ 253672b0f2aSSebastian Grimberg template <int NUM_COMP, int P_1d, int STRIDES_NODE, int STRIDES_COMP, int STRIDES_ELEM> 254f815fac9SJeremy L Thompson inline __device__ void WriteLVecStrided3d(SharedData_Hip &data, const CeedInt elem, const CeedScalar *__restrict__ r_v, 255672b0f2aSSebastian Grimberg CeedScalar *__restrict__ d_v) { 256688b5473SJeremy L Thompson if (data.t_id_x < P_1d && data.t_id_y < P_1d) { 257672b0f2aSSebastian Grimberg for (CeedInt z = 0; z < P_1d; z++) { 258672b0f2aSSebastian Grimberg const CeedInt node = data.t_id_x + data.t_id_y * P_1d + z * P_1d * P_1d; 2599e201c85SYohann const CeedInt ind = node * STRIDES_NODE + elem * STRIDES_ELEM; 260672b0f2aSSebastian Grimberg 261672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) d_v[ind + comp * STRIDES_COMP] += r_v[z + comp * P_1d]; 2629e201c85SYohann } 2639e201c85SYohann } 264688b5473SJeremy L Thompson } 2659e201c85SYohann 2669e201c85SYohann //------------------------------------------------------------------------------ 2679e201c85SYohann // 3D collocated derivatives computation 2689e201c85SYohann //------------------------------------------------------------------------------ 269672b0f2aSSebastian Grimberg template <int NUM_COMP, int Q_1d> 270f815fac9SJeremy L Thompson inline __device__ void GradColloSlice3d(SharedData_Hip &data, const CeedInt q, const CeedScalar *__restrict__ r_U, const CeedScalar *c_G, 2712b730f8bSJeremy L Thompson CeedScalar *__restrict__ r_V) { 272672b0f2aSSebastian Grimberg if (data.t_id_x < Q_1d && data.t_id_y < Q_1d) { 273672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) { 274672b0f2aSSebastian Grimberg data.slice[data.t_id_x + data.t_id_y * T_1D] = r_U[q + comp * Q_1d]; 2759e201c85SYohann __syncthreads(); 2769e201c85SYohann // X derivative 277672b0f2aSSebastian Grimberg r_V[comp + 0 * NUM_COMP] = 0.0; 278688b5473SJeremy L Thompson for (CeedInt i = 0; i < Q_1d; i++) { 279688b5473SJeremy 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]; 280688b5473SJeremy L Thompson } 2819e201c85SYohann // Y derivative 282672b0f2aSSebastian Grimberg r_V[comp + 1 * NUM_COMP] = 0.0; 283688b5473SJeremy L Thompson for (CeedInt i = 0; i < Q_1d; i++) { 284688b5473SJeremy 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]; 285688b5473SJeremy L Thompson } 2869e201c85SYohann // Z derivative 287672b0f2aSSebastian Grimberg r_V[comp + 2 * NUM_COMP] = 0.0; 288688b5473SJeremy L Thompson for (CeedInt i = 0; i < Q_1d; i++) { 289688b5473SJeremy L Thompson r_V[comp + 2 * NUM_COMP] += c_G[i + q * Q_1d] * r_U[i + comp * Q_1d]; 290688b5473SJeremy L Thompson } 2919e201c85SYohann __syncthreads(); 2929e201c85SYohann } 2939e201c85SYohann } 2949e201c85SYohann } 2959e201c85SYohann 2969e201c85SYohann //------------------------------------------------------------------------------ 2979e201c85SYohann // 3D collocated derivatives transpose 2989e201c85SYohann //------------------------------------------------------------------------------ 299672b0f2aSSebastian Grimberg template <int NUM_COMP, int Q_1d> 300f815fac9SJeremy L Thompson inline __device__ void GradColloSliceTranspose3d(SharedData_Hip &data, const CeedInt q, const CeedScalar *__restrict__ r_U, const CeedScalar *c_G, 3012b730f8bSJeremy L Thompson CeedScalar *__restrict__ r_V) { 302672b0f2aSSebastian Grimberg if (data.t_id_x < Q_1d && data.t_id_y < Q_1d) { 303672b0f2aSSebastian Grimberg for (CeedInt comp = 0; comp < NUM_COMP; comp++) { 3049e201c85SYohann // X derivative 305672b0f2aSSebastian Grimberg data.slice[data.t_id_x + data.t_id_y * T_1D] = r_U[comp + 0 * NUM_COMP]; 3069e201c85SYohann __syncthreads(); 307688b5473SJeremy L Thompson for (CeedInt i = 0; i < Q_1d; i++) { 308688b5473SJeremy 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]; 309688b5473SJeremy L Thompson } 3109e201c85SYohann __syncthreads(); 3119e201c85SYohann // Y derivative 312672b0f2aSSebastian Grimberg data.slice[data.t_id_x + data.t_id_y * T_1D] = r_U[comp + 1 * NUM_COMP]; 3139e201c85SYohann __syncthreads(); 314688b5473SJeremy L Thompson for (CeedInt i = 0; i < Q_1d; i++) { 315688b5473SJeremy 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]; 316688b5473SJeremy L Thompson } 3179e201c85SYohann __syncthreads(); 3189e201c85SYohann // Z derivative 319688b5473SJeremy L Thompson for (CeedInt i = 0; i < Q_1d; i++) { 320688b5473SJeremy L Thompson r_V[i + comp * Q_1d] += c_G[i + q * Q_1d] * r_U[comp + 2 * NUM_COMP]; 321688b5473SJeremy L Thompson } 3229e201c85SYohann } 3239e201c85SYohann } 3249e201c85SYohann } 325