| ceed-hip-compile.cpp (d7c593293e00f7bc51f26f45435d6890398f4ce7) | ceed-hip-compile.cpp (e9c76bddc0f2a44f522e0176ed6b7e0c0aa1df73) |
|---|---|
| 1// Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8#include "ceed-hip-compile.h" --- 191 unchanged lines hidden (view full) --- 200 void **args) { 201 CeedCallHip(ceed, hipModuleLaunchKernel(kernel, grid_size, 1, 1, block_size_x, block_size_y, block_size_z, 0, NULL, args, NULL)); 202 return CEED_ERROR_SUCCESS; 203} 204 205//------------------------------------------------------------------------------ 206// Run HIP kernel for spatial dimension with shared memory 207//------------------------------------------------------------------------------ | 1// Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8#include "ceed-hip-compile.h" --- 191 unchanged lines hidden (view full) --- 200 void **args) { 201 CeedCallHip(ceed, hipModuleLaunchKernel(kernel, grid_size, 1, 1, block_size_x, block_size_y, block_size_z, 0, NULL, args, NULL)); 202 return CEED_ERROR_SUCCESS; 203} 204 205//------------------------------------------------------------------------------ 206// Run HIP kernel for spatial dimension with shared memory 207//------------------------------------------------------------------------------ |
| 208static int CeedRunKernelDimSharedCore_Hip(Ceed ceed, hipFunction_t kernel, const int grid_size, const int block_size_x, const int block_size_y, 209 const int block_size_z, const int shared_mem_size, const bool throw_error, bool *is_good_run, void **args) { 210 hipError_t result = hipModuleLaunchKernel(kernel, grid_size, 1, 1, block_size_x, block_size_y, block_size_z, shared_mem_size, NULL, args, NULL); | 208static int CeedRunKernelDimSharedCore_Hip(Ceed ceed, hipFunction_t kernel, hipStream_t stream, const int grid_size, const int block_size_x, 209 const int block_size_y, const int block_size_z, const int shared_mem_size, const bool throw_error, 210 bool *is_good_run, void **args) { 211 hipError_t result = hipModuleLaunchKernel(kernel, grid_size, 1, 1, block_size_x, block_size_y, block_size_z, shared_mem_size, stream, args, NULL); |
| 211 212 *is_good_run = result == hipSuccess; 213 if (throw_error) CeedCallHip(ceed, result); 214 return CEED_ERROR_SUCCESS; 215} 216 | 212 213 *is_good_run = result == hipSuccess; 214 if (throw_error) CeedCallHip(ceed, result); 215 return CEED_ERROR_SUCCESS; 216} 217 |
| 217int CeedRunKernelDimShared_Hip(Ceed ceed, hipFunction_t kernel, const int grid_size, const int block_size_x, const int block_size_y, 218 const int block_size_z, const int shared_mem_size, void **args) { | 218int CeedRunKernelDimShared_Hip(Ceed ceed, hipFunction_t kernel, hipStream_t stream, const int grid_size, const int block_size_x, 219 const int block_size_y, const int block_size_z, const int shared_mem_size, void **args) { |
| 219 bool is_good_run = true; 220 | 220 bool is_good_run = true; 221 |
| 221 CeedCallBackend( 222 CeedRunKernelDimSharedCore_Hip(ceed, kernel, grid_size, block_size_x, block_size_y, block_size_z, shared_mem_size, true, &is_good_run, args)); | 222 CeedCallBackend(CeedRunKernelDimSharedCore_Hip(ceed, kernel, stream, grid_size, block_size_x, block_size_y, block_size_z, shared_mem_size, true, 223 &is_good_run, args)); |
| 223 return CEED_ERROR_SUCCESS; 224} 225 | 224 return CEED_ERROR_SUCCESS; 225} 226 |
| 226int CeedTryRunKernelDimShared_Hip(Ceed ceed, hipFunction_t kernel, const int grid_size, const int block_size_x, const int block_size_y, 227 const int block_size_z, const int shared_mem_size, bool *is_good_run, void **args) { 228 CeedCallBackend( 229 CeedRunKernelDimSharedCore_Hip(ceed, kernel, grid_size, block_size_x, block_size_y, block_size_z, shared_mem_size, false, is_good_run, args)); | 227int CeedTryRunKernelDimShared_Hip(Ceed ceed, hipFunction_t kernel, hipStream_t stream, const int grid_size, const int block_size_x, 228 const int block_size_y, const int block_size_z, const int shared_mem_size, bool *is_good_run, void **args) { 229 CeedCallBackend(CeedRunKernelDimSharedCore_Hip(ceed, kernel, stream, grid_size, block_size_x, block_size_y, block_size_z, shared_mem_size, false, 230 is_good_run, args)); |
| 230 return CEED_ERROR_SUCCESS; 231} 232 233//------------------------------------------------------------------------------ | 231 return CEED_ERROR_SUCCESS; 232} 233 234//------------------------------------------------------------------------------ |