Skip to content

remove duplicate symbols for real gcc10 compatibility #825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/backends/backends.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "execution/background_workers.h"
#include "execution/execution_contexts/modelRun_ctx.h"

RAI_LoadedBackends RAI_backends = {0};

static bool _ValidateFuncExists(RedisModuleCtx *ctx, void *func_ptr, const char *func_name,
const char *backend_name, const char *path) {
if (func_ptr == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion src/backends/backends.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ typedef struct RAI_LoadedBackends {
RAI_LoadedBackend onnx;
} RAI_LoadedBackends;

RAI_LoadedBackends RAI_backends;
extern RAI_LoadedBackends RAI_backends;

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

Expand Down
6 changes: 3 additions & 3 deletions src/backends/backends_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#include <stdint.h>
#include "redismodule.h"

#ifdef BACKENDS_API_EXTERN
#define BACKENDS_API extern
#ifdef BACKENDS_API_MAIN
#define BACKENDS_API
#endif

#ifndef BACKENDS_API
#define BACKENDS_API
#define BACKENDS_API extern
#endif

typedef struct RAI_Tensor RAI_Tensor;
Expand Down
2 changes: 2 additions & 0 deletions src/backends/onnx_timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "redis_ai_objects/stats.h"
#include "backends_api.h"

OnnxGlobalRunSessions *onnx_global_run_sessions = NULL;

int RAI_InitGlobalRunSessionsORT() {
onnx_global_run_sessions = RedisModule_Alloc(sizeof(OnnxGlobalRunSessions));

Expand Down
2 changes: 1 addition & 1 deletion src/backends/onnx_timeout.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef struct OnnxGlobalRunSessions {
pthread_rwlock_t rwlock;
} OnnxGlobalRunSessions;

OnnxGlobalRunSessions *onnx_global_run_sessions;
extern OnnxGlobalRunSessions *onnx_global_run_sessions;

/**
* @brief This is called whenever Onnx backend is loaded. It creates the global
Expand Down
1 change: 1 addition & 0 deletions src/backends/onnxruntime.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#define REDISMODULE_MAIN
#define BACKENDS_API_MAIN
#include <cuda_provider_factory.h>
#include "backends/util.h"
#include <stdatomic.h>
Expand Down
4 changes: 4 additions & 0 deletions src/backends/tflite.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#define REDISMODULE_MAIN
#define BACKENDS_API_MAIN
#include "backends/util.h"
#include "backends/tflite.h"
#include "util/arr.h"
#include "libtflite_c/tflite_c.h"
#include "redis_ai_objects/tensor.h"


RAI_LoadedBackends RAI_backends = {0};

int RAI_InitBackendTFLite(int (*get_api_fn)(const char *, void *)) {
get_api_fn("RedisModule_Alloc", ((void **)&RedisModule_Alloc));
get_api_fn("RedisModule_Calloc", ((void **)&RedisModule_Calloc));
Expand Down
1 change: 0 additions & 1 deletion src/execution/DAG/dag.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <sys/time.h>
#include <unistd.h>

#include "redisai.h"
#include "rmutil/args.h"
#include "rmutil/alloc.h"
#include "util/arr.h"
Expand Down
2 changes: 2 additions & 0 deletions src/execution/run_queue_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "backends/backends.h"
#include "background_workers.h"

AI_dict *RunQueues = NULL;

RunQueueInfo *RunQueue_Create(const char *device_str) {

size_t device_str_len = strlen(device_str);
Expand Down
2 changes: 1 addition & 1 deletion src/execution/run_queue_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "queue.h"
#include "dictionaries.h"

AI_dict *RunQueues;
extern AI_dict *RunQueues;

typedef struct RunQueueInfo {
pthread_mutex_t run_queue_mutex;
Expand Down
2 changes: 2 additions & 0 deletions src/redis_ai_objects/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "stats.h"
#include "util/string_utils.h"

AI_dict *run_stats = NULL;

long long ustime(void) {
struct timeval tv;
long long ust;
Expand Down
2 changes: 1 addition & 1 deletion src/redis_ai_objects/stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct RedisAI_RunStats {
long long nerrors;
};

AI_dict *run_stats;
extern AI_dict *run_stats;

long long ustime(void);
mstime_t mstime(void);
Expand Down
1 change: 0 additions & 1 deletion src/redis_ai_objects/tensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "tensor.h"
#include "err.h"
#include "arr.h"
#include "redisai.h"
#include "version.h"
#include "tensor_struct.h"
#include "rmutil/alloc.h"
Expand Down
1 change: 1 addition & 0 deletions src/redisai.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#endif

#define REDISMODULE_MAIN
#define REDISAI_MAIN
#include "redismodule.h"
#include "redis_ai_objects/tensor.h"
#include "execution/command_parser.h"
Expand Down
6 changes: 3 additions & 3 deletions src/redisai.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#define REDISAI_LLAPI_VERSION 1
#define MODULE_API_FUNC(x) (*x)

#ifdef REDISAI_EXTERN
#define REDISAI_API extern
#ifdef REDISAI_MAIN
#define REDISAI_API
#endif

#ifndef REDISAI_API
#define REDISAI_API
#define REDISAI_API extern
#endif

#ifndef REDISAI_H_INCLUDE
Expand Down