Skip to content

Commit d559588

Browse files
authored
Merge branch 'master' into Enable_non_blocking_DAG_run
2 parents 36fa926 + 17772de commit d559588

File tree

15 files changed

+489
-605
lines changed

15 files changed

+489
-605
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ ENDIF()
2424
#----------------------------------------------------------------------------------------------
2525

2626
SET(CMAKE_CC_COMMON_FLAGS "-fPIC")
27+
IF (USE_PROFILE)
28+
SET(CMAKE_CC_COMMON_FLAGS "${CMAKE_CC_COMMON_FLAGS} -g -ggdb -fno-omit-frame-pointer")
29+
ENDIF()
2730

2831
IF (USE_COVERAGE)
2932
IF (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")

opt/Makefile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ make fetch # download and prepare dependant artifacts
3333
make build # compile and link
3434
DEBUG=1 # build for debugging
3535
COV=1 # build for coverage analysis (implies DEBUG=1)
36+
PROFILE=1 # enable profiling compile flags (and debug symbols) for release type.
37+
# You can consider this as build type release with debug symbols and -fno-omit-frame-pointer
3638
VARIANT=name # build variant `name`
3739
WHY=1 # explain CMake decisions (into /tmp/cmake.why)
3840
make clean # remove build artifacts
@@ -63,10 +65,11 @@ make docker # build docker image
6365
make docker-gpu-test # run GPU tests
6466

6567
fetch and build options:
66-
WITH_TF=0 # SKip TensofFlow
67-
WITH_TFLITE=0 # SKip TensofFlowLite
68-
WITH_PT=0 # Skip PyTorch
69-
WITH_ORT=0 # SKip ONNXRuntime
68+
WITH_TF=0 # SKip TensofFlow
69+
WITH_TFLITE=0 # SKip TensofFlowLite
70+
WITH_PT=0 # Skip PyTorch
71+
WITH_ORT=0 # SKip ONNXRuntime
72+
WITH_UNIT_TESTS=0 # SKip unit tests
7073

7174
device selection options (fetch, build, and test):
7275
CPU=1 # build for CPU
@@ -115,10 +118,17 @@ else
115118
USE_COVERAGE=off
116119
endif
117120

121+
ifeq ($(PROFILE),1)
122+
USE_PROFILE=on
123+
else
124+
USE_PROFILE=off
125+
endif
126+
118127
CMAKE_FLAGS += \
119128
-DDEPS_PATH=$(abspath $(DEPS_DIR)) \
120129
-DINSTALL_PATH=$(abspath $(INSTALL_DIR)) \
121130
-DUSE_COVERAGE=$(USE_COVERAGE) \
131+
-DUSE_PROFILE=$(USE_PROFILE) \
122132
-DREDISAI_GIT_SHA=\"$(GIT_SHA)\" \
123133
-DDEVICE=$(DEVICE)
124134

@@ -138,6 +148,10 @@ ifeq ($(WITH_ORT),0)
138148
CMAKE_FLAGS += -DBUILD_ORT=off
139149
endif
140150

151+
ifeq ($(WITH_UNIT_TESTS),0)
152+
CMAKE_FLAGS += -DPACKAGE_UNIT_TESTS=off
153+
endif
154+
141155
include $(MK)/defs
142156

143157
#----------------------------------------------------------------------------------------------

src/backends/onnxruntime.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define REDISMODULE_MAIN
12
#include <cuda_provider_factory.h>
23
#include "backends/onnxruntime.h"
34
#include "backends/util.h"

src/backends/tensorflow.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define REDISMODULE_MAIN
12
#include "backends/tensorflow.h"
23
#include "backends/util.h"
34
#include "tensor.h"

src/backends/tflite.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define REDISMODULE_MAIN
12
#include "backends/tflite.h"
23
#include "backends/util.h"
34
#include "tensor.h"

src/backends/torch.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define REDISMODULE_MAIN
12
#include "backends/torch.h"
23
#include "backends/util.h"
34
#include "tensor.h"

src/background_workers.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
*
1010
*/
1111

12-
#if defined(__linux__)
13-
#define _GNU_SOURCE
14-
#endif
15-
1612
#ifndef SRC_BACKGROUND_WORKERS_H_
1713
#define SRC_BACKGROUND_WORKERS_H_
1814

15+
#if defined(__linux__) && !defined(_GNU_SOURCE)
16+
#define _GNU_SOURCE
17+
#endif
18+
1919
#include <pthread.h>
2020

2121
#include "config.h"

src/redisai.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define REDISMODULE_MAIN
12
#include "redismodule.h"
23
#include "tensor.h"
34

src/redisai.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,22 @@ RedisModuleType *MODULE_API_FUNC(RedisAI_ScriptRedisType)(void);
118118

119119
int MODULE_API_FUNC(RedisAI_GetLLAPIVersion)();
120120

121+
#ifndef __cplusplus
121122
#define REDISAI_MODULE_INIT_FUNCTION(ctx, name) \
122123
RedisAI_##name = RedisModule_GetSharedAPI(ctx, "RedisAI_" #name); \
123124
if (!RedisAI_##name) { \
124125
RedisModule_Log(ctx, "warning", "could not initialize RedisAI_" #name "\r\n"); \
125126
return REDISMODULE_ERR; \
126127
}
128+
#else
129+
#define REDISAI_MODULE_INIT_FUNCTION(ctx, name) \
130+
RedisAI_##name = reinterpret_cast<decltype(RedisAI_##name)>( \
131+
RedisModule_GetSharedAPI((RedisModuleCtx *)(ctx), "RedisAI_" #name)); \
132+
if (!RedisAI_##name) { \
133+
RedisModule_Log(ctx, "warning", "could not initialize RedisAI_" #name "\r\n"); \
134+
return REDISMODULE_ERR; \
135+
}
136+
#endif
127137

128138
static int RedisAI_Initialize(RedisModuleCtx *ctx) {
129139

0 commit comments

Comments
 (0)