xref: /libCEED/backends/hip/ceed-hip-compile.h (revision 2459f3f1cd4d7d2e210e1c26d669bd2fde41a0b6)
1 // Copyright (c) 2017-2022, 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 #ifndef _ceed_hip_compile_h
9 #define _ceed_hip_compile_h
10 
11 #include <ceed/ceed.h>
12 #include <hip/hip_runtime.h>
13 
14 static inline CeedInt CeedDivUpInt(CeedInt numerator, CeedInt denominator) {
15   return (numerator + denominator - 1) / denominator;
16 }
17 
18 CEED_INTERN int CeedCompileHip(Ceed ceed, const char *source,
19                                hipModule_t *module, const CeedInt numopts, ...);
20 
21 CEED_INTERN int CeedGetKernelHip(Ceed ceed, hipModule_t module,
22                                  const char *name, hipFunction_t *kernel);
23 
24 CEED_INTERN int CeedRunKernelHip(Ceed ceed, hipFunction_t kernel,
25                                  const int grid_size,
26                                  const int block_size, void **args);
27 
28 CEED_INTERN int CeedRunKernelDimHip(Ceed ceed, hipFunction_t kernel,
29                                     const int grid_size,
30                                     const int block_size_x, const int block_size_y,
31                                     const int block_size_z, void **args);
32 
33 CEED_INTERN int CeedRunKernelDimSharedHip(Ceed ceed, hipFunction_t kernel,
34     const int grid_size, const int block_size_x, const int block_size_y,
35     const int block_size_z, const int shared_mem_size, void **args);
36 
37 #endif // _ceed_hip_compile_h
38