xref: /libCEED/rust/libceed-sys/c-src/backends/hip/ceed-hip-compile.h (revision 51475c7c4e99ed8faf0a644c51f7b001cf768463)
13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
330f4f45fSnbeams //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
530f4f45fSnbeams //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
73d576824SJeremy L Thompson 
830f4f45fSnbeams #ifndef _ceed_hip_compile_h
930f4f45fSnbeams #define _ceed_hip_compile_h
1030f4f45fSnbeams 
1149aac155SJeremy L Thompson #include <ceed.h>
122b730f8bSJeremy L Thompson #include <ceed/backend.h>
1330f4f45fSnbeams #include <hip/hip_runtime.h>
1430f4f45fSnbeams 
152b730f8bSJeremy L Thompson static inline CeedInt CeedDivUpInt(CeedInt numerator, CeedInt denominator) { return (numerator + denominator - 1) / denominator; }
160d0321e0SJeremy L Thompson 
172b730f8bSJeremy L Thompson CEED_INTERN int CeedCompileHip(Ceed ceed, const char *source, hipModule_t *module, const CeedInt num_defines, ...);
1830f4f45fSnbeams 
192b730f8bSJeremy L Thompson CEED_INTERN int CeedGetKernelHip(Ceed ceed, hipModule_t module, const char *name, hipFunction_t *kernel);
2030f4f45fSnbeams 
21*51475c7cSJeremy L Thompson CEED_INTERN int CeedRunKernelHip(Ceed ceed, hipFunction_t kernel, int grid_size, int block_size, void **args);
2230f4f45fSnbeams 
23*51475c7cSJeremy L Thompson CEED_INTERN int CeedRunKernelDimHip(Ceed ceed, hipFunction_t kernel, int grid_size, int block_size_x, int block_size_y, int block_size_z,
24*51475c7cSJeremy L Thompson                                     void **args);
2530f4f45fSnbeams 
26*51475c7cSJeremy L Thompson CEED_INTERN int CeedRunKernelDimSharedHip(Ceed ceed, hipFunction_t kernel, int grid_size, int block_size_x, int block_size_y, int block_size_z,
27*51475c7cSJeremy L Thompson                                           int shared_mem_size, void **args);
2830f4f45fSnbeams 
293d576824SJeremy L Thompson #endif  // _ceed_hip_compile_h
30