xref: /libCEED/rust/libceed-sys/c-src/backends/hip/ceed-hip-compile.h (revision 5aed82e4fa97acf4ba24a7f10a35f5303a6798e0)
1*5aed82e4SJeremy L Thompson // Copyright (c) 2017-2024, 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 
894b7b29bSJeremy L Thompson #ifndef CEED_HIP_COMPILE_H
994b7b29bSJeremy L Thompson #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 
17eb7e6cafSJeremy L Thompson CEED_INTERN int CeedCompile_Hip(Ceed ceed, const char *source, hipModule_t *module, const CeedInt num_defines, ...);
1830f4f45fSnbeams 
19eb7e6cafSJeremy L Thompson CEED_INTERN int CeedGetKernel_Hip(Ceed ceed, hipModule_t module, const char *name, hipFunction_t *kernel);
2030f4f45fSnbeams 
21eb7e6cafSJeremy L Thompson CEED_INTERN int CeedRunKernel_Hip(Ceed ceed, hipFunction_t kernel, int grid_size, int block_size, void **args);
2230f4f45fSnbeams 
23eb7e6cafSJeremy L Thompson CEED_INTERN int CeedRunKernelDim_Hip(Ceed ceed, hipFunction_t kernel, int grid_size, int block_size_x, int block_size_y, int block_size_z,
2451475c7cSJeremy L Thompson                                      void **args);
2530f4f45fSnbeams 
26eb7e6cafSJeremy L Thompson CEED_INTERN int CeedRunKernelDimShared_Hip(Ceed ceed, hipFunction_t kernel, int grid_size, int block_size_x, int block_size_y, int block_size_z,
2751475c7cSJeremy L Thompson                                            int shared_mem_size, void **args);
2830f4f45fSnbeams 
2994b7b29bSJeremy L Thompson #endif  // CEED_HIP_COMPILE_H
30