Skip to content

Commit

Permalink
fix(frontend): remove compat.h
Browse files Browse the repository at this point in the history
  • Loading branch information
aPere3 committed Oct 14, 2024
1 parent fd9db12 commit a9e03e2
Show file tree
Hide file tree
Showing 76 changed files with 2,931 additions and 5,965 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/compiler_build_and_test_cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
shell: bash
run: |
rustup toolchain install nightly-2024-09-30
pip install mypy
set -e
cd /concrete/compilers/concrete-compiler/compiler
rm -rf /build/*
Expand Down Expand Up @@ -137,6 +138,7 @@ jobs:
rustup toolchain install nightly-2024-09-30
cd /concrete/compilers/concrete-compiler/compiler
pip install pytest
pip install mypy
dnf install -y libzstd libzstd-devel
sed "s/pytest/python -m pytest/g" -i Makefile
mkdir -p /tmp/concrete_compiler/gpu_tests/
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/compiler_build_and_test_gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
shell: bash
run: |
rustup toolchain install nightly-2024-09-30
pip install mypy
set -e
cd /concrete/compilers/concrete-compiler/compiler
rm -rf /build/*
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/compiler_macos_build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
brew install ninja ccache
pip3.10 install numpy pybind11==2.8 wheel delocate
pip3.10 install pytest
pip3.10 install mypy
- name: Cache compilation (push)
if: github.event_name == 'push'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/concrete_python_benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
set -e
rustup toolchain install nightly-2024-09-30
pip install mypy
rm -rf /build/*
export PYTHON=${{ format('python{0}', matrix.python-version) }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/concrete_python_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ jobs:
set -e
rustup toolchain install nightly-2024-09-30
pip install mypy
rm -rf /build/*
export PYTHON=${{ format('python{0}', matrix.python-version) }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/concrete_python_release_gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ jobs:
set -e
rustup toolchain install nightly-2024-09-30
pip install mypy
rm -rf /build/*
export PYTHON=${{ format('python{0}', matrix.python-version) }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/concrete_python_tests_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
shell: bash
run: |
rustup toolchain install nightly-2024-09-30
pip install mypy
set -e
rm -rf /build/*
Expand Down
2 changes: 2 additions & 0 deletions compilers/concrete-compiler/compiler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ INSTALL_PREFIX?=$(abspath $(BUILD_DIR))/install
INSTALL_PATH=$(abspath $(INSTALL_PREFIX))/concretecompiler/
MAKEFILE_ROOT_DIR=$(shell pwd)
MINIMAL_TESTS?=OFF
STUBGEN=$(shell $(Python3_EXECUTABLE) -c "import sysconfig; sp = sysconfig.get_paths()['scripts']; print(f\"{sp}/stubgen\")")

KEYSETCACHEDEV=/tmp/KeySetCache
KEYSETCACHECI ?= ../KeySetCache
Expand Down Expand Up @@ -186,6 +187,7 @@ concretecompiler: build-initialized
python-bindings: build-initialized
cmake --build $(BUILD_DIR) --target ConcretelangMLIRPythonModules
cmake --build $(BUILD_DIR) --target ConcretelangPythonModules
PYTHONPATH=${PYTHONPATH}:$(BUILD_DIR)/tools/concretelang/python_packages/concretelang_core LD_PRELOAD=$(BUILD_DIR)/lib/libConcretelangRuntime.so $(STUBGEN) -m mlir._mlir_libs._concretelang._compiler --include-docstrings -o $(BUILD_DIR)/tools/concretelang/python_packages/concretelang_core

clientlib: build-initialized
cmake --build $(BUILD_DIR) --target ConcretelangClientLib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,46 @@ class ClientCircuit {

public:
static Result<ClientCircuit>
create(const Message<concreteprotocol::CircuitInfo> &info,
const ClientKeyset &keyset,
std::shared_ptr<csprng::EncryptionCSPRNG> csprng,
bool useSimulation = false);
createEncrypted(const Message<concreteprotocol::CircuitInfo> &info,
const ClientKeyset &keyset,
std::shared_ptr<csprng::EncryptionCSPRNG> csprng);

static Result<ClientCircuit>
createSimulated(const Message<concreteprotocol::CircuitInfo> &info,
std::shared_ptr<csprng::EncryptionCSPRNG> csprng);

Result<TransportValue> prepareInput(Value arg, size_t pos);

Result<Value> processOutput(TransportValue result, size_t pos);

Result<TransportValue> simulatePrepareInput(Value arg, size_t pos);

Result<Value> simulateProcessOutput(TransportValue result, size_t pos);

std::string getName();

const Message<concreteprotocol::CircuitInfo> &getCircuitInfo();

bool isSimulated();

private:
ClientCircuit() = delete;
ClientCircuit(const Message<concreteprotocol::CircuitInfo> &circuitInfo,
std::vector<InputTransformer> inputTransformers,
std::vector<OutputTransformer> outputTransformers)
std::vector<OutputTransformer> outputTransformers,
bool simulated)
: circuitInfo(circuitInfo), inputTransformers(inputTransformers),
outputTransformers(outputTransformers){};
outputTransformers(outputTransformers), simulated(simulated){};
static Result<ClientCircuit>
create(const Message<concreteprotocol::CircuitInfo> &info,
const ClientKeyset &keyset,
std::shared_ptr<csprng::EncryptionCSPRNG> csprng, bool useSimulation);

private:
Message<concreteprotocol::CircuitInfo> circuitInfo;
std::vector<InputTransformer> inputTransformers;
std::vector<OutputTransformer> outputTransformers;
bool simulated;
};

/// Contains all the context to generate inputs for a server call by the
Expand All @@ -80,10 +95,14 @@ class ClientProgram {
public:
/// Generates a fresh client program with fresh keyset on the first use.
static Result<ClientProgram>
create(const Message<concreteprotocol::ProgramInfo> &info,
const ClientKeyset &keyset,
std::shared_ptr<csprng::EncryptionCSPRNG> csprng,
bool useSimulation = false);
createEncrypted(const Message<concreteprotocol::ProgramInfo> &info,
const ClientKeyset &keyset,
std::shared_ptr<csprng::EncryptionCSPRNG> csprng);

/// Generates a fresh client program with empty keyset for simulation.
static Result<ClientProgram>
createSimulated(const Message<concreteprotocol::ProgramInfo> &info,
std::shared_ptr<csprng::EncryptionCSPRNG> csprng);

/// Returns a reference to the named client circuit if it exists.
Result<ClientCircuit> getClientCircuit(std::string circuitName);
Expand Down
Loading

0 comments on commit a9e03e2

Please sign in to comment.