Skip to content

Commit aadc5e9

Browse files
committed
handing over to Rafi
1 parent ff9482b commit aadc5e9

File tree

16 files changed

+25
-13
lines changed

16 files changed

+25
-13
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ENDIF()
2323

2424
#----------------------------------------------------------------------------------------------
2525

26-
SET(CMAKE_CC_COMMON_FLAGS "-fPIC -fcommon")
26+
SET(CMAKE_CC_COMMON_FLAGS "-fPIC")
2727
IF (USE_PROFILE)
2828
SET(CMAKE_CC_COMMON_FLAGS "${CMAKE_CC_COMMON_FLAGS} -g -ggdb -fno-omit-frame-pointer")
2929
ENDIF()

src/backends/backends.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "execution/background_workers.h"
2020
#include "execution/execution_contexts/modelRun_ctx.h"
2121

22+
RAI_LoadedBackends RAI_backends = {0};
23+
2224
static bool _ValidateFuncExists(RedisModuleCtx *ctx, void *func_ptr, const char *func_name,
2325
const char *backend_name, const char *path) {
2426
if (func_ptr == NULL) {

src/backends/backends.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ typedef struct RAI_LoadedBackends {
100100
RAI_LoadedBackend onnx;
101101
} RAI_LoadedBackends;
102102

103-
RAI_LoadedBackends RAI_backends;
103+
extern RAI_LoadedBackends RAI_backends;
104104

105105
int RAI_LoadBackend(RedisModuleCtx *ctx, int backend, const char *path);
106106

src/backends/backends_api.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
#include <stdint.h>
44
#include "redismodule.h"
55

6-
#ifdef BACKENDS_API_EXTERN
7-
#define BACKENDS_API extern
6+
#ifdef BACKENDS_API_MAIN
7+
#define BACKENDS_API
88
#endif
99

1010
#ifndef BACKENDS_API
11-
#define BACKENDS_API
11+
#define BACKENDS_API extern
1212
#endif
1313

1414
typedef struct RAI_Tensor RAI_Tensor;

src/backends/onnx_timeout.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include "redis_ai_objects/stats.h"
88
#include "backends_api.h"
99

10+
OnnxGlobalRunSessions *onnx_global_run_sessions = NULL;
11+
1012
int RAI_InitGlobalRunSessionsORT() {
1113
onnx_global_run_sessions = RedisModule_Alloc(sizeof(OnnxGlobalRunSessions));
1214

src/backends/onnx_timeout.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ typedef struct OnnxGlobalRunSessions {
3535
pthread_rwlock_t rwlock;
3636
} OnnxGlobalRunSessions;
3737

38-
OnnxGlobalRunSessions *onnx_global_run_sessions;
38+
extern OnnxGlobalRunSessions *onnx_global_run_sessions;
3939

4040
/**
4141
* @brief This is called whenever Onnx backend is loaded. It creates the global

src/backends/onnxruntime.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#define REDISMODULE_MAIN
2+
#define BACKENDS_API_MAIN
23
#include <cuda_provider_factory.h>
34
#include "backends/util.h"
45
#include <stdatomic.h>

src/backends/tflite.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
#define REDISMODULE_MAIN
2+
#define BACKENDS_API_MAIN
23
#include "backends/util.h"
34
#include "backends/tflite.h"
45
#include "util/arr.h"
56
#include "libtflite_c/tflite_c.h"
67
#include "redis_ai_objects/tensor.h"
78

9+
10+
RAI_LoadedBackends RAI_backends = {0};
11+
812
int RAI_InitBackendTFLite(int (*get_api_fn)(const char *, void *)) {
913
get_api_fn("RedisModule_Alloc", ((void **)&RedisModule_Alloc));
1014
get_api_fn("RedisModule_Calloc", ((void **)&RedisModule_Calloc));

src/execution/DAG/dag.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include <sys/time.h>
3333
#include <unistd.h>
3434

35-
#include "redisai.h"
3635
#include "rmutil/args.h"
3736
#include "rmutil/alloc.h"
3837
#include "util/arr.h"

src/execution/run_queue_info.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include "backends/backends.h"
44
#include "background_workers.h"
55

6+
AI_dict *RunQueues = NULL;
7+
68
RunQueueInfo *RunQueue_Create(const char *device_str) {
79

810
size_t device_str_len = strlen(device_str);

0 commit comments

Comments
 (0)