Skip to content

Commit

Permalink
jit - redirect ceed.h to ceed/types.h over ceed/ceed.h for jit
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylt committed Oct 16, 2024
1 parent ae8472b commit 4aeb1d9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion backends/cuda/ceed-cuda-compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int CeedCompile_Cuda(Ceed ceed, const char *source, CUmodule *module, const Ceed
size_t ptx_size;
char *ptx;
const char *jit_defs_path, *jit_defs_source;
const int num_opts = 3;
const int num_opts = 4;
CeedInt num_jit_source_dirs = 0;
const char **opts;
nvrtcProgram prog;
Expand Down Expand Up @@ -95,6 +95,7 @@ int CeedCompile_Cuda(Ceed ceed, const char *source, CUmodule *module, const Ceed
+ std::to_string(prop.major) + std::to_string(prop.minor);
opts[1] = arch_arg.c_str();
opts[2] = "-Dint32_t=int";
opts[3] = "-DCEED_RUNNING_JIT_PASS=1";
{
const char **jit_source_dirs;

Expand Down
3 changes: 2 additions & 1 deletion backends/hip/ceed-hip-compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int CeedCompile_Hip(Ceed ceed, const char *source, hipModule_t *module, const Ce
size_t ptx_size;
char *jit_defs_source, *ptx;
const char *jit_defs_path;
const int num_opts = 3;
const int num_opts = 4;
CeedInt num_jit_source_dirs = 0;
const char **opts;
int runtime_version;
Expand Down Expand Up @@ -92,6 +92,7 @@ int CeedCompile_Hip(Ceed ceed, const char *source, hipModule_t *module, const Ce
std::string arch_arg = "--gpu-architecture=" + std::string(prop.gcnArchName);
opts[1] = arch_arg.c_str();
opts[2] = "-munsafe-fp-atomics";
opts[3] = "-DCEED_RUNNING_JIT_PASS=1";
{
const char **jit_source_dirs;

Expand Down
4 changes: 4 additions & 0 deletions include/ceed.h
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
#ifdef CEED_RUNNING_JIT_PASS
#include "ceed/types.h"
#else
#include "ceed/ceed.h"
#endif
2 changes: 2 additions & 0 deletions include/ceed/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
#ifndef CEED_QFUNCTION_DEFS_H
#define CEED_QFUNCTION_DEFS_H

#ifndef CEED_RUNNING_JIT_PASS
#include <stddef.h>
#include <stdint.h>
#endif

/**
@ingroup CeedQFunction
Expand Down
4 changes: 2 additions & 2 deletions tests/test-include/fake-sys-include.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

// Note - files included this way cannot transitively include any files CUDA/ROCm won't compile
// These are bad
// #include <ceed.h>
// #include <math.h>
// #include <stddef.h>

// This is ok
// These are ok
#include <ceed.h>
#include <ceed/types.h>

0 comments on commit 4aeb1d9

Please sign in to comment.