|
10 | 10 | #include <ceed.h> |
11 | 11 | #include <ceed/backend.h> |
12 | 12 | #include <ceed/jit-tools.h> |
| 13 | +#include <ceed/jit-source/hip/hip-chipstar.h> |
13 | 14 | #include <stdarg.h> |
14 | 15 | #include <string.h> |
15 | 16 | #include <hip/hiprtc.h> |
@@ -37,7 +38,6 @@ static int CeedCompileCore_Hip(Ceed ceed, const char *source, const bool throw_e |
37 | 38 | const CeedInt num_defines, va_list args) { |
38 | 39 | size_t ptx_size; |
39 | 40 | char *ptx; |
40 | | - const int num_opts = 4; |
41 | 41 | CeedInt num_jit_source_dirs = 0, num_jit_defines = 0; |
42 | 42 | const char **opts; |
43 | 43 | int runtime_version; |
@@ -78,13 +78,24 @@ static int CeedCompileCore_Hip(Ceed ceed, const char *source, const bool throw_e |
78 | 78 |
|
79 | 79 | // Non-macro options |
80 | 80 | CeedCallBackend(CeedCalloc(num_opts, &opts)); |
| 81 | +#if CEED_HIP_USE_CHIPSTAR |
| 82 | + const int num_opts = 1; |
| 83 | + |
| 84 | + opts[0] = "-DCEED_RUNNING_JIT_PASS=1"; |
| 85 | +#else |
| 86 | + const int num_opts = 4; |
| 87 | + |
81 | 88 | opts[0] = "-default-device"; |
82 | | - CeedCallBackend(CeedGetData(ceed, (void **)&ceed_data)); |
83 | | - CeedCallHip(ceed, hipGetDeviceProperties(&prop, ceed_data->device_id)); |
84 | | - std::string arch_arg = "--gpu-architecture=" + std::string(prop.gcnArchName); |
85 | | - opts[1] = arch_arg.c_str(); |
86 | | - opts[2] = "-munsafe-fp-atomics"; |
87 | | - opts[3] = "-DCEED_RUNNING_JIT_PASS=1"; |
| 89 | + { |
| 90 | + CeedCallBackend(CeedGetData(ceed, (void **)&ceed_data)); |
| 91 | + CeedCallHip(ceed, hipGetDeviceProperties(&prop, ceed_data->device_id)); |
| 92 | + std::string arch_arg = "--gpu-architecture=" + std::string(prop.gcnArchName); |
| 93 | + |
| 94 | + opts[1] = arch_arg.c_str(); |
| 95 | + } |
| 96 | + opts[2] = "-munsafe-fp-atomics"; |
| 97 | + opts[3] = "-DCEED_RUNNING_JIT_PASS=1"; |
| 98 | +#endif |
88 | 99 | // Additional include dirs |
89 | 100 | { |
90 | 101 | const char **jit_source_dirs; |
|
0 commit comments