Skip to content

Commit

Permalink
cuda/hip - include *-jit.h via #include
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylt committed Oct 16, 2024
1 parent 4aeb1d9 commit a5f8e53
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
13 changes: 1 addition & 12 deletions backends/cuda/ceed-cuda-compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
int CeedCompile_Cuda(Ceed ceed, const char *source, CUmodule *module, const CeedInt num_defines, ...) {
size_t ptx_size;
char *ptx;
const char *jit_defs_path, *jit_defs_source;
const int num_opts = 4;
CeedInt num_jit_source_dirs = 0;
const char **opts;
Expand Down Expand Up @@ -65,17 +64,7 @@ int CeedCompile_Cuda(Ceed ceed, const char *source, CUmodule *module, const Ceed
}

// Standard libCEED definitions for CUDA backends
CeedCallBackend(CeedGetJitAbsolutePath(ceed, "ceed/jit-source/cuda/cuda-jit.h", &jit_defs_path));
{
char *source;

CeedCallBackend(CeedLoadSourceToBuffer(ceed, jit_defs_path, &source));
jit_defs_source = source;
}
code << jit_defs_source;
code << "\n\n";
CeedCallBackend(CeedFree(&jit_defs_path));
CeedCallBackend(CeedFree(&jit_defs_source));
code << "#include <ceed/jit-source/cuda/cuda-jit.h>\n\n";

// Non-macro options
CeedCallBackend(CeedCalloc(num_opts, &opts));
Expand Down
10 changes: 2 additions & 8 deletions backends/hip/ceed-hip-compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
//------------------------------------------------------------------------------
int CeedCompile_Hip(Ceed ceed, const char *source, hipModule_t *module, const CeedInt num_defines, ...) {
size_t ptx_size;
char *jit_defs_source, *ptx;
const char *jit_defs_path;
char *ptx;
const int num_opts = 4;
CeedInt num_jit_source_dirs = 0;
const char **opts;
Expand Down Expand Up @@ -77,12 +76,7 @@ int CeedCompile_Hip(Ceed ceed, const char *source, hipModule_t *module, const Ce
}

// Standard libCEED definitions for HIP backends
CeedCallBackend(CeedGetJitAbsolutePath(ceed, "ceed/jit-source/hip/hip-jit.h", &jit_defs_path));
CeedCallBackend(CeedLoadSourceToBuffer(ceed, jit_defs_path, &jit_defs_source));
code << jit_defs_source;
code << "\n\n";
CeedCallBackend(CeedFree(&jit_defs_path));
CeedCallBackend(CeedFree(&jit_defs_source));
code << "#include <ceed/jit-source/hip/hip-jit.h>\n\n";

// Non-macro options
CeedCallBackend(CeedCalloc(num_opts, &opts));
Expand Down

0 comments on commit a5f8e53

Please sign in to comment.