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);

src/execution/run_queue_info.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "queue.h"
1212
#include "dictionaries.h"
1313

14-
AI_dict *RunQueues;
14+
extern AI_dict *RunQueues;
1515

1616
typedef struct RunQueueInfo {
1717
pthread_mutex_t run_queue_mutex;

src/redis_ai_objects/stats.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include "stats.h"
1212
#include "util/string_utils.h"
1313

14+
AI_dict *run_stats = NULL;
15+
1416
long long ustime(void) {
1517
struct timeval tv;
1618
long long ust;

src/redis_ai_objects/stats.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct RedisAI_RunStats {
2525
long long nerrors;
2626
};
2727

28-
AI_dict *run_stats;
28+
extern AI_dict *run_stats;
2929

3030
long long ustime(void);
3131
mstime_t mstime(void);

src/redis_ai_objects/tensor.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "tensor.h"
1515
#include "err.h"
1616
#include "arr.h"
17-
#include "redisai.h"
1817
#include "version.h"
1918
#include "tensor_struct.h"
2019
#include "rmutil/alloc.h"

src/redisai.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#endif
55

66
#define REDISMODULE_MAIN
7+
#define REDISAI_MAIN
78
#include "redismodule.h"
89
#include "redis_ai_objects/tensor.h"
910
#include "execution/command_parser.h"

src/redisai.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
#define REDISAI_LLAPI_VERSION 1
77
#define MODULE_API_FUNC(x) (*x)
88

9-
#ifdef REDISAI_EXTERN
10-
#define REDISAI_API extern
9+
#ifdef REDISAI_MAIN
10+
#define REDISAI_API
1111
#endif
1212

1313
#ifndef REDISAI_API
14-
#define REDISAI_API
14+
#define REDISAI_API extern
1515
#endif
1616

1717
#ifndef REDISAI_H_INCLUDE

0 commit comments

Comments
 (0)