mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-18 16:34:43 -05:00
This commit: + Adds support for a protocol which enables inter-op between concrete, tfhe-rs and potentially other contributors to the fhe ecosystem. + Gets rid of hand-made serialization in the compiler, and client/server libs. + Refactors client/server libs to allow more pre/post processing of circuit inputs/outputs. The protocol is supported by a definition in the shape of a capnp file, which defines different types of objects among which: + ProgramInfo object, which is a precise description of a set of fhe circuit coming from the same compilation (understand function type information), and the associated key set. + *Key objects, which represent secret/public keys used to encrypt/execute fhe circuits. + Value object, which represent values that can be transferred between client and server to support calls to fhe circuits. The hand-rolled serialization that was previously used is completely dropped in favor of capnp in the whole codebase. The client/server libs, are refactored to introduce a modular design for pre-post processing. Reading the ProgramInfo file associated with a compilation, the client and server libs assemble a pipeline of transformers (functions) for pre and post processing of values coming in and out of a circuit. This design properly decouples various aspects of the processing, and allows these capabilities to be safely extended. In practice this commit includes the following: + Defines the specification in a concreteprotocol package + Integrate the compilation of this package as a compiler dependency via cmake + Modify the compiler to use the Encodings objects defined in the protocol + Modify the compiler to emit ProgramInfo files as compilation artifact, and gets rid of the bloated ClientParameters. + Introduces a new Common library containing the functionalities shared between the compiler and the client/server libs. + Introduces a functional pre-post processing pipeline to this common library + Modify the client/server libs to support loading ProgramInfo objects, and calling circuits using Value messages. + Drops support of JIT. + Drops support of C-api. + Drops support of Rust bindings. Co-authored-by: Nikita Frolov <nf@mkmks.org>
152 lines
5.3 KiB
YAML
152 lines
5.3 KiB
YAML
name: Compiler - Build and Test (CPU)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
instance_id:
|
|
description: 'Instance ID'
|
|
type: string
|
|
instance_image_id:
|
|
description: 'Instance AMI ID'
|
|
type: string
|
|
instance_type:
|
|
description: 'Instance product type'
|
|
type: string
|
|
runner_name:
|
|
description: 'Action runner name'
|
|
type: string
|
|
request_id:
|
|
description: 'Slab request ID'
|
|
type: string
|
|
matrix_item:
|
|
description: 'Build matrix item'
|
|
type: string
|
|
|
|
# concurrency:
|
|
# group: compiler_build_and_test_cpu-${{ github.ref }}
|
|
# cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
|
|
env:
|
|
DOCKER_IMAGE_TEST: ghcr.io/zama-ai/concrete-compiler
|
|
GLIB_VER: 2_28
|
|
|
|
jobs:
|
|
BuildAndTest:
|
|
name: Build and test compiler in EC2
|
|
runs-on: ${{ github.event.inputs.runner_name }}
|
|
if: ${{ !cancelled() }}
|
|
steps:
|
|
- name: Instance configuration used
|
|
run: |
|
|
echo "IDs: ${{ inputs.instance_id }}"
|
|
echo "AMI: ${{ inputs.instance_image_id }}"
|
|
echo "Type: ${{ inputs.instance_type }}"
|
|
echo "Request ID: ${{ inputs.request_id }}"
|
|
echo "Matrix item: ${{ inputs.matrix_item }}"
|
|
|
|
# A SSH private key is required as some dependencies are from private repos
|
|
- name: Set up SSH agent
|
|
uses: webfactory/ssh-agent@v0.7.0
|
|
with:
|
|
ssh-private-key: ${{ secrets.CONCRETE_CI_SSH_PRIVATE }}
|
|
|
|
- name: Set up env
|
|
run: |
|
|
echo "HOME=/home/ubuntu" >> "${GITHUB_ENV}"
|
|
#echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK)" >> "${GITHUB_ENV}"
|
|
echo "SSH_AUTH_SOCK_DIR=$(dirname $SSH_AUTH_SOCK)" >> "${GITHUB_ENV}"
|
|
|
|
- name: Fetch repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
|
|
|
|
- name: Create build dir
|
|
run: mkdir build
|
|
|
|
- name: Build compiler
|
|
uses: addnab/docker-run-action@v3
|
|
id: build-compiler
|
|
with:
|
|
registry: ghcr.io
|
|
image: ${{ env.DOCKER_IMAGE_TEST }}
|
|
username: ${{ secrets.GHCR_LOGIN }}
|
|
password: ${{ secrets.GHCR_PASSWORD }}
|
|
options: >-
|
|
-v ${{ github.workspace }}:/concrete
|
|
-v ${{ github.workspace }}/build:/build
|
|
-v ${{ github.workspace }}/wheels:/wheels
|
|
-v ${{ env.SSH_AUTH_SOCK }}:/ssh.socket
|
|
-e SSH_AUTH_SOCK=/ssh.socket
|
|
${{ env.DOCKER_GPU_OPTION }}
|
|
shell: bash
|
|
run: |
|
|
set -e
|
|
cd /concrete/compilers/concrete-compiler/compiler
|
|
rm -rf /build/*
|
|
make DATAFLOW_EXECUTION_ENABLED=ON CCACHE=ON Python3_EXECUTABLE=$PYTHON_EXEC BUILD_DIR=/build all build-end-to-end-dataflow-tests
|
|
echo "Debug: ccache statistics (after the build):"
|
|
ccache -s
|
|
|
|
- name: Build compiler Dialects docs and check diff
|
|
uses: addnab/docker-run-action@v3
|
|
id: build-compiler-docs
|
|
with:
|
|
registry: ghcr.io
|
|
image: ${{ env.DOCKER_IMAGE_TEST }}
|
|
username: ${{ secrets.GHCR_LOGIN }}
|
|
password: ${{ secrets.GHCR_PASSWORD }}
|
|
options: >-
|
|
-v ${{ github.workspace }}:/concrete
|
|
-v ${{ github.workspace }}/build:/build
|
|
-v ${{ github.workspace }}/wheels:/wheels
|
|
-v ${{ env.SSH_AUTH_SOCK }}:/ssh.socket
|
|
-e SSH_AUTH_SOCK=/ssh.socket
|
|
${{ env.DOCKER_GPU_OPTION }}
|
|
shell: bash
|
|
run: |
|
|
set -e
|
|
cd /concrete/compilers/concrete-compiler/compiler
|
|
make BUILD_DIR=/build doc
|
|
cd /build/tools/concretelang/docs/concretelang/
|
|
sed -i -e 's/\[TOC\]//' *Dialect.md
|
|
for i in `ls *Dialect.md`; do diff $i /concrete/docs/dev/compilation/$i; done;
|
|
|
|
- name: Enable complete tests on push to main
|
|
if: github.ref == 'refs/heads/main'
|
|
run: echo "MINIMAL_TESTS=OFF" >> $GITHUB_ENV
|
|
|
|
- name: Enable minimal tests otherwise
|
|
if: github.ref != 'refs/heads/main'
|
|
run: echo "MINIMAL_TESTS=ON" >> $GITHUB_ENV
|
|
|
|
- name: Test compiler
|
|
uses: addnab/docker-run-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
image: ${{ env.DOCKER_IMAGE_TEST }}
|
|
username: ${{ secrets.GHCR_LOGIN }}
|
|
password: ${{ secrets.GHCR_PASSWORD }}
|
|
options: >-
|
|
-v ${{ github.workspace }}:/concrete
|
|
-v ${{ github.workspace }}/build:/build
|
|
${{ env.DOCKER_GPU_OPTION }}
|
|
shell: bash
|
|
run: |
|
|
set -e
|
|
cd /concrete/compilers/concrete-compiler/compiler
|
|
pip install pytest
|
|
dnf install -y libzstd libzstd-devel
|
|
sed "s/pytest/python -m pytest/g" -i Makefile
|
|
mkdir -p /tmp/concrete_compiler/gpu_tests/
|
|
make MINIMAL_TESTS=${{ env.MINIMAL_TESTS }} DATAFLOW_EXECUTION_ENABLED=ON CCACHE=ON Python3_EXECUTABLE=$PYTHON_EXEC BUILD_DIR=/build run-tests run-end-to-end-dataflow-tests
|
|
chmod -R ugo+rwx /tmp/KeySetCache
|
|
|
|
# - name: Archive python package
|
|
# uses: actions/upload-artifact@v3
|
|
# with:
|
|
# name: concrete-compiler.whl
|
|
# path: build/wheels/concrete_compiler-*-manylinux_{{ env.GLIB_VER }}_x86_64.whl
|
|
# retention-days: 14
|