Compile cruntime with fpic (#188)
* Detect llvm-project commit change in utils/clone-mlir.sh and rebuild llvm-project for zLinux Jenkins build bot * Compile libcruntime.a object with -fPIC to avoid segfault when embedded into model.so * Enable unit tests on zLinux Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com> Co-authored-by: Tian Jin <tjingrant@gmail.com>
This commit is contained in:
parent
e902506ee5
commit
cf96d635cc
|
@ -69,6 +69,7 @@ LLVM_PROJ_SRC=${LLVM_PROJECT_ROOT} \
|
||||||
LLVM_PROJ_BUILD=${LLVM_PROJECT_ROOT}/build \
|
LLVM_PROJ_BUILD=${LLVM_PROJECT_ROOT}/build \
|
||||||
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} .. \
|
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} .. \
|
||||||
|
|
||||||
make -j$(nproc) onnx-mlir
|
make -j$(nproc)
|
||||||
make -j$(nproc) check-onnx-lit
|
make -j$(nproc) check-onnx-lit
|
||||||
RUNTIME_DIR=$(pwd)/lib make -j$(nproc) check-onnx-backend
|
RUNTIME_DIR=$(pwd)/lib make -j$(nproc) check-onnx-backend
|
||||||
|
RUNTIME_DIR=$(pwd)/lib PATH=$(pwd)/bin:$PATH make -j$(nproc) test
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
# Create shared libcruntime.so since model.so linkage for backend tests
|
# Create static libcruntime.a to be embedded in model.so to make model.so self contained.
|
||||||
# will fail on x86 Linux if cruntime is statically linked.
|
# However, by default object code for static library is not compiled with -fPIC. Embedding
|
||||||
|
# such static library in a shared library can cause runtime failure on some architectures,
|
||||||
|
# such as z. So we override the default and explicitly compile with -fPIC.
|
||||||
add_library(cruntime STATIC
|
add_library(cruntime STATIC
|
||||||
RtMemRef.cpp
|
RtMemRef.cpp
|
||||||
RtMemRef.h
|
RtMemRef.h
|
||||||
DataType.h)
|
DataType.h)
|
||||||
|
set_target_properties(cruntime PROPERTIES
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE)
|
||||||
|
|
||||||
add_library(RtMemRefUtils
|
add_library(RtMemRefUtils
|
||||||
RtMemRef.h
|
RtMemRef.h
|
||||||
|
@ -35,6 +39,7 @@ target_include_directories(PyRuntime PRIVATE
|
||||||
${ONNX_MLIR_BIN_ROOT}
|
${ONNX_MLIR_BIN_ROOT}
|
||||||
${ONNX_MLIR_SRC_ROOT})
|
${ONNX_MLIR_SRC_ROOT})
|
||||||
|
|
||||||
|
# See comments above about libcruntime.a
|
||||||
add_library(EmbeddedDataLoader STATIC
|
add_library(EmbeddedDataLoader STATIC
|
||||||
GetEmbeddedConstPool.h
|
GetEmbeddedConstPool.h
|
||||||
GetEmbeddedConstPool.cpp)
|
GetEmbeddedConstPool.cpp)
|
||||||
|
|
Loading…
Reference in New Issue