feat(optimizer): update to use the new cpp brige

This commit is contained in:
rudy
2022-05-04 15:49:22 +02:00
committed by rudy-6-4
parent 5f1a539505
commit 6f02d1248d
5 changed files with 17 additions and 22 deletions

1
compiler/.gitignore vendored
View File

@@ -1,3 +1,4 @@
.dependencies/
build/
*.mlir.script
*.lit_test_times.txt

View File

@@ -117,14 +117,6 @@ endif()
option(CONCRETELANG_UNIT_TESTS "Enables the build of unittests" ON)
#-------------------------------------------------------------------------------
# Adding rust dependencies, already compiled
#-------------------------------------------------------------------------------
link_directories(${CONCRETE_OPTIMIZER_DIR}/target)
include_directories(${CONCRETE_OPTIMIZER_DIR}/target/include)
#-------------------------------------------------------------------------------
# Handling sub dirs
#-------------------------------------------------------------------------------
@@ -133,3 +125,5 @@ add_subdirectory(include)
add_subdirectory(lib)
add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(${CONCRETE_OPTIMIZER_DIR}/concrete-optimizer-cpp/cmake-utils)

View File

@@ -5,7 +5,7 @@ PARALLEL_EXECUTION_ENABLED=OFF
CC_COMPILER=
CXX_COMPILER=
CONCRETE_OPTIMIZER_DIR ?= .dependencies/concrete-optimizer
CONCRETE_OPTIMIZER_DIR ?= $(shell pwd)/.dependencies/concrete-optimizer
CONCRETE_OPTIMIZER_BRANCH ?= master
KEYSETCACHEDEV=/tmp/KeySetCache
@@ -68,21 +68,20 @@ $(BUILD_DIR)/configured.stamp:
build-initialized: concrete-optimizer-lib $(BUILD_DIR)/configured.stamp
CONCRETE_OPTIMIZER_SRC = $(shell find $(CONCRETE_OPTIMIZER_DIR)/* -not -path '$(CONCRETE_OPTIMIZER_DIR)/target*')
LIB_CONCRETE_OPTIMIZER_CPP = $(CONCRETE_OPTIMIZER_DIR)/target/libconcrete_optimizer_cpp.a
# Fetch concrete-optimizer
$(CONCRETE_OPTIMIZER_DIR):
export GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=accept-new" # for CI
# change to master on merge
mkdir -p $(shell dirname ${CONCRETE_OPTIMIZER_DIR})
git clone --branch $(CONCRETE_OPTIMIZER_BRANCH) git@github.com:zama-ai/concrete-optimizer.git $@
CONCRETE_OPTIMIZER_SRC := $(shell find $(CONCRETE_OPTIMIZER_DIR) -not -path '$(CONCRETE_OPTIMIZER_DIR)/target*')
# we need CONCRETE_OPTIMIZER_DIR here to ensure it is present before computing CONCRETE_OPTIMIZER_SRC
$(LIB_CONCRETE_OPTIMIZER_CPP): $(CONCRETE_OPTIMIZER_DIR) $(CONCRETE_OPTIMIZER_SRC)
make -C $(CONCRETE_OPTIMIZER_DIR)/concrete-optimizer-cpp $@
# Build concrete-optimizer
$(CONCRETE_OPTIMIZER_DIR)/target/libconcrete_optimizer.a: $(CONCRETE_OPTIMIZER_DIR) $(CONCRETE_OPTIMIZER_SRC)
cd $(CONCRETE_OPTIMIZER_DIR)/concrete-optimizer && cargo build --release
cp $(CONCRETE_OPTIMIZER_DIR)/target/release/$(shell basename $@) $@
concrete-optimizer-lib: $(CONCRETE_OPTIMIZER_DIR)/target/libconcrete_optimizer.a
concrete-optimizer-lib: $(LIB_CONCRETE_OPTIMIZER_CPP)
doc: build-initialized
cmake --build $(BUILD_DIR) --target mlir-doc
@@ -294,4 +293,5 @@ python_lint:
generate_conv_op \
python_lint \
python_format \
check_python_format
check_python_format \
concrete-optimizer-lib

View File

@@ -1,6 +1,5 @@
link_directories(${CONCRETE_OPTIMIZER_DIR}/target)
include_directories(${CONCRETE_OPTIMIZER_DIR}/target/include)
link_libraries(concrete_optimizer.a)
# not working in ADDITIONAL_HEADER_DIRS
include_directories(${CONCRETE_OPTIMIZER_DIR}/concrete-optimizer-cpp/src/cpp)
add_mlir_library(ConcretelangSupport
Pipeline.cpp
@@ -30,6 +29,7 @@ add_mlir_library(ConcretelangSupport
FHEDialectAnalysis
RTDialectAnalysis
ConcretelangTransforms
concrete_optimizer
MLIRExecutionEngine
${LLVM_PTHREAD_LIB}

View File

@@ -15,7 +15,7 @@
#include "llvm/Support/raw_ostream.h"
#include "concrete-optimizer.h"
#include "concrete-optimizer.hpp"
#include "concretelang/Support/V0Parameters.h"
namespace mlir {