Skip to content
Merged
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
20 changes: 0 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,6 @@ IF(BUILD_ORT)
ENDIF()
ENDIF()

#----------------------------------------------------------------------------------------------

IF (APPLE)
FIND_LIBRARY(MKL_LIBRARIES NAMES mklml
PATHS ${depsAbs}/mkl/lib)
IF (NOT MKL_LIBRARIES)
MESSAGE(FATAL_ERROR "Could not find MKL for Mac")
ENDIF()
SET(platDeps "${MKL_LIBRARIES}")
ENDIF()

#----------------------------------------------------------------------------------------------

IF(BUILD_TFLITE)
# Find TensorFlow Lite stuff and build our wrapper
Expand Down Expand Up @@ -307,14 +295,6 @@ IF(BUILD_ORT)
FILES_MATCHING PATTERN ${LIB_PATTERN})
ENDIF()

#----------------------------------------------------------------------------------------------

IF (APPLE)
INSTALL(DIRECTORY ${depsAbs}/mkl/lib DESTINATION ${installAbs}/backends/redisai_torch
FILES_MATCHING PATTERN ${LIB_PATTERN})
ENDIF()

#----------------------------------------------------------------------------------------------

IF (NOT ${installAbs} STREQUAL ${CMAKE_SOURCE_DIR}/install-${DEVICE})
INSTALL_SYMLINK(${installAbs} ${CMAKE_SOURCE_DIR}/install-${DEVICE})
Expand Down
43 changes: 28 additions & 15 deletions get_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,16 @@ if [[ $OS == linux ]]; then
else
echo "Only x64 is supported currently"
fi
else
echo "Only Linux OS is supported currently"
elif [[ $OS == macos ]]; then
TF_OS=darwin
TF_BUILD=cpu
TF_ARCH=x86_64
if [[ $WITH_TF == S3 ]]; then
LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow
else
LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow
fi

fi

LIBTF_ARCHIVE=libtensorflow-${TF_BUILD}-${TF_OS}-${TF_ARCH}-${TF_VERSION}.tar.gz
Expand All @@ -163,11 +171,11 @@ if [[ $OS == linux ]]; then
TFLITE_OS="linux"
if [[ $ARCH == x64 ]]; then
TFLITE_ARCH=x86_64
else
echo "Only x64 is supported currently"
fi
else
echo "Only Linux OS is supported currently"
elif [[ $OS == macos ]]; then
TFLITE_OS=darwin
# TFLITE_BUILD=cpu
TFLITE_ARCH=x86_64
fi

LIBTFLITE_ARCHIVE=libtensorflowlite-${TFLITE_OS}-${TFLITE_ARCH}-${TFLITE_VERSION}.tar.gz
Expand All @@ -191,15 +199,17 @@ if [[ $OS == linux ]]; then
else
echo "Only x64 is supported currently"
fi
else
echo "Only Linux OS is supported currently"
LIBTORCH_ARCHIVE=libtorch-cxx11-abi-shared-with-deps-${PT_VERSION}%2B${PT_BUILD}.zip

elif [[ $OS == macos ]]; then
PT_OS=macos
PT_ARCH=x86_64
PT_BUILD=cpu
PT_REPACK=1
LIBTORCH_ARCHIVE=libtorch-macos-${PT_VERSION}.zip
fi

if [[ $GPU != 1 ]]; then
LIBTORCH_ARCHIVE=libtorch-cxx11-abi-shared-with-deps-${PT_VERSION}%2B${PT_BUILD}.zip
else
LIBTORCH_ARCHIVE=libtorch-cxx11-abi-shared-with-deps-${PT_VERSION}%2B${PT_BUILD}.zip
fi

LIBTORCH_URL=https://download.pytorch.org/libtorch/$PT_BUILD/$LIBTORCH_ARCHIVE

if [[ $WITH_PT != 0 ]]; then
Expand All @@ -222,8 +232,11 @@ if [[ $OS == linux ]]; then
else
echo "Only x64 is supported currently"
fi
else
echo "Only Linux OS is supported currently"
elif [[ $OS == macos ]]; then
ORT_OS=osx
ORT_ARCH=x64
ORT_BUILD=""
ORT_URL_BASE=https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION}
fi

ORT_ARCHIVE=onnxruntime-${ORT_OS}-${ORT_ARCH}${ORT_BUILD}-${ORT_VERSION}.tgz
Expand Down
9 changes: 8 additions & 1 deletion opt/redis_valgrind.sup
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,11 @@
...
fun:_dl_catch_exception
...
}
}

{
<ignore_torch_cond_jump>
Memcheck:Cond
...
obj:*/libtorch_cpu.so*
}
7 changes: 5 additions & 2 deletions src/redisai.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,10 +736,11 @@ int RedisAI_ScriptStore_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **ar
ctx, "ERR Insufficient arguments, missing script entry points");
}

array_new_on_stack(const char *, nEntryPoints, entryPoints);
const char **entryPoints = array_new(const char *, nEntryPoints);
for (size_t i = 0; i < nEntryPoints; i++) {
const char *entryPoint;
if (AC_GetString(&ac, &entryPoint, NULL, 0) != AC_OK) {
array_free(entryPoints);
return RedisModule_ReplyWithError(
ctx, "ERR Insufficient arguments, missing script entry points");
}
Expand All @@ -754,6 +755,7 @@ int RedisAI_ScriptStore_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **ar
}

if (scriptdef == NULL) {
array_free(entryPoints);
return RedisModule_ReplyWithError(ctx, "ERR Insufficient arguments, missing script SOURCE");
}

Expand All @@ -767,6 +769,7 @@ int RedisAI_ScriptStore_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **ar
"Backend TORCH not loaded, will try loading default backend");
int ret = RAI_LoadDefaultBackend(ctx, RAI_BACKEND_TORCH);
if (ret == REDISMODULE_ERR) {
array_free(entryPoints);
RedisModule_Log(ctx, "warning", "Could not load TORCH default backend");
int ret = RedisModule_ReplyWithError(ctx, "ERR Could not load backend");
RAI_ClearError(&err);
Expand All @@ -776,7 +779,7 @@ int RedisAI_ScriptStore_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **ar
script =
RAI_ScriptCompile(devicestr, tag, scriptdef, entryPoints, (size_t)nEntryPoints, &err);
}

array_free(entryPoints);
if (err.code != RAI_OK) {
int ret = RedisModule_ReplyWithError(ctx, err.detail_oneline);
RAI_ClearError(&err);
Expand Down