diff --git a/.github/workflows/assets/Installation.md b/.github/workflows/assets/Installation.md index bb7141ad9..6f9460599 100644 --- a/.github/workflows/assets/Installation.md +++ b/.github/workflows/assets/Installation.md @@ -2,9 +2,9 @@ You can either install the compiler in user space or globally (you need root/sudo access): -1. User space install: extract the tarball to a chosen path and add chosen/path/zamacompiler/bin to your $PATH. +1. User space install: extract the tarball to a chosen path and add chosen/path/concretecompiler/bin to your $PATH. 2. Global install: extract the tarball to a temporary path , and copy -- temporary/path/zamacompiler/bin/zamacompiler to /usr/bin (or a directory in $PATH) -- temporary/path/zamacompiler/lib/libZamalangRuntime.so to /usr/lib (or another lib folder) \ No newline at end of file +- temporary/path/concretecompiler/bin/concretecompiler to /usr/bin (or a directory in $PATH) +- temporary/path/concretecompiler/lib/libConcretelangRuntime.so to /usr/lib (or another lib folder) \ No newline at end of file diff --git a/.github/workflows/concrete-lib-compatibility.yml b/.github/workflows/concrete-lib-compatibility.yml index 58bb7b67c..e2af7eaae 100644 --- a/.github/workflows/concrete-lib-compatibility.yml +++ b/.github/workflows/concrete-lib-compatibility.yml @@ -19,7 +19,7 @@ jobs: --base_img_url \ https://api.github.com/orgs/zama-ai/packages/container/concrete-api-env/versions \ --env_img_url \ - https://api.github.com/orgs/zama-ai/packages/container/zamalang-compiler/versions \ + https://api.github.com/orgs/zama-ai/packages/container/concretelang-compiler/versions \ --token ${{ secrets.GH_TOKEN }} - name: Send Slack Notification @@ -47,7 +47,7 @@ jobs: - name: Test compiler with latest concrete-ffi uses: addnab/docker-run-action@v3 with: - image: ghcr.io/zama-ai/zamalang-compiler + image: ghcr.io/zama-ai/concretelang-compiler options: -v ${{ github.workspace }}/concrete:/concrete run: | cd /compiler diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index d8045ff10..682c73e3c 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -10,9 +10,9 @@ on: # DOCKER_IMAGE variables aren't used in BuildAndPushDockerImages because of https://github.com/actions/runner/issues/480 env: - DOCKER_IMAGE_TEST: ghcr.io/zama-ai/zamalang-compiler - DOCKER_IMAGE_TEST_GCC6: ghcr.io/zama-ai/concretefhe-compiler - DOCKER_IMAGE_TEST_DF: ghcr.io/zama-ai/zamalang-df-compiler + DOCKER_IMAGE_TEST: ghcr.io/zama-ai/concretefhe-compiler + DOCKER_IMAGE_TEST_GCC6: ghcr.io/zama-ai/concretefhe-compiler-gcc6 + DOCKER_IMAGE_TEST_DF: ghcr.io/zama-ai/concretefhe-compiler-df jobs: ######################## @@ -88,7 +88,7 @@ jobs: cd /compiler rm -rf /build export PYTHONPATH="" - make CCACHE=ON BUILD_DIR=/build zamacompiler python-bindings + make CCACHE=ON BUILD_DIR=/build concretecompiler python-bindings echo "Debug: ccache statistics (after the build):" ccache -s @@ -217,8 +217,8 @@ jobs: run: | cd compiler make release_tarballs - sudo cp ${{ github.workspace }}/tarballs/zamacompiler.tar.gz ${{ github.workspace }}/tarballs/zamacompiler-`git describe --tags --abbrev=0`-x86_64-linux-gnu.tar.gz - echo "::set-output name=ASSET_NAME::zamacompiler-`git describe --tags --abbrev=0`-x86_64-linux-gnu.tar.gz" + sudo cp ${{ github.workspace }}/tarballs/concretecompiler.tar.gz ${{ github.workspace }}/tarballs/concretecompiler-`git describe --tags --abbrev=0`-x86_64-linux-gnu.tar.gz + echo "::set-output name=ASSET_NAME::concretecompiler-`git describe --tags --abbrev=0`-x86_64-linux-gnu.tar.gz" - name: Upload Tarball uses: actions/upload-release-asset@v1 @@ -296,13 +296,13 @@ jobs: run: | cd compiler export CONCRETE_PROJECT=${{ github.workspace }}/concrete - make zamacompiler - mkdir -p tarballs/zamacompiler/lib tarballs/zamacompiler/bin - cp build/bin/zamacompiler tarballs/zamacompiler/bin - cp build/lib/libZamalangRuntime.dylib tarballs/zamacompiler/lib - cp ../.github/workflows/assets/Installation.md tarballs/zamacompiler/ - cd tarballs && tar -czvf zamacompiler-`git describe --tags --abbrev=0`-x86_64-macos-catalina.tar.gz zamacompiler - echo "::set-output name=ASSET_NAME::zamacompiler-`git describe --tags --abbrev=0`-x86_64-macos-catalina.tar.gz" + make concretecompiler + mkdir -p tarballs/concretecompiler/lib tarballs/concretecompiler/bin + cp build/bin/concretecompiler tarballs/concretecompiler/bin + cp build/lib/libConcretelangRuntime.dylib tarballs/concretecompiler/lib + cp ../.github/workflows/assets/Installation.md tarballs/concretecompiler/ + cd tarballs && tar -czvf concretecompiler-`git describe --tags --abbrev=0`-x86_64-macos-catalina.tar.gz concretecompiler + echo "::set-output name=ASSET_NAME::concretecompiler-`git describe --tags --abbrev=0`-x86_64-macos-catalina.tar.gz" - name: Upload Tarball if: matrix.python == '3.8' @@ -410,14 +410,14 @@ jobs: matrix: include: - name: test-env - image: ghcr.io/zama-ai/zamalang-compiler - dockerfile: builders/Dockerfile.zamalang-env - - name: test-env-gcc6 image: ghcr.io/zama-ai/concretefhe-compiler - dockerfile: builders/Dockerfile.zamalang-env-gcc6 + dockerfile: builders/Dockerfile.concretefhe-compiler-env + - name: test-env-gcc6 + image: ghcr.io/zama-ai/concretefhe-compiler-gcc6 + dockerfile: builders/Dockerfile.concretefhe-compiler-gcc6-env - name: test-df - image: ghcr.io/zama-ai/zamalang-df-compiler - dockerfile: builders/Dockerfile.zamalang-df-env + image: ghcr.io/zama-ai/concretefhe-compiler-df + dockerfile: builders/Dockerfile.concretefhe-compiler-df-env steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/llvm-compatibility.yml b/.github/workflows/llvm-compatibility.yml index 3dad4db48..9b3e4937d 100644 --- a/.github/workflows/llvm-compatibility.yml +++ b/.github/workflows/llvm-compatibility.yml @@ -28,7 +28,7 @@ jobs: run: echo "${{ secrets.GHCR_PASSWORD }}" | docker login -u ${{ secrets.GHCR_LOGIN }} --password-stdin ghcr.io - name: Build - run: docker image build --no-cache -t compiler-latest-llvm -f builders/Dockerfile.zamalang-env . + run: docker image build --no-cache -t compiler-latest-llvm -f builders/Dockerfile.concretelang-env . - name: Test compiler with latest LLVM uses: addnab/docker-run-action@v3 diff --git a/builders/Dockerfile.zamalang-df-env b/builders/Dockerfile.concretefhe-compiler-df-env similarity index 65% rename from builders/Dockerfile.zamalang-df-env rename to builders/Dockerfile.concretefhe-compiler-df-env index f35440109..1e5d5582b 100644 --- a/builders/Dockerfile.zamalang-df-env +++ b/builders/Dockerfile.concretefhe-compiler-df-env @@ -25,19 +25,19 @@ COPY /compiler /compiler WORKDIR /compiler RUN mkdir -p /build RUN make PARALLEL_EXECUTION_ENABLED=ON BUILD_DIR=/build CCACHE=ON \ - zamacompiler python-bindings && \ - mv /build/tools/zamalang/python_packages/zamalang_core /zamalang_core && \ - mv /build/bin/zamacompiler /bin && \ - mv /build/lib/libZamalangRuntime.so /lib && \ + concretecompiler python-bindings && \ + mv /build/tools/concretelang/python_packages/concretelang_core /concretelang_core && \ + mv /build/bin/concretecompiler /bin && \ + mv /build/lib/libConcretelangRuntime.so /lib && \ mv /build/lib/libDFRuntime.so /lib && \ rm -rf /build && \ - mkdir -p /build/tools/zamalang/python_packages/ && \ + mkdir -p /build/tools/concretelang/python_packages/ && \ mkdir -p /build/bin && \ mkdir -p /build/lib && \ - mv /zamalang_core /build/tools/zamalang/python_packages/ && \ - mv /bin/zamacompiler /build/bin && \ - mv /lib/libZamalangRuntime.so /build/lib && \ + mv /concretelang_core /build/tools/concretelang/python_packages/ && \ + mv /bin/concretecompiler /build/bin && \ + mv /lib/libConcretelangRuntime.so /build/lib && \ mv /lib/libDFRuntime.so /build/lib -ENV PYTHONPATH "$PYTHONPATH:/build/tools/zamalang/python_packages/zamalang_core" +ENV PYTHONPATH "$PYTHONPATH:/build/tools/concretelang/python_packages/concretelang_core" ENV PATH "$PATH:/build/bin" -ENV RT_LIB "/build/lib/libZamalangRuntime.so" +ENV RT_LIB "/build/lib/libConcretelangRuntime.so" diff --git a/builders/Dockerfile.zamalang-env b/builders/Dockerfile.concretefhe-compiler-env similarity index 53% rename from builders/Dockerfile.zamalang-env rename to builders/Dockerfile.concretefhe-compiler-env index b20bfc4c3..1386ba18e 100644 --- a/builders/Dockerfile.zamalang-env +++ b/builders/Dockerfile.concretefhe-compiler-env @@ -15,17 +15,17 @@ COPY /llvm-project /llvm-project COPY /compiler /compiler WORKDIR /compiler RUN mkdir -p /build -RUN make BUILD_DIR=/build CCACHE=ON zamacompiler python-bindings && \ - mv /build/tools/zamalang/python_packages/zamalang_core /zamalang_core && \ - mv /build/bin/zamacompiler /bin && \ - mv /build/lib/libZamalangRuntime.so /lib && \ +RUN make BUILD_DIR=/build CCACHE=ON concretecompiler python-bindings && \ + mv /build/tools/concretelang/python_packages/concretelang_core /concretelang_core && \ + mv /build/bin/concretecompiler /bin && \ + mv /build/lib/libConcretelangRuntime.so /lib && \ rm -rf /build && \ - mkdir -p /build/tools/zamalang/python_packages/ && \ + mkdir -p /build/tools/concretelang/python_packages/ && \ mkdir -p /build/bin && \ mkdir -p /build/lib && \ - mv /zamalang_core /build/tools/zamalang/python_packages/ && \ - mv /bin/zamacompiler /build/bin && \ - mv /lib/libZamalangRuntime.so /build/lib -ENV PYTHONPATH "$PYTHONPATH:/build/tools/zamalang/python_packages/zamalang_core" + mv /concretelang_core /build/tools/concretelang/python_packages/ && \ + mv /bin/concretecompiler /build/bin && \ + mv /lib/libConcretelangRuntime.so /build/lib +ENV PYTHONPATH "$PYTHONPATH:/build/tools/concretelang/python_packages/concretelang_core" ENV PATH "$PATH:/build/bin" -ENV RT_LIB "/build/lib/libZamalangRuntime.so" +ENV RT_LIB "/build/lib/libConcretelangRuntime.so" diff --git a/builders/Dockerfile.zamalang-env-gcc6 b/builders/Dockerfile.concretefhe-compiler-gcc6-env similarity index 92% rename from builders/Dockerfile.zamalang-env-gcc6 rename to builders/Dockerfile.concretefhe-compiler-gcc6-env index b115ce3ec..6b4398f2b 100644 --- a/builders/Dockerfile.zamalang-env-gcc6 +++ b/builders/Dockerfile.concretefhe-compiler-gcc6-env @@ -18,5 +18,5 @@ ENV CONCRETE_PROJECT=/concrete COPY /compiler /compiler WORKDIR /compiler RUN mkdir -p /build -RUN make BUILD_DIR=/build Python3_EXECUTABLE=/opt/python/${python_tag}/bin/python CCACHE=ON python-bindings zamacompiler +RUN make BUILD_DIR=/build Python3_EXECUTABLE=/opt/python/${python_tag}/bin/python CCACHE=ON python-bindings concretecompiler ENV PATH "$PATH:/build/bin" \ No newline at end of file diff --git a/builders/Dockerfile.release_manylinux_2_24_x86_64 b/builders/Dockerfile.release_manylinux_2_24_x86_64 index ed539a31f..e91420000 100644 --- a/builders/Dockerfile.release_manylinux_2_24_x86_64 +++ b/builders/Dockerfile.release_manylinux_2_24_x86_64 @@ -16,8 +16,8 @@ COPY /compiler /compiler WORKDIR /compiler RUN make Python3_EXECUTABLE=/opt/python/${python_tag}/bin/python python-bindings # Fix MLIR package -RUN touch build/tools/zamalang/python_packages/zamalang_core/mlir/__init__.py -RUN touch build/tools/zamalang/python_packages/zamalang_core/mlir/dialects/__init__.py +RUN touch build/tools/concretelang/python_packages/concretelang_core/mlir/__init__.py +RUN touch build/tools/concretelang/python_packages/concretelang_core/mlir/dialects/__init__.py # Build wheel RUN /opt/python/${python_tag}/bin/pip wheel --no-deps -w /wheels . RUN auditwheel repair /wheels/*.whl --plat manylinux_2_24_x86_64 -w /wheels \ No newline at end of file diff --git a/builders/Dockerfile.release_tarball_linux_x86_64 b/builders/Dockerfile.release_tarball_linux_x86_64 index e6b68ff00..9165621cd 100644 --- a/builders/Dockerfile.release_tarball_linux_x86_64 +++ b/builders/Dockerfile.release_tarball_linux_x86_64 @@ -11,10 +11,10 @@ ENV CONCRETE_PROJECT=/concrete COPY .github/workflows/assets/Installation.md / COPY /compiler /compiler WORKDIR /compiler -RUN make BINDINGS_PYTHON_ENABLED=OFF zamacompiler +RUN make BINDINGS_PYTHON_ENABLED=OFF concretecompiler # Build tarball -RUN mkdir -p /tarballs/zamacompiler/lib /tarballs/zamacompiler/bin && \ - cp /compiler/build/bin/zamacompiler /tarballs/zamacompiler/bin && \ - cp /compiler/build/lib/libZamalangRuntime.so /tarballs/zamacompiler/lib && \ - cp /Installation.md /tarballs/zamacompiler/ -RUN cd /tarballs && tar -czvf zamacompiler.tar.gz zamacompiler \ No newline at end of file +RUN mkdir -p /tarballs/concretecompiler/lib /tarballs/concretecompiler/bin && \ + cp /compiler/build/bin/concretecompiler /tarballs/concretecompiler/bin && \ + cp /compiler/build/lib/libConcretelangRuntime.so /tarballs/concretecompiler/lib && \ + cp /Installation.md /tarballs/concretecompiler/ +RUN cd /tarballs && tar -czvf concretecompiler.tar.gz concretecompiler \ No newline at end of file diff --git a/compiler/CMakeLists.txt b/compiler/CMakeLists.txt index 1b153fd8d..5102be320 100644 --- a/compiler/CMakeLists.txt +++ b/compiler/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.13) -project(zamacompiler LANGUAGES C CXX) +project(concretecompiler LANGUAGES C CXX) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -9,7 +9,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # If we are trying to build the compiler with LLVM/MLIR as libraries -if( NOT DEFINED LLVM_EXTERNAL_ZAMALANG_SOURCE_DIR ) +if( NOT DEFINED LLVM_EXTERNAL_CONCRETELANG_SOURCE_DIR ) message(FATAL_ERROR "Concrete compiler requires a unified build with LLVM/MLIR") endif() @@ -41,8 +41,8 @@ add_definitions(${LLVM_DEFINITIONS}) # Custom doc generation function list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") -include(AddZamalangDoc) -set(ZAMALANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) +include(AddConcretelangDoc) +set(CONCRETELANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) #------------------------------------------------------------------------------- # Concrete FFI Configuration @@ -55,10 +55,10 @@ set_target_properties(Concrete PROPERTIES IMPORTED_LOCATION ${CONCRETE_FFI_RELEA # Python Configuration #------------------------------------------------------------------------------- -option(ZAMALANG_BINDINGS_PYTHON_ENABLED "Enables ZamaLang Python bindings." ON) +option(CONCRETELANG_BINDINGS_PYTHON_ENABLED "Enables ConcreteLang Python bindings." ON) -if(ZAMALANG_BINDINGS_PYTHON_ENABLED) - message(STATUS "ZamaLang Python bindings are enabled.") +if(CONCRETELANG_BINDINGS_PYTHON_ENABLED) + message(STATUS "ConcreteLang Python bindings are enabled.") include(MLIRDetectPythonEnv) # After CMake 3.18, we are able to limit the scope of the search to just @@ -84,33 +84,33 @@ if(ZAMALANG_BINDINGS_PYTHON_ENABLED) "suffix = '${PYTHON_MODULE_SUFFIX}', " "extension = '${PYTHON_MODULE_EXTENSION}'") - set(ZAMALANG_PYTHON_PACKAGES_DIR ${CMAKE_CURRENT_BINARY_DIR}/python_packages) + set(CONCRETELANG_PYTHON_PACKAGES_DIR ${CMAKE_CURRENT_BINARY_DIR}/python_packages) else() - message(STATUS "ZamaLang Python bindings are disabled.") + message(STATUS "ConcreteLang Python bindings are disabled.") endif() #------------------------------------------------------------------------------- # DFR - parallel execution configuration #------------------------------------------------------------------------------- -option(ZAMALANG_PARALLEL_EXECUTION_ENABLED "Enables parallel execution for ZamaLang." ON) +option(CONCRETELANG_PARALLEL_EXECUTION_ENABLED "Enables parallel execution for ConcreteLang." ON) -if(ZAMALANG_PARALLEL_EXECUTION_ENABLED) - message(STATUS "ZamaLang parallel execution enabled.") +if(CONCRETELANG_PARALLEL_EXECUTION_ENABLED) + message(STATUS "ConcreteLang parallel execution enabled.") find_package(HPX REQUIRED CONFIG) include_directories(SYSTEM ${HPX_INCLUDE_DIRS}) list(APPEND CMAKE_MODULE_PATH "${HPX_CMAKE_DIR}") else() - message(STATUS "ZamaLang parallel execution disabled.") + message(STATUS "ConcreteLang parallel execution disabled.") endif() #------------------------------------------------------------------------------- # Unit tests #------------------------------------------------------------------------------- -option(ZAMALANG_UNIT_TESTS "Enables the build of unittests" ON) +option(CONCRETELANG_UNIT_TESTS "Enables the build of unittests" ON) add_subdirectory(include) diff --git a/compiler/Makefile b/compiler/Makefile index ee51099b8..1cce35d42 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -26,12 +26,12 @@ $(BUILD_DIR)/configured.stamp: -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DMLIR_ENABLE_BINDINGS_PYTHON=$(BINDINGS_PYTHON_ENABLED) \ - -DZAMALANG_BINDINGS_PYTHON_ENABLED=$(BINDINGS_PYTHON_ENABLED) \ - -DZAMALANG_PARALLEL_EXECUTION_ENABLED=$(PARALLEL_EXECUTION_ENABLED) \ + -DCONCRETELANG_BINDINGS_PYTHON_ENABLED=$(BINDINGS_PYTHON_ENABLED) \ + -DCONCRETELANG_PARALLEL_EXECUTION_ENABLED=$(PARALLEL_EXECUTION_ENABLED) \ -DCONCRETE_FFI_RELEASE=${CONCRETE_PROJECT}/target/release \ -DHPX_DIR=${HPX_INSTALL_DIR}/lib/cmake/HPX \ - -DLLVM_EXTERNAL_PROJECTS=zamalang \ - -DLLVM_EXTERNAL_ZAMALANG_SOURCE_DIR=. \ + -DLLVM_EXTERNAL_PROJECTS=concretelang \ + -DLLVM_EXTERNAL_CONCRETELANG_SOURCE_DIR=. \ -DPython3_EXECUTABLE=${Python3_EXECUTABLE} touch $@ @@ -40,18 +40,18 @@ build-initialized: $(BUILD_DIR)/configured.stamp doc: build-initialized cmake --build $(BUILD_DIR) --target mlir-doc -zamacompiler: build-initialized - cmake --build $(BUILD_DIR) --target zamacompiler +concretecompiler: build-initialized + cmake --build $(BUILD_DIR) --target concretecompiler python-bindings: build-initialized - cmake --build $(BUILD_DIR) --target ZamalangMLIRPythonModules - cmake --build $(BUILD_DIR) --target ZamalangPythonModules + cmake --build $(BUILD_DIR) --target ConcretelangMLIRPythonModules + cmake --build $(BUILD_DIR) --target ConcretelangPythonModules -test-check: zamacompiler file-check not +test-check: concretecompiler file-check not $(BUILD_DIR)/bin/llvm-lit -v tests/ -test-python: python-bindings zamacompiler - PYTHONPATH=${PYTHONPATH}:$(BUILD_DIR)/tools/zamalang/python_packages/zamalang_core LD_PRELOAD=$(BUILD_DIR)/lib/libZamalangRuntime.so pytest -vs tests/python +test-python: python-bindings concretecompiler + PYTHONPATH=${PYTHONPATH}:$(BUILD_DIR)/tools/concretelang/python_packages/concretelang_core LD_PRELOAD=$(BUILD_DIR)/lib/libConcretelangRuntime.so pytest -vs tests/python test: test-check test-end-to-end-jit test-python @@ -115,11 +115,11 @@ show-stress-tests-summary: @echo 'Parameters issues:' @cd tests/stress_tests/trace && grep BAD -R || echo 'No issues' -stress-tests: zamacompiler +stress-tests: concretecompiler pytest -vs tests/stress_tests # useful for faster cache generation, need pytest-parallel -stress-tests-fast-cache: zamacompiler +stress-tests-fast-cache: concretecompiler pytest --workers auto -vs tests/stress_tests # LLVM/MLIR dependencies @@ -152,11 +152,11 @@ release_tarballs: docker container run --rm -v ${PWD}/../tarballs:/tarballs_volume concretefhe-compiler-manylinux:linux_x86_64_tarball cp -r /tarballs/. /tarballs_volume/. update_python_version: - echo "__version__ = \"`git describe --tags --abbrev=0 | grep -e '[0-9].*' -o`\"" > lib/Bindings/Python/zamalang/version.py + echo "__version__ = \"`git describe --tags --abbrev=0 | grep -e '[0-9].*' -o`\"" > lib/Bindings/Python/concretelang/version.py .PHONY: build-initialized \ build-end-to-end-jit \ - zamacompiler \ + concretecompiler \ python-bindings \ test-check \ test-end-to-end-jit \ diff --git a/compiler/README.md b/compiler/README.md index eb9c8a56f..73d77dd2b 100644 --- a/compiler/README.md +++ b/compiler/README.md @@ -30,7 +30,7 @@ make build-initialized Build the compiler ```sh -make zamacompiler +make concretecompiler ``` Test the compiler @@ -44,5 +44,5 @@ make test Run the compiler ```sh -./build/src/zamacompiler +./build/src/concretecompiler ``` diff --git a/compiler/cmake/modules/AddZamalangDoc.cmake b/compiler/cmake/modules/AddConcretelangDoc.cmake similarity index 64% rename from compiler/cmake/modules/AddZamalangDoc.cmake rename to compiler/cmake/modules/AddConcretelangDoc.cmake index 1cbb2a1c3..ebf079c63 100644 --- a/compiler/cmake/modules/AddZamalangDoc.cmake +++ b/compiler/cmake/modules/AddConcretelangDoc.cmake @@ -1,8 +1,8 @@ include(AddMLIR) -function(add_zamalang_doc doc_filename output_file output_directory command) +function(add_concretelang_doc doc_filename output_file output_directory command) set(SAVED_MLIR_BINARY_DIR ${MLIR_BINARY_DIR}) - set(MLIR_BINARY_DIR ${ZAMALANG_BINARY_DIR}) + set(MLIR_BINARY_DIR ${CONCRETELANG_BINARY_DIR}) add_mlir_doc(${doc_filename} ${output_file} ${output_directory} ${command}) set(MLIR_BINARY_DIR ${SAVED_MLIR_BINARY_DIR}) unset(SAVED_MLIR_BINARY_DIR) diff --git a/compiler/include/CMakeLists.txt b/compiler/include/CMakeLists.txt index f0ca28852..be358a95b 100644 --- a/compiler/include/CMakeLists.txt +++ b/compiler/include/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory(zamalang) +add_subdirectory(concretelang) diff --git a/compiler/include/zamalang-c/Dialect/HLFHE.h b/compiler/include/concretelang-c/Dialect/HLFHE.h similarity index 86% rename from compiler/include/zamalang-c/Dialect/HLFHE.h rename to compiler/include/concretelang-c/Dialect/HLFHE.h index 064fb2672..23d96cf09 100644 --- a/compiler/include/zamalang-c/Dialect/HLFHE.h +++ b/compiler/include/concretelang-c/Dialect/HLFHE.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_C_DIALECT_HLFHE_H -#define ZAMALANG_C_DIALECT_HLFHE_H +#ifndef CONCRETELANG_C_DIALECT_HLFHE_H +#define CONCRETELANG_C_DIALECT_HLFHE_H #include "mlir-c/IR.h" #include "mlir-c/Registration.h" @@ -27,4 +27,4 @@ MLIR_CAPI_EXPORTED bool hlfheTypeIsAnEncryptedIntegerType(MlirType); } #endif -#endif // ZAMALANG_C_DIALECT_HLFHE_H +#endif // CONCRETELANG_C_DIALECT_HLFHE_H diff --git a/compiler/include/zamalang-c/Dialect/HLFHELinalg.h b/compiler/include/concretelang-c/Dialect/HLFHELinalg.h similarity index 76% rename from compiler/include/zamalang-c/Dialect/HLFHELinalg.h rename to compiler/include/concretelang-c/Dialect/HLFHELinalg.h index 2c6836d5b..69a85377a 100644 --- a/compiler/include/zamalang-c/Dialect/HLFHELinalg.h +++ b/compiler/include/concretelang-c/Dialect/HLFHELinalg.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_C_DIALECT_HLFHELINALG_H -#define ZAMALANG_C_DIALECT_HLFHELINALG_H +#ifndef CONCRETELANG_C_DIALECT_HLFHELINALG_H +#define CONCRETELANG_C_DIALECT_HLFHELINALG_H #include "mlir-c/IR.h" #include "mlir-c/Registration.h" @@ -19,4 +19,4 @@ MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(HLFHELinalg, hlfhelinalg); } #endif -#endif // ZAMALANG_C_DIALECT_HLFHELINALG_H +#endif // CONCRETELANG_C_DIALECT_HLFHELINALG_H diff --git a/compiler/include/zamalang-c/Support/CompilerEngine.h b/compiler/include/concretelang-c/Support/CompilerEngine.h similarity index 83% rename from compiler/include/zamalang-c/Support/CompilerEngine.h rename to compiler/include/concretelang-c/Support/CompilerEngine.h index ef2fa3026..a03e0f15e 100644 --- a/compiler/include/zamalang-c/Support/CompilerEngine.h +++ b/compiler/include/concretelang-c/Support/CompilerEngine.h @@ -1,28 +1,28 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_C_SUPPORT_COMPILER_ENGINE_H -#define ZAMALANG_C_SUPPORT_COMPILER_ENGINE_H +#ifndef CONCRETELANG_C_SUPPORT_COMPILER_ENGINE_H +#define CONCRETELANG_C_SUPPORT_COMPILER_ENGINE_H #include "mlir-c/IR.h" #include "mlir-c/Registration.h" -#include "zamalang/Support/CompilerEngine.h" -#include "zamalang/Support/Jit.h" -#include "zamalang/Support/JitCompilerEngine.h" +#include "concretelang/Support/CompilerEngine.h" +#include "concretelang/Support/Jit.h" +#include "concretelang/Support/JitCompilerEngine.h" #ifdef __cplusplus extern "C" { #endif -// C wrapper of the mlir::zamalang::JitCompilerEngine::Lambda +// C wrapper of the mlir::concretelang::JitCompilerEngine::Lambda struct lambda { - mlir::zamalang::JitCompilerEngine::Lambda *ptr; + mlir::concretelang::JitCompilerEngine::Lambda *ptr; }; typedef struct lambda lambda; -// C wrapper of the mlir::zamalang::LambdaArgument +// C wrapper of the mlir::concretelang::LambdaArgument struct lambdaArgument { - std::shared_ptr ptr; + std::shared_ptr ptr; }; typedef struct lambdaArgument lambdaArgument; @@ -38,7 +38,7 @@ typedef struct executionArguments executionArguments; // null) as a shared library during compilation, // a path to activate the use a cache for encryption keys for test purpose // (unsecure). -MLIR_CAPI_EXPORTED mlir::zamalang::JitCompilerEngine::Lambda +MLIR_CAPI_EXPORTED mlir::concretelang::JitCompilerEngine::Lambda buildLambda(const char *module, const char *funcName, const char *runtimeLibPath, const char *keySetCachePath); @@ -82,4 +82,4 @@ MLIR_CAPI_EXPORTED std::string library(std::string libraryPath, } #endif -#endif // ZAMALANG_C_SUPPORT_COMPILER_ENGINE_H +#endif // CONCRETELANG_C_SUPPORT_COMPILER_ENGINE_H diff --git a/compiler/include/zamalang/CMakeLists.txt b/compiler/include/concretelang/CMakeLists.txt similarity index 100% rename from compiler/include/zamalang/CMakeLists.txt rename to compiler/include/concretelang/CMakeLists.txt diff --git a/compiler/include/zamalang/Conversion/CMakeLists.txt b/compiler/include/concretelang/Conversion/CMakeLists.txt similarity index 73% rename from compiler/include/zamalang/Conversion/CMakeLists.txt rename to compiler/include/concretelang/Conversion/CMakeLists.txt index dcd8c8885..29b37fe3d 100644 --- a/compiler/include/zamalang/Conversion/CMakeLists.txt +++ b/compiler/include/concretelang/Conversion/CMakeLists.txt @@ -1,6 +1,6 @@ set(LLVM_TARGET_DEFINITIONS Passes.td) mlir_tablegen(Passes.h.inc -gen-pass-decls -name Conversion) -add_public_tablegen_target(ZamalangConversionPassIncGen) +add_public_tablegen_target(ConcretelangConversionPassIncGen) add_subdirectory(HLFHEToMidLFHE) diff --git a/compiler/include/zamalang/Conversion/HLFHETensorOpsToLinalg/Pass.h b/compiler/include/concretelang/Conversion/HLFHETensorOpsToLinalg/Pass.h similarity index 70% rename from compiler/include/zamalang/Conversion/HLFHETensorOpsToLinalg/Pass.h rename to compiler/include/concretelang/Conversion/HLFHETensorOpsToLinalg/Pass.h index 495506296..340715ff0 100644 --- a/compiler/include/zamalang/Conversion/HLFHETensorOpsToLinalg/Pass.h +++ b/compiler/include/concretelang/Conversion/HLFHETensorOpsToLinalg/Pass.h @@ -2,17 +2,17 @@ // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_CONVERSION_HLFHETENSOROPSTOLINALG_PASS_H_ -#define ZAMALANG_CONVERSION_HLFHETENSOROPSTOLINALG_PASS_H_ +#ifndef CONCRETELANG_CONVERSION_HLFHETENSOROPSTOLINALG_PASS_H_ +#define CONCRETELANG_CONVERSION_HLFHETENSOROPSTOLINALG_PASS_H_ #include "mlir/Pass/Pass.h" namespace mlir { -namespace zamalang { +namespace concretelang { /// Create a pass to convert `HLFHE` tensor operators to linal.generic /// operators. std::unique_ptr createConvertHLFHETensorOpsToLinalg(); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Conversion/HLFHEToMidLFHE/CMakeLists.txt b/compiler/include/concretelang/Conversion/HLFHEToMidLFHE/CMakeLists.txt similarity index 65% rename from compiler/include/zamalang/Conversion/HLFHEToMidLFHE/CMakeLists.txt rename to compiler/include/concretelang/Conversion/HLFHEToMidLFHE/CMakeLists.txt index da7db6e08..65c817ed3 100644 --- a/compiler/include/zamalang/Conversion/HLFHEToMidLFHE/CMakeLists.txt +++ b/compiler/include/concretelang/Conversion/HLFHEToMidLFHE/CMakeLists.txt @@ -2,4 +2,4 @@ set(LLVM_TARGET_DEFINITIONS Patterns.td) mlir_tablegen(Patterns.h.inc -gen-rewriters -name HLFHE) add_public_tablegen_target(HLFHEToMidLFHEPatternsIncGen) -add_zamalang_doc(Patterns HLFHEToMidLFHEPatterns zamalang/ -gen-pass-doc) +add_concretelang_doc(Patterns HLFHEToMidLFHEPatterns concretelang/ -gen-pass-doc) diff --git a/compiler/include/zamalang/Conversion/HLFHEToMidLFHE/Pass.h b/compiler/include/concretelang/Conversion/HLFHEToMidLFHE/Pass.h similarity index 71% rename from compiler/include/zamalang/Conversion/HLFHEToMidLFHE/Pass.h rename to compiler/include/concretelang/Conversion/HLFHEToMidLFHE/Pass.h index afb229d7e..177ac3061 100644 --- a/compiler/include/zamalang/Conversion/HLFHEToMidLFHE/Pass.h +++ b/compiler/include/concretelang/Conversion/HLFHEToMidLFHE/Pass.h @@ -2,16 +2,16 @@ // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_CONVERSION_HLFHETOMIDLFHE_PASS_H_ -#define ZAMALANG_CONVERSION_HLFHETOMIDLFHE_PASS_H_ +#ifndef CONCRETELANG_CONVERSION_HLFHETOMIDLFHE_PASS_H_ +#define CONCRETELANG_CONVERSION_HLFHETOMIDLFHE_PASS_H_ #include "mlir/Pass/Pass.h" namespace mlir { -namespace zamalang { +namespace concretelang { /// Create a pass to convert `HLFHE` dialect to `MidLFHE` dialect. std::unique_ptr> createConvertHLFHEToMidLFHEPass(); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Conversion/HLFHEToMidLFHE/Patterns.h b/compiler/include/concretelang/Conversion/HLFHEToMidLFHE/Patterns.h similarity index 83% rename from compiler/include/zamalang/Conversion/HLFHEToMidLFHE/Patterns.h rename to compiler/include/concretelang/Conversion/HLFHEToMidLFHE/Patterns.h index 5c375dbd7..e65efbd1f 100644 --- a/compiler/include/zamalang/Conversion/HLFHEToMidLFHE/Patterns.h +++ b/compiler/include/concretelang/Conversion/HLFHEToMidLFHE/Patterns.h @@ -1,17 +1,17 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_CONVERSION_HLFHETOMIDLFHE_PATTERNS_H_ -#define ZAMALANG_CONVERSION_HLFHETOMIDLFHE_PATTERNS_H_ +#ifndef CONCRETELANG_CONVERSION_HLFHETOMIDLFHE_PATTERNS_H_ +#define CONCRETELANG_CONVERSION_HLFHETOMIDLFHE_PATTERNS_H_ #include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/IR/Builders.h" #include "mlir/IR/PatternMatch.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEOps.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEOps.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOps.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEOps.h" namespace mlir { -namespace zamalang { +namespace concretelang { using HLFHE::EncryptedIntegerType; using MidLFHE::GLWECipherTextType; @@ -29,7 +29,7 @@ mlir::Value createZeroGLWEOpFromHLFHE(mlir::PatternRewriter &rewriter, mlir::SmallVector args{}; mlir::SmallVector attrs; auto eint = - result.getType().cast(); + result.getType().cast(); mlir::SmallVector resTypes{ convertTypeEncryptedIntegerToGLWE(rewriter.getContext(), eint)}; MidLFHE::ZeroGLWEOp op = @@ -44,7 +44,7 @@ mlir::Value createGLWEOpFromHLFHE(mlir::PatternRewriter &rewriter, mlir::SmallVector args{arg0, arg1}; mlir::SmallVector attrs; auto eint = - result.getType().cast(); + result.getType().cast(); mlir::SmallVector resTypes{ convertTypeEncryptedIntegerToGLWE(rewriter.getContext(), eint)}; Operator op = rewriter.create(loc, resTypes, args, attrs); @@ -58,7 +58,7 @@ mlir::Value createGLWEOpFromHLFHE(mlir::PatternRewriter &rewriter, mlir::SmallVector args{arg0}; mlir::SmallVector attrs; auto eint = - result.getType().cast(); + result.getType().cast(); mlir::SmallVector resTypes{ convertTypeEncryptedIntegerToGLWE(rewriter.getContext(), eint)}; Operator op = rewriter.create(loc, resTypes, args, attrs); @@ -86,19 +86,19 @@ createApplyLookupTableGLWEOpFromHLFHE(mlir::PatternRewriter &rewriter, unset), }; auto eint = - result.getType().cast(); + result.getType().cast(); mlir::SmallVector resTypes{ convertTypeEncryptedIntegerToGLWE(rewriter.getContext(), eint)}; - auto op = rewriter.create(loc, resTypes, + auto op = rewriter.create(loc, resTypes, args, attrs); return op.getODSResults(0).front(); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir namespace { -#include "zamalang/Conversion/HLFHEToMidLFHE/Patterns.h.inc" +#include "concretelang/Conversion/HLFHEToMidLFHE/Patterns.h.inc" } void populateWithGeneratedHLFHEToMidLFHE(mlir::RewritePatternSet &patterns) { diff --git a/compiler/include/concretelang/Conversion/HLFHEToMidLFHE/Patterns.td b/compiler/include/concretelang/Conversion/HLFHEToMidLFHE/Patterns.td new file mode 100644 index 000000000..96e84a1c1 --- /dev/null +++ b/compiler/include/concretelang/Conversion/HLFHEToMidLFHE/Patterns.td @@ -0,0 +1,50 @@ +#ifndef CONCRETELANG_CONVERSION_HLFHETOMIDLFHE_PATTERNS +#define CONCRETELANG_CONVERSION_HLFHETOMIDLFHE_PATTERNS + +include "mlir/Pass/PassBase.td" +include "concretelang/Dialect/HLFHE/IR/HLFHEOps.td" +include "concretelang/Dialect/MidLFHE/IR/MidLFHEOps.td" + +def createZeroGLWEOp : NativeCodeCall<"mlir::concretelang::createZeroGLWEOpFromHLFHE($_builder, $_loc, $0)">; + +def ZeroEintPattern : Pat< + (ZeroEintOp:$result), + (createZeroGLWEOp $result)>; + +def createAddGLWEIntOp : NativeCodeCall<"mlir::concretelang::createGLWEOpFromHLFHE($_builder, $_loc, $0, $1, $2)">; + +def AddEintIntPattern : Pat< + (AddEintIntOp:$result $arg0, $arg1), + (createAddGLWEIntOp $arg0, $arg1, $result)>; + +def createAddGLWEOp : NativeCodeCall<"mlir::concretelang::createGLWEOpFromHLFHE($_builder, $_loc, $0, $1, $2)">; + +def AddEintPattern : Pat< + (AddEintOp:$result $arg0, $arg1), + (createAddGLWEOp $arg0, $arg1, $result)>; + +def createSubIntGLWEOp : NativeCodeCall<"mlir::concretelang::createGLWEOpFromHLFHE($_builder, $_loc, $0, $1, $2)">; + +def SubIntEintPattern : Pat< + (SubIntEintOp:$result $arg0, $arg1), + (createSubIntGLWEOp $arg0, $arg1, $result)>; + +def createNegGLWEOp : NativeCodeCall<"mlir::concretelang::createGLWEOpFromHLFHE($_builder, $_loc, $0, $1)">; + +def NegEintPattern : Pat< + (NegEintOp:$result $arg0), + (createNegGLWEOp $arg0, $result)>; + +def createMulGLWEIntOp : NativeCodeCall<"mlir::concretelang::createGLWEOpFromHLFHE($_builder, $_loc, $0, $1, $2)">; + +def MulEintIntPattern : Pat< + (MulEintIntOp:$result $arg0, $arg1), + (createMulGLWEIntOp $arg0, $arg1, $result)>; + +def createApplyLookupTableGLWEOp : NativeCodeCall<"mlir::concretelang::createApplyLookupTableGLWEOpFromHLFHE($_builder, $_loc, $0, $1, $2)">; + +def ApplyLookupTableEintPattern : Pat< + (ApplyLookupTableEintOp:$result $arg0, $arg1), + (createApplyLookupTableGLWEOp $arg0, $arg1, $result)>; + +#endif diff --git a/compiler/include/zamalang/Conversion/LowLFHEToConcreteCAPI/Pass.h b/compiler/include/concretelang/Conversion/LowLFHEToConcreteCAPI/Pass.h similarity index 64% rename from compiler/include/zamalang/Conversion/LowLFHEToConcreteCAPI/Pass.h rename to compiler/include/concretelang/Conversion/LowLFHEToConcreteCAPI/Pass.h index 61a2cf56a..eb0290d6a 100644 --- a/compiler/include/zamalang/Conversion/LowLFHEToConcreteCAPI/Pass.h +++ b/compiler/include/concretelang/Conversion/LowLFHEToConcreteCAPI/Pass.h @@ -2,20 +2,20 @@ // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_CONVERSION_LOWLFHETOCONCRETECAPI_PASS_H_ -#define ZAMALANG_CONVERSION_LOWLFHETOCONCRETECAPI_PASS_H_ +#ifndef CONCRETELANG_CONVERSION_LOWLFHETOCONCRETECAPI_PASS_H_ +#define CONCRETELANG_CONVERSION_LOWLFHETOCONCRETECAPI_PASS_H_ #include "mlir/Pass/Pass.h" -#include "zamalang/Conversion/Utils/GlobalFHEContext.h" +#include "concretelang/Conversion/Utils/GlobalFHEContext.h" namespace mlir { -namespace zamalang { +namespace concretelang { /// Create a pass to convert `LowLFHE` operators to function call to the /// `ConcreteCAPI` std::unique_ptr> createConvertLowLFHEToConcreteCAPIPass(); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Conversion/LowLFHEUnparametrize/Pass.h b/compiler/include/concretelang/Conversion/LowLFHEUnparametrize/Pass.h similarity index 66% rename from compiler/include/zamalang/Conversion/LowLFHEUnparametrize/Pass.h rename to compiler/include/concretelang/Conversion/LowLFHEUnparametrize/Pass.h index 5d64f5a08..aeba5e507 100644 --- a/compiler/include/zamalang/Conversion/LowLFHEUnparametrize/Pass.h +++ b/compiler/include/concretelang/Conversion/LowLFHEUnparametrize/Pass.h @@ -2,16 +2,16 @@ // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_CONVERSION_LOWLFHEUNPARAMETRIZE_PASS_H_ -#define ZAMALANG_CONVERSION_LOWLFHEUNPARAMETRIZE_PASS_H_ +#ifndef CONCRETELANG_CONVERSION_LOWLFHEUNPARAMETRIZE_PASS_H_ +#define CONCRETELANG_CONVERSION_LOWLFHEUNPARAMETRIZE_PASS_H_ #include "mlir/Pass/Pass.h" namespace mlir { -namespace zamalang { +namespace concretelang { std::unique_ptr> createConvertLowLFHEUnparametrizePass(); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Conversion/MLIRLowerableDialectsToLLVM/Pass.h b/compiler/include/concretelang/Conversion/MLIRLowerableDialectsToLLVM/Pass.h similarity index 70% rename from compiler/include/zamalang/Conversion/MLIRLowerableDialectsToLLVM/Pass.h rename to compiler/include/concretelang/Conversion/MLIRLowerableDialectsToLLVM/Pass.h index b7aa5f882..5906beff7 100644 --- a/compiler/include/zamalang/Conversion/MLIRLowerableDialectsToLLVM/Pass.h +++ b/compiler/include/concretelang/Conversion/MLIRLowerableDialectsToLLVM/Pass.h @@ -2,18 +2,18 @@ // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_CONVERSION_MLIRLOWERABLEDIALECTSTOLLVM_PASS_H_ -#define ZAMALANG_CONVERSION_MLIRLOWERABLEDIALECTSTOLLVM_PASS_H_ +#ifndef CONCRETELANG_CONVERSION_MLIRLOWERABLEDIALECTSTOLLVM_PASS_H_ +#define CONCRETELANG_CONVERSION_MLIRLOWERABLEDIALECTSTOLLVM_PASS_H_ #include "mlir/Pass/Pass.h" namespace mlir { template class OperationPass; -namespace zamalang { +namespace concretelang { /// Create a pass to convert MLIR lowerable dialects to LLVM. std::unique_ptr> createConvertMLIRLowerableDialectsToLLVMPass(); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Conversion/MidLFHEGlobalParametrization/Pass.h b/compiler/include/concretelang/Conversion/MidLFHEGlobalParametrization/Pass.h similarity index 58% rename from compiler/include/zamalang/Conversion/MidLFHEGlobalParametrization/Pass.h rename to compiler/include/concretelang/Conversion/MidLFHEGlobalParametrization/Pass.h index 1fde777a7..54b00c839 100644 --- a/compiler/include/zamalang/Conversion/MidLFHEGlobalParametrization/Pass.h +++ b/compiler/include/concretelang/Conversion/MidLFHEGlobalParametrization/Pass.h @@ -2,20 +2,20 @@ // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_CONVERSION_MIDLFHEGLOBALPARAMETRIZATION_PASS_H_ -#define ZAMALANG_CONVERSION_MIDLFHEGLOBALPARAMETRIZATION_PASS_H_ +#ifndef CONCRETELANG_CONVERSION_MIDLFHEGLOBALPARAMETRIZATION_PASS_H_ +#define CONCRETELANG_CONVERSION_MIDLFHEGLOBALPARAMETRIZATION_PASS_H_ #include "mlir/Pass/Pass.h" -#include "zamalang/Conversion/Utils/GlobalFHEContext.h" +#include "concretelang/Conversion/Utils/GlobalFHEContext.h" namespace mlir { -namespace zamalang { +namespace concretelang { /// Create a pass to inject fhe parameters to the MidLFHE types and operators. std::unique_ptr> createConvertMidLFHEGlobalParametrizationPass( - mlir::zamalang::V0FHEContext &fheContext); -} // namespace zamalang + mlir::concretelang::V0FHEContext &fheContext); +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/CMakeLists.txt b/compiler/include/concretelang/Conversion/MidLFHEToLowLFHE/CMakeLists.txt similarity index 65% rename from compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/CMakeLists.txt rename to compiler/include/concretelang/Conversion/MidLFHEToLowLFHE/CMakeLists.txt index 613a03e97..1fb65dc4a 100644 --- a/compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/CMakeLists.txt +++ b/compiler/include/concretelang/Conversion/MidLFHEToLowLFHE/CMakeLists.txt @@ -2,4 +2,4 @@ set(LLVM_TARGET_DEFINITIONS Patterns.td) mlir_tablegen(Patterns.h.inc -gen-rewriters -name MidLFHE) add_public_tablegen_target(MidLFHEToLowLFHEPatternsIncGen) -add_zamalang_doc(Patterns MidLFHEToLowLFHEPatterns zamalang/ -gen-pass-doc) +add_concretelang_doc(Patterns MidLFHEToLowLFHEPatterns concretelang/ -gen-pass-doc) diff --git a/compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/Pass.h b/compiler/include/concretelang/Conversion/MidLFHEToLowLFHE/Pass.h similarity index 70% rename from compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/Pass.h rename to compiler/include/concretelang/Conversion/MidLFHEToLowLFHE/Pass.h index b2064c808..de16b4181 100644 --- a/compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/Pass.h +++ b/compiler/include/concretelang/Conversion/MidLFHEToLowLFHE/Pass.h @@ -2,16 +2,16 @@ // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_CONVERSION_MIDLFHETOLOWLFHE_PASS_H_ -#define ZAMALANG_CONVERSION_MIDLFHETOLOWLFHE_PASS_H_ +#ifndef CONCRETELANG_CONVERSION_MIDLFHETOLOWLFHE_PASS_H_ +#define CONCRETELANG_CONVERSION_MIDLFHETOLOWLFHE_PASS_H_ #include "mlir/Pass/Pass.h" namespace mlir { -namespace zamalang { +namespace concretelang { /// Create a pass to convert `MidLFHE` dialect to `LowLFHE` dialect. std::unique_ptr> createConvertMidLFHEToLowLFHEPass(); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/Patterns.h b/compiler/include/concretelang/Conversion/MidLFHEToLowLFHE/Patterns.h similarity index 91% rename from compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/Patterns.h rename to compiler/include/concretelang/Conversion/MidLFHEToLowLFHE/Patterns.h index 81db9297c..83dd3f0f9 100644 --- a/compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/Patterns.h +++ b/compiler/include/concretelang/Conversion/MidLFHEToLowLFHE/Patterns.h @@ -1,17 +1,17 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_CONVERSION_MIDLFHETOLOWLFHE_PATTERNS_H_ -#define ZAMALANG_CONVERSION_MIDLFHETOLOWLFHE_PATTERNS_H_ +#ifndef CONCRETELANG_CONVERSION_MIDLFHETOLOWLFHE_PATTERNS_H_ +#define CONCRETELANG_CONVERSION_MIDLFHETOLOWLFHE_PATTERNS_H_ #include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/IR/Builders.h" #include "mlir/IR/PatternMatch.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEOps.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEOps.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEOps.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEOps.h" namespace mlir { -namespace zamalang { +namespace concretelang { using LowLFHE::CleartextType; using LowLFHE::LweCiphertextType; @@ -116,14 +116,14 @@ mlir::Value createAddPlainLweCiphertextWithGlwe( // encode int into plaintext mlir::Value encoded = rewriter - .create(loc, encoded_type, arg1) + .create(loc, encoded_type, arg1) .plaintext(); // convert result type LweCiphertextType lwe_type = convertTypeToLWE(rewriter.getContext(), result.getType()); // replace op using the encoded plaintext instead of int auto op = - rewriter.create( + rewriter.create( loc, lwe_type, arg0, encoded); return op.getODSResults(0).front(); } @@ -142,7 +142,7 @@ mlir::Value createSubIntLweCiphertext(mlir::PatternRewriter &rewriter, auto arg1_type = arg1.getType(); auto negated_arg1 = rewriter - .create( + .create( loc, convertTypeToLWE(rewriter.getContext(), arg1_type), arg1) .result(); return createAddPlainLweCiphertextWithGlwe(rewriter, loc, negated_arg1, arg0, @@ -154,7 +154,7 @@ mlir::Value createNegLweCiphertext(mlir::PatternRewriter &rewriter, mlir::OpResult result) { auto arg0_type = arg0.getType(); auto negated = - rewriter.create( + rewriter.create( loc, convertTypeToLWE(rewriter.getContext(), arg0_type), arg0); return negated.getODSResults(0).front(); } @@ -168,7 +168,7 @@ mlir::Value createMulClearLweCiphertext(mlir::PatternRewriter &rewriter, convertCleartextTypeFromType(rewriter.getContext(), inType); // encode int into plaintext mlir::Value encoded = rewriter - .create( + .create( loc, encoded_type, arg1) .cleartext(); // convert result type @@ -176,7 +176,7 @@ mlir::Value createMulClearLweCiphertext(mlir::PatternRewriter &rewriter, LweCiphertextType lwe_type = convertTypeToLWE(rewriter.getContext(), resType); // replace op using the encoded plaintext instead of int auto op = - rewriter.create( + rewriter.create( loc, lwe_type, arg0, encoded); return op.getODSResults(0).front(); } @@ -236,7 +236,7 @@ mlir::Value createPBS(mlir::PatternRewriter &rewriter, mlir::Location loc, mlir::IntegerAttr precision = rewriter.getI32IntegerAttr(lwe_type.getP()); mlir::Value accumulator = rewriter - .create( + .create( loc, LowLFHE::GlweCiphertextType::get(rewriter.getContext()), table, polynomialSize, glweDimension, precision) .result(); @@ -255,7 +255,7 @@ mlir::Value createPBS(mlir::PatternRewriter &rewriter, mlir::Location loc, convertTypeToLWE(rewriter.getContext(), result.getType()); mlir::Value keyswitched = rewriter - .create(loc, ksOutType, + .create(loc, ksOutType, ksArgs, ksAttrs) .result(); @@ -275,18 +275,18 @@ mlir::Value createPBS(mlir::PatternRewriter &rewriter, mlir::Location loc, }; mlir::Value bootstrapped = rewriter - .create(loc, lwe_type, + .create(loc, lwe_type, bsArgs, bsAttrs) .result(); return bootstrapped; } -} // namespace zamalang +} // namespace concretelang } // namespace mlir namespace { -#include "zamalang/Conversion/MidLFHEToLowLFHE/Patterns.h.inc" +#include "concretelang/Conversion/MidLFHEToLowLFHE/Patterns.h.inc" } void populateWithGeneratedMidLFHEToLowLFHE(mlir::RewritePatternSet &patterns) { diff --git a/compiler/include/concretelang/Conversion/MidLFHEToLowLFHE/Patterns.td b/compiler/include/concretelang/Conversion/MidLFHEToLowLFHE/Patterns.td new file mode 100644 index 000000000..5fe65882b --- /dev/null +++ b/compiler/include/concretelang/Conversion/MidLFHEToLowLFHE/Patterns.td @@ -0,0 +1,51 @@ +#ifndef CONCRETELANG_CONVERSION_MIDLFHETOLOWLFHE_PATTERNS +#define CONCRETELANG_CONVERSION_MIDLFHETOLOWLFHE_PATTERNS + +include "mlir/Pass/PassBase.td" +include "mlir/Dialect/StandardOps/IR/Ops.td" +include "concretelang/Dialect/LowLFHE/IR/LowLFHEOps.td" +include "concretelang/Dialect/MidLFHE/IR/MidLFHEOps.td" + +def createZeroLWEOp : NativeCodeCall<"mlir::concretelang::createZeroLWEOpFromMidLFHE($_builder, $_loc, $0)">; + +def ZeroGLWEPattern : Pat< + (ZeroGLWEOp:$result), + (createZeroLWEOp $result)>; + +def createAddLWEOp : NativeCodeCall<"mlir::concretelang::createLowLFHEOpFromMidLFHE($_builder, $_loc, $0, $1, $2)">; + +def AddGLWEPattern : Pat< + (AddGLWEOp:$result $arg0, $arg1), + (createAddLWEOp $arg0, $arg1, $result)>; + +def createAddPlainLweOp : NativeCodeCall<"mlir::concretelang::createAddPlainLweCiphertext($_builder, $_loc, $0, $1, $2)">; + +def AddGLWEIntPattern : Pat< + (AddGLWEIntOp:$result $arg0, $arg1), + (createAddPlainLweOp $arg0, $arg1, $result)>; + +def createMulClearLweOp : NativeCodeCall<"mlir::concretelang::createMulClearLweCiphertext($_builder, $_loc, $0, $1, $2)">; + +def MulGLWEIntPattern : Pat< + (MulGLWEIntOp:$result $arg0, $arg1), + (createMulClearLweOp $arg0, $arg1, $result)>; + +def createSubIntLweOp : NativeCodeCall<"mlir::concretelang::createSubIntLweCiphertext($_builder, $_loc, $0, $1, $2)">; + +def SubIntGLWEPattern : Pat< + (SubIntGLWEOp:$result $arg0, $arg1), + (createSubIntLweOp $arg0, $arg1, $result)>; + +def createNegLweOp : NativeCodeCall<"mlir::concretelang::createNegLweCiphertext($_builder, $_loc, $0, $1)">; + +def NegGLWEPattern : Pat< + (NegGLWEOp:$result $arg0), + (createNegLweOp $arg0, $result)>; + +def createPBS : NativeCodeCall<"mlir::concretelang::createPBS($_builder, $_loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9)">; + +def ApplyLookupTableGLWEPattern : Pat< + (ApplyLookupTable:$result $ct, $table, $glweDimension, $polynomialSize, $levelKS, $baseLogKS, $levelBS, $baseLogBS, $outputDimensionKS), + (createPBS $ct, $table, $glweDimension, $polynomialSize, $levelKS, $baseLogKS, $levelBS, $baseLogBS, $outputDimensionKS, $result)>; + +#endif diff --git a/compiler/include/concretelang/Conversion/Passes.h b/compiler/include/concretelang/Conversion/Passes.h new file mode 100644 index 000000000..d08161681 --- /dev/null +++ b/compiler/include/concretelang/Conversion/Passes.h @@ -0,0 +1,26 @@ +// Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. +// See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. + +#ifndef CONCRETELANG_TRANSFORMS_PASSES_H +#define CONCRETELANG_TRANSFORMS_PASSES_H + +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" +#include "mlir/Dialect/Linalg/IR/LinalgOps.h" +#include "mlir/Dialect/SCF/SCF.h" +#include "mlir/Dialect/StandardOps/IR/Ops.h" + +#include "concretelang/Conversion/HLFHETensorOpsToLinalg/Pass.h" +#include "concretelang/Conversion/HLFHEToMidLFHE/Pass.h" +#include "concretelang/Conversion/LowLFHEToConcreteCAPI/Pass.h" +#include "concretelang/Conversion/LowLFHEUnparametrize/Pass.h" +#include "concretelang/Conversion/MLIRLowerableDialectsToLLVM/Pass.h" +#include "concretelang/Conversion/MidLFHEGlobalParametrization/Pass.h" +#include "concretelang/Conversion/MidLFHEToLowLFHE/Pass.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEDialect.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.h" + +#define GEN_PASS_CLASSES +#include "concretelang/Conversion/Passes.h.inc" + +#endif diff --git a/compiler/include/zamalang/Conversion/Passes.td b/compiler/include/concretelang/Conversion/Passes.td similarity index 63% rename from compiler/include/zamalang/Conversion/Passes.td rename to compiler/include/concretelang/Conversion/Passes.td index b15ce5c9f..cd37bf943 100644 --- a/compiler/include/zamalang/Conversion/Passes.td +++ b/compiler/include/concretelang/Conversion/Passes.td @@ -1,52 +1,52 @@ -#ifndef ZAMALANG_CONVERSION_PASSES -#define ZAMALANG_CONVERSION_PASSES +#ifndef CONCRETELANG_CONVERSION_PASSES +#define CONCRETELANG_CONVERSION_PASSES include "mlir/Pass/PassBase.td" def HLFHETensorOpsToLinalg : FunctionPass<"hlfhe-tensor-ops-to-linalg"> { let summary = "Lowers tensor operations of HLFHE dialect to linalg.generic"; - let constructor = "mlir::zamalang::createConvertHLFHETensorOpsToLinalg()"; + let constructor = "mlir::concretelang::createConvertHLFHETensorOpsToLinalg()"; let dependentDialects = ["mlir::linalg::LinalgDialect"]; } def HLFHEToMidLFHE : Pass<"hlfhe-to-midlfhe", "mlir::ModuleOp"> { let summary = "Lowers operations from the HLFHE dialect to MidLFHE"; let description = [{ Lowers operations from the HLFHE dialect to Std + Math }]; - let constructor = "mlir::zamalang::createConvertHLFHEToMidLFHEPass()"; + let constructor = "mlir::concretelang::createConvertHLFHEToMidLFHEPass()"; let options = []; let dependentDialects = ["mlir::linalg::LinalgDialect"]; } def MidLFHEGlobalParametrization : Pass<"midlfhe-global-parametrization", "mlir::ModuleOp"> { let summary = "Inject global fhe parameters to the MidLFHE dialect"; - let constructor = "mlir::zamalang::createConvertMidLFHEToLowLFHEPass()"; + let constructor = "mlir::concretelang::createConvertMidLFHEToLowLFHEPass()"; let options = []; - let dependentDialects = ["mlir::zamalang::MidLFHE::MidLFHEDialect"]; + let dependentDialects = ["mlir::concretelang::MidLFHE::MidLFHEDialect"]; } def MidLFHEToLowLFHE : Pass<"midlfhe-to-lowlfhe", "mlir::ModuleOp"> { let summary = "Lowers operations from the MidLFHE dialect to LowLFHE"; let description = [{ Lowers operations from the MidLFHE dialect to LowLFHE }]; - let constructor = "mlir::zamalang::createConvertMidLFHEToLowLFHEPass()"; + let constructor = "mlir::concretelang::createConvertMidLFHEToLowLFHEPass()"; let options = []; let dependentDialects = ["mlir::linalg::LinalgDialect"]; } def LowLFHEToConcreteCAPI : Pass<"lowlfhe-to-concrete-c-api", "mlir::ModuleOp"> { let summary = "Lower operations from the LowLFHE dialect to std with function call to the Concrete C API"; - let constructor = "mlir::zamalang::createConvertLowLFHEToConcreteCAPIPass()"; - let dependentDialects = ["mlir::zamalang::LowLFHE::LowLFHEDialect", "mlir::StandardOpsDialect", "mlir::memref::MemRefDialect"]; + let constructor = "mlir::concretelang::createConvertLowLFHEToConcreteCAPIPass()"; + let dependentDialects = ["mlir::concretelang::LowLFHE::LowLFHEDialect", "mlir::StandardOpsDialect", "mlir::memref::MemRefDialect"]; } def LowLFHEUnparametrize : Pass<"lowlfhe-unparametrize", "mlir::ModuleOp"> { let summary = "Unparametrize LowLFHE types and remove unrealized_conversion_cast"; - let constructor = "mlir::zamalang::createConvertLowLFHEToConcreteCAPIPass()"; - let dependentDialects = ["mlir::zamalang::LowLFHE::LowLFHEDialect", "mlir::StandardOpsDialect", "mlir::memref::MemRefDialect"]; + let constructor = "mlir::concretelang::createConvertLowLFHEToConcreteCAPIPass()"; + let dependentDialects = ["mlir::concretelang::LowLFHE::LowLFHEDialect", "mlir::StandardOpsDialect", "mlir::memref::MemRefDialect"]; } def MLIRLowerableDialectsToLLVM : Pass<"mlir-lowerable-dialects-to-llvm", "mlir::ModuleOp"> { let summary = "Lowers operations from MLIR lowerable dialects to LLVM"; - let constructor = "mlir::zamalang::createConvertMLIRLowerableDialectsToLLVMPass()"; + let constructor = "mlir::concretelang::createConvertMLIRLowerableDialectsToLLVMPass()"; let dependentDialects = ["mlir::StandardOpsDialect", "mlir::arith::ArithmeticDialect", "mlir::scf::SCFDialect", "mlir::LLVM::LLVMDialect"]; let options = []; } diff --git a/compiler/include/zamalang/Conversion/Utils/GenericOpTypeConversionPattern.h b/compiler/include/concretelang/Conversion/Utils/GenericOpTypeConversionPattern.h similarity index 90% rename from compiler/include/zamalang/Conversion/Utils/GenericOpTypeConversionPattern.h rename to compiler/include/concretelang/Conversion/Utils/GenericOpTypeConversionPattern.h index a6e10a4d3..d850d6b49 100644 --- a/compiler/include/zamalang/Conversion/Utils/GenericOpTypeConversionPattern.h +++ b/compiler/include/concretelang/Conversion/Utils/GenericOpTypeConversionPattern.h @@ -1,14 +1,14 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_CONVERSION_GENERICOPTYPECONVERSIONPATTERN_H_ -#define ZAMALANG_CONVERSION_GENERICOPTYPECONVERSIONPATTERN_H_ +#ifndef CONCRETELANG_CONVERSION_GENERICOPTYPECONVERSIONPATTERN_H_ +#define CONCRETELANG_CONVERSION_GENERICOPTYPECONVERSIONPATTERN_H_ #include "mlir/Dialect/Linalg/IR/LinalgOps.h" #include "mlir/IR/PatternMatch.h" namespace mlir { -namespace zamalang { +namespace concretelang { template struct GenericTypeConverterPattern : public mlir::OpRewritePattern { GenericTypeConverterPattern(mlir::MLIRContext *context, @@ -57,7 +57,7 @@ void addDynamicallyLegalTypeOp(mlir::ConversionTarget &target, }); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Conversion/Utils/GlobalFHEContext.h b/compiler/include/concretelang/Conversion/Utils/GlobalFHEContext.h similarity index 88% rename from compiler/include/zamalang/Conversion/Utils/GlobalFHEContext.h rename to compiler/include/concretelang/Conversion/Utils/GlobalFHEContext.h index 8a780bb65..cab2252fe 100644 --- a/compiler/include/zamalang/Conversion/Utils/GlobalFHEContext.h +++ b/compiler/include/concretelang/Conversion/Utils/GlobalFHEContext.h @@ -1,12 +1,12 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_CONVERSION_GLOBALFHECONTEXT_H_ -#define ZAMALANG_CONVERSION_GLOBALFHECONTEXT_H_ +#ifndef CONCRETELANG_CONVERSION_GLOBALFHECONTEXT_H_ +#define CONCRETELANG_CONVERSION_GLOBALFHECONTEXT_H_ #include namespace mlir { -namespace zamalang { +namespace concretelang { struct V0FHEConstraint { size_t norm2; @@ -45,7 +45,7 @@ struct V0FHEContext { V0FHEConstraint constraint; V0Parameter parameter; }; -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif diff --git a/compiler/include/zamalang/Conversion/Utils/RegionOpTypeConverterPattern.h b/compiler/include/concretelang/Conversion/Utils/RegionOpTypeConverterPattern.h similarity index 100% rename from compiler/include/zamalang/Conversion/Utils/RegionOpTypeConverterPattern.h rename to compiler/include/concretelang/Conversion/Utils/RegionOpTypeConverterPattern.h diff --git a/compiler/include/zamalang/Conversion/Utils/TensorOpTypeConversion.h b/compiler/include/concretelang/Conversion/Utils/TensorOpTypeConversion.h similarity index 89% rename from compiler/include/zamalang/Conversion/Utils/TensorOpTypeConversion.h rename to compiler/include/concretelang/Conversion/Utils/TensorOpTypeConversion.h index d2dc02771..1fb7aff77 100644 --- a/compiler/include/zamalang/Conversion/Utils/TensorOpTypeConversion.h +++ b/compiler/include/concretelang/Conversion/Utils/TensorOpTypeConversion.h @@ -1,17 +1,17 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_CONVERSION_TENSOROPTYPECONVERSIONPATTERN_H_ -#define ZAMALANG_CONVERSION_TENSOROPTYPECONVERSIONPATTERN_H_ +#ifndef CONCRETELANG_CONVERSION_TENSOROPTYPECONVERSIONPATTERN_H_ +#define CONCRETELANG_CONVERSION_TENSOROPTYPECONVERSIONPATTERN_H_ #include "mlir/Dialect/Linalg/IR/LinalgOps.h" #include "mlir/Dialect/Tensor/IR/Tensor.h" #include "mlir/Transforms/DialectConversion.h" -#include "zamalang/Conversion/Utils/GenericOpTypeConversionPattern.h" +#include "concretelang/Conversion/Utils/GenericOpTypeConversionPattern.h" namespace mlir { -namespace zamalang { +namespace concretelang { inline void populateWithTensorTypeConverterPatterns(mlir::RewritePatternSet &patterns, @@ -48,7 +48,7 @@ populateWithTensorTypeConverterPatterns(mlir::RewritePatternSet &patterns, addDynamicallyLegalTypeOp(target, typeConverter); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Dialect/CMakeLists.txt b/compiler/include/concretelang/Dialect/CMakeLists.txt similarity index 100% rename from compiler/include/zamalang/Dialect/CMakeLists.txt rename to compiler/include/concretelang/Dialect/CMakeLists.txt diff --git a/compiler/include/zamalang/Dialect/HLFHE/Analysis/CMakeLists.txt b/compiler/include/concretelang/Dialect/HLFHE/Analysis/CMakeLists.txt similarity index 100% rename from compiler/include/zamalang/Dialect/HLFHE/Analysis/CMakeLists.txt rename to compiler/include/concretelang/Dialect/HLFHE/Analysis/CMakeLists.txt diff --git a/compiler/include/zamalang/Dialect/HLFHE/Analysis/MANP.h b/compiler/include/concretelang/Dialect/HLFHE/Analysis/MANP.h similarity index 74% rename from compiler/include/zamalang/Dialect/HLFHE/Analysis/MANP.h rename to compiler/include/concretelang/Dialect/HLFHE/Analysis/MANP.h index 8cefb8924..6670cbd5d 100644 --- a/compiler/include/zamalang/Dialect/HLFHE/Analysis/MANP.h +++ b/compiler/include/concretelang/Dialect/HLFHE/Analysis/MANP.h @@ -1,19 +1,19 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_HLFHE_ANALYSIS_MANP_H -#define ZAMALANG_DIALECT_HLFHE_ANALYSIS_MANP_H +#ifndef CONCRETELANG_DIALECT_HLFHE_ANALYSIS_MANP_H +#define CONCRETELANG_DIALECT_HLFHE_ANALYSIS_MANP_H #include #include namespace mlir { -namespace zamalang { +namespace concretelang { std::unique_ptr createMANPPass(bool debug = false); std::unique_ptr createMaxMANPPass(std::function setMax); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif diff --git a/compiler/include/zamalang/Dialect/HLFHE/Analysis/MANP.td b/compiler/include/concretelang/Dialect/HLFHE/Analysis/MANP.td similarity index 97% rename from compiler/include/zamalang/Dialect/HLFHE/Analysis/MANP.td rename to compiler/include/concretelang/Dialect/HLFHE/Analysis/MANP.td index 80e1cbf21..20a5d66e8 100644 --- a/compiler/include/zamalang/Dialect/HLFHE/Analysis/MANP.td +++ b/compiler/include/concretelang/Dialect/HLFHE/Analysis/MANP.td @@ -1,5 +1,5 @@ -#ifndef ZAMALANG_DIALECT_HLFHE_ANALYSIS_MANP -#define ZAMALANG_DIALECT_HLFHE_ANALYSIS_MANP +#ifndef CONCRETELANG_DIALECT_HLFHE_ANALYSIS_MANP +#define CONCRETELANG_DIALECT_HLFHE_ANALYSIS_MANP include "mlir/Pass/PassBase.td" diff --git a/compiler/include/zamalang/Dialect/HLFHE/CMakeLists.txt b/compiler/include/concretelang/Dialect/HLFHE/CMakeLists.txt similarity index 100% rename from compiler/include/zamalang/Dialect/HLFHE/CMakeLists.txt rename to compiler/include/concretelang/Dialect/HLFHE/CMakeLists.txt diff --git a/compiler/include/zamalang/Dialect/HLFHE/IR/CMakeLists.txt b/compiler/include/concretelang/Dialect/HLFHE/IR/CMakeLists.txt similarity index 70% rename from compiler/include/zamalang/Dialect/HLFHE/IR/CMakeLists.txt rename to compiler/include/concretelang/Dialect/HLFHE/IR/CMakeLists.txt index 8387409f2..be658650e 100644 --- a/compiler/include/zamalang/Dialect/HLFHE/IR/CMakeLists.txt +++ b/compiler/include/concretelang/Dialect/HLFHE/IR/CMakeLists.txt @@ -8,6 +8,6 @@ mlir_tablegen(HLFHEOpsDialect.cpp.inc -gen-dialect-defs -dialect=HLFHE) add_public_tablegen_target(MLIRHLFHEOpsIncGen) add_dependencies(mlir-headers MLIRHLFHEOpsIncGen) -add_zamalang_doc(HLFHEDialect HLFHEDialect zamalang/ -gen-dialect-doc) -add_zamalang_doc(HLFHEOps HLFHEOps zamalang/ -gen-op-doc) -add_zamalang_doc(HLFHETypes HLFHETypes zamalang/ -gen-typedef-doc) +add_concretelang_doc(HLFHEDialect HLFHEDialect concretelang/ -gen-dialect-doc) +add_concretelang_doc(HLFHEOps HLFHEOps concretelang/ -gen-op-doc) +add_concretelang_doc(HLFHETypes HLFHETypes concretelang/ -gen-typedef-doc) diff --git a/compiler/include/zamalang/Dialect/HLFHE/IR/HLFHEDialect.h b/compiler/include/concretelang/Dialect/HLFHE/IR/HLFHEDialect.h similarity index 67% rename from compiler/include/zamalang/Dialect/HLFHE/IR/HLFHEDialect.h rename to compiler/include/concretelang/Dialect/HLFHE/IR/HLFHEDialect.h index 9c1ba6770..6c8ccee95 100644 --- a/compiler/include/zamalang/Dialect/HLFHE/IR/HLFHEDialect.h +++ b/compiler/include/concretelang/Dialect/HLFHE/IR/HLFHEDialect.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_HLFHE_IR_HLFHEDIALECT_H -#define ZAMALANG_DIALECT_HLFHE_IR_HLFHEDIALECT_H +#ifndef CONCRETELANG_DIALECT_HLFHE_IR_HLFHEDIALECT_H +#define CONCRETELANG_DIALECT_HLFHE_IR_HLFHEDIALECT_H #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" @@ -11,6 +11,6 @@ #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEOpsDialect.h.inc" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOpsDialect.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/HLFHE/IR/HLFHEDialect.td b/compiler/include/concretelang/Dialect/HLFHE/IR/HLFHEDialect.td similarity index 80% rename from compiler/include/zamalang/Dialect/HLFHE/IR/HLFHEDialect.td rename to compiler/include/concretelang/Dialect/HLFHE/IR/HLFHEDialect.td index 21092c681..76c83e5b9 100644 --- a/compiler/include/zamalang/Dialect/HLFHE/IR/HLFHEDialect.td +++ b/compiler/include/concretelang/Dialect/HLFHE/IR/HLFHEDialect.td @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef ZAMALANG_DIALECT_HLFHE_IR_HLFHE_DIALECT -#define ZAMALANG_DIALECT_HLFHE_IR_HLFHE_DIALECT +#ifndef CONCRETELANG_DIALECT_HLFHE_IR_HLFHE_DIALECT +#define CONCRETELANG_DIALECT_HLFHE_IR_HLFHE_DIALECT include "mlir/IR/OpBase.td" @@ -17,7 +17,7 @@ def HLFHE_Dialect : Dialect { let description = [{ A dialect for representation of high level operation on fully homomorphic ciphertext. }]; - let cppNamespace = "::mlir::zamalang::HLFHE"; + let cppNamespace = "::mlir::concretelang::HLFHE"; } #endif diff --git a/compiler/include/zamalang/Dialect/HLFHE/IR/HLFHEOps.h b/compiler/include/concretelang/Dialect/HLFHE/IR/HLFHEOps.h similarity index 85% rename from compiler/include/zamalang/Dialect/HLFHE/IR/HLFHEOps.h rename to compiler/include/concretelang/Dialect/HLFHE/IR/HLFHEOps.h index 5c1a02fee..1c9993b00 100644 --- a/compiler/include/zamalang/Dialect/HLFHE/IR/HLFHEOps.h +++ b/compiler/include/concretelang/Dialect/HLFHE/IR/HLFHEOps.h @@ -1,18 +1,18 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_HLFHE_IR_HLFHEOPS_H -#define ZAMALANG_DIALECT_HLFHE_IR_HLFHEOPS_H +#ifndef CONCRETELANG_DIALECT_HLFHE_IR_HLFHEOPS_H +#define CONCRETELANG_DIALECT_HLFHE_IR_HLFHEOPS_H #include #include #include #include -#include "zamalang/Dialect/HLFHE/IR/HLFHETypes.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHETypes.h" namespace mlir { -namespace zamalang { +namespace concretelang { namespace HLFHE { bool verifyEncryptedIntegerInputAndResultConsistency( @@ -39,10 +39,10 @@ void emitErrorBadLutSize(Op &op, std::string lutName, std::string inputName, } } // namespace HLFHE -} // namespace zamalang +} // namespace concretelang } // namespace mlir #define GET_OP_CLASSES -#include "zamalang/Dialect/HLFHE/IR/HLFHEOps.h.inc" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOps.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/HLFHE/IR/HLFHEOps.td b/compiler/include/concretelang/Dialect/HLFHE/IR/HLFHEOps.td similarity index 83% rename from compiler/include/zamalang/Dialect/HLFHE/IR/HLFHEOps.td rename to compiler/include/concretelang/Dialect/HLFHE/IR/HLFHEOps.td index 8bc6639ed..c2d26c9d5 100644 --- a/compiler/include/zamalang/Dialect/HLFHE/IR/HLFHEOps.td +++ b/compiler/include/concretelang/Dialect/HLFHE/IR/HLFHEOps.td @@ -6,14 +6,14 @@ // //===----------------------------------------------------------------------===// -#ifndef ZAMALANG_DIALECT_HLFHE_IR_HLFHE_OPS -#define ZAMALANG_DIALECT_HLFHE_IR_HLFHE_OPS +#ifndef CONCRETELANG_DIALECT_HLFHE_IR_HLFHE_OPS +#define CONCRETELANG_DIALECT_HLFHE_IR_HLFHE_OPS include "mlir/Interfaces/SideEffectInterfaces.td" include "mlir/Interfaces/ControlFlowInterfaces.td" -include "zamalang/Dialect/HLFHE/IR/HLFHEDialect.td" -include "zamalang/Dialect/HLFHE/IR/HLFHETypes.td" +include "concretelang/Dialect/HLFHE/IR/HLFHEDialect.td" +include "concretelang/Dialect/HLFHE/IR/HLFHETypes.td" class HLFHE_Op traits = []> : Op; @@ -40,7 +40,7 @@ def AddEintIntOp : HLFHE_Op<"add_eint_int"> { ]; let verifier = [{ - return ::mlir::zamalang::HLFHE::verifyAddEintIntOp(*this); + return ::mlir::concretelang::HLFHE::verifyAddEintIntOp(*this); }]; } @@ -58,7 +58,7 @@ def AddEintOp : HLFHE_Op<"add_eint"> { ]; let verifier = [{ - return ::mlir::zamalang::HLFHE::verifyAddEintOp(*this); + return ::mlir::concretelang::HLFHE::verifyAddEintOp(*this); }]; } @@ -76,7 +76,7 @@ def SubIntEintOp : HLFHE_Op<"sub_int_eint"> { ]; let verifier = [{ - return ::mlir::zamalang::HLFHE::verifySubIntEintOp(*this); + return ::mlir::concretelang::HLFHE::verifySubIntEintOp(*this); }]; } @@ -94,7 +94,7 @@ def NegEintOp : HLFHE_Op<"neg_eint"> { ]; let verifier = [{ - return ::mlir::zamalang::HLFHE::verifyNegEintOp(*this); + return ::mlir::concretelang::HLFHE::verifyNegEintOp(*this); }]; } @@ -112,7 +112,7 @@ def MulEintIntOp : HLFHE_Op<"mul_eint_int"> { ]; let verifier = [{ - return ::mlir::zamalang::HLFHE::verifyMulEintIntOp(*this); + return ::mlir::concretelang::HLFHE::verifyMulEintIntOp(*this); }]; } @@ -125,7 +125,7 @@ def ApplyLookupTableEintOp : HLFHE_Op<"apply_lookup_table"> { let results = (outs EncryptedIntegerType); let verifier = [{ - return ::mlir::zamalang::HLFHE::verifyApplyLookupTable(*this); + return ::mlir::concretelang::HLFHE::verifyApplyLookupTable(*this); }]; } diff --git a/compiler/include/zamalang/Dialect/HLFHE/IR/HLFHETypes.h b/compiler/include/concretelang/Dialect/HLFHE/IR/HLFHETypes.h similarity index 69% rename from compiler/include/zamalang/Dialect/HLFHE/IR/HLFHETypes.h rename to compiler/include/concretelang/Dialect/HLFHE/IR/HLFHETypes.h index d5e3caf6b..80d7fd1e0 100644 --- a/compiler/include/zamalang/Dialect/HLFHE/IR/HLFHETypes.h +++ b/compiler/include/concretelang/Dialect/HLFHE/IR/HLFHETypes.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_HLFHE_IR_HLFHETYPES_H -#define ZAMALANG_DIALECT_HLFHE_IR_HLFHETYPES_H +#ifndef CONCRETELANG_DIALECT_HLFHE_IR_HLFHETYPES_H +#define CONCRETELANG_DIALECT_HLFHE_IR_HLFHETYPES_H #include "llvm/ADT/TypeSwitch.h" #include @@ -10,6 +10,6 @@ #include #define GET_TYPEDEF_CLASSES -#include "zamalang/Dialect/HLFHE/IR/HLFHEOpsTypes.h.inc" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOpsTypes.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/HLFHE/IR/HLFHETypes.td b/compiler/include/concretelang/Dialect/HLFHE/IR/HLFHETypes.td similarity index 85% rename from compiler/include/zamalang/Dialect/HLFHE/IR/HLFHETypes.td rename to compiler/include/concretelang/Dialect/HLFHE/IR/HLFHETypes.td index 903d820d3..3716a0878 100644 --- a/compiler/include/zamalang/Dialect/HLFHE/IR/HLFHETypes.td +++ b/compiler/include/concretelang/Dialect/HLFHE/IR/HLFHETypes.td @@ -1,7 +1,7 @@ -#ifndef ZAMALANG_DIALECT_HLFHE_IR_HLFHE_TYPES -#define ZAMALANG_DIALECT_HLFHE_IR_HLFHE_TYPES +#ifndef CONCRETELANG_DIALECT_HLFHE_IR_HLFHE_TYPES +#define CONCRETELANG_DIALECT_HLFHE_IR_HLFHE_TYPES -include "zamalang/Dialect/HLFHE/IR/HLFHEDialect.td" +include "concretelang/Dialect/HLFHE/IR/HLFHEDialect.td" include "mlir/IR/BuiltinTypes.td" class HLFHE_Type traits = []> : diff --git a/compiler/include/zamalang/Dialect/HLFHELinalg/CMakeLists.txt b/compiler/include/concretelang/Dialect/HLFHELinalg/CMakeLists.txt similarity index 100% rename from compiler/include/zamalang/Dialect/HLFHELinalg/CMakeLists.txt rename to compiler/include/concretelang/Dialect/HLFHELinalg/CMakeLists.txt diff --git a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/CMakeLists.txt b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/CMakeLists.txt similarity index 70% rename from compiler/include/zamalang/Dialect/HLFHELinalg/IR/CMakeLists.txt rename to compiler/include/concretelang/Dialect/HLFHELinalg/IR/CMakeLists.txt index 59a257848..4395d348e 100644 --- a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/CMakeLists.txt +++ b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/CMakeLists.txt @@ -8,6 +8,6 @@ mlir_tablegen(HLFHELinalgOpsDialect.cpp.inc -gen-dialect-defs -dialect=HLFHELina add_public_tablegen_target(MLIRHLFHELinalgOpsIncGen) add_dependencies(mlir-headers MLIRHLFHELinalgOpsIncGen) -add_zamalang_doc(HLFHELinalgDialect HLFHELinalgDialect zamalang/ -gen-dialect-doc) -add_zamalang_doc(HLFHELinalgOps HLFHELinalgOps zamalang/ -gen-op-doc) -add_zamalang_doc(HLFHELinalgTypes HLFHELinalgTypes zamalang/ -gen-typedef-doc) +add_concretelang_doc(HLFHELinalgDialect HLFHELinalgDialect concretelang/ -gen-dialect-doc) +add_concretelang_doc(HLFHELinalgOps HLFHELinalgOps concretelang/ -gen-op-doc) +add_concretelang_doc(HLFHELinalgTypes HLFHELinalgTypes concretelang/ -gen-typedef-doc) diff --git a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.h b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.h similarity index 58% rename from compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.h rename to compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.h index 9efe554af..78752951b 100644 --- a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.h +++ b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.h @@ -1,13 +1,13 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_HLFHELinalg_IR_HLFHELinalgDIALECT_H -#define ZAMALANG_DIALECT_HLFHELinalg_IR_HLFHELinalgDIALECT_H +#ifndef CONCRETELANG_DIALECT_HLFHELinalg_IR_HLFHELinalgDIALECT_H +#define CONCRETELANG_DIALECT_HLFHELinalg_IR_HLFHELinalgDIALECT_H #include "mlir/IR/BuiltinOps.h" #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOpsDialect.h.inc" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOpsDialect.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.td b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.td similarity index 62% rename from compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.td rename to compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.td index e88d461bf..b708853c7 100644 --- a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.td +++ b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.td @@ -1,5 +1,5 @@ -#ifndef ZAMALANG_DIALECT_HLFHELinalg_IR_HLFHELinalg_DIALECT -#define ZAMALANG_DIALECT_HLFHELinalg_IR_HLFHELinalg_DIALECT +#ifndef CONCRETELANG_DIALECT_HLFHELinalg_IR_HLFHELinalg_DIALECT +#define CONCRETELANG_DIALECT_HLFHELinalg_IR_HLFHELinalg_DIALECT include "mlir/IR/OpBase.td" @@ -9,7 +9,7 @@ def HLFHELinalg_Dialect : Dialect { let description = [{ A dialect for representation of high level linalg operations on fully homomorphic ciphertexts. }]; - let cppNamespace = "::mlir::zamalang::HLFHELinalg"; + let cppNamespace = "::mlir::concretelang::HLFHELinalg"; } #endif diff --git a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h similarity index 91% rename from compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h rename to compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h index 824f98c80..70541bc7d 100644 --- a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h +++ b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h @@ -1,13 +1,13 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_HLFHELinalg_IR_HLFHELinalgOPS_H -#define ZAMALANG_DIALECT_HLFHELinalg_IR_HLFHELinalgOPS_H +#ifndef CONCRETELANG_DIALECT_HLFHELinalg_IR_HLFHELinalgOPS_H +#define CONCRETELANG_DIALECT_HLFHELinalg_IR_HLFHELinalgOPS_H #include "mlir/IR/Dialect.h" #include "mlir/IR/OpDefinition.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHETypes.h" -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHETypes.h" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h" #include #include @@ -93,6 +93,6 @@ public: } // namespace mlir #define GET_OP_CLASSES -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h.inc" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.td b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.td similarity index 96% rename from compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.td rename to compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.td index 5c8e74498..3163535ac 100644 --- a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.td +++ b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.td @@ -1,11 +1,11 @@ -#ifndef ZAMALANG_DIALECT_HLFHELinalg_IR_HLFHELinalg_OPS -#define ZAMALANG_DIALECT_HLFHELinalg_IR_HLFHELinalg_OPS +#ifndef CONCRETELANG_DIALECT_HLFHELinalg_IR_HLFHELinalg_OPS +#define CONCRETELANG_DIALECT_HLFHELinalg_IR_HLFHELinalg_OPS include "mlir/Interfaces/SideEffectInterfaces.td" include "mlir/Interfaces/ControlFlowInterfaces.td" -include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.td" -include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.td" +include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.td" +include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.td" class HLFHELinalg_Op traits = []> : Op; @@ -289,7 +289,7 @@ def ApplyLookupTableEintOp : HLFHELinalg_Op<"apply_lookup_table", []> { let results = (outs Type.predicate, HasStaticShapePred]>>); let verifier = [{ - return ::mlir::zamalang::HLFHELinalg::verifyApplyLookupTable(*this); + return ::mlir::concretelang::HLFHELinalg::verifyApplyLookupTable(*this); }]; } @@ -338,7 +338,7 @@ def ApplyMultiLookupTableEintOp : HLFHELinalg_Op<"apply_multi_lookup_table", []> let results = (outs Type.predicate, HasStaticShapePred]>>); let verifier = [{ - return ::mlir::zamalang::HLFHELinalg::verifyApplyMultiLookupTable(*this); + return ::mlir::concretelang::HLFHELinalg::verifyApplyMultiLookupTable(*this); }]; } @@ -394,7 +394,7 @@ def ApplyMappedLookupTableEintOp : HLFHELinalg_Op<"apply_mapped_lookup_table", [ let results = (outs Type.predicate, HasStaticShapePred]>>); let verifier = [{ - return ::mlir::zamalang::HLFHELinalg::verifyApplyMappedLookupTable(*this); + return ::mlir::concretelang::HLFHELinalg::verifyApplyMappedLookupTable(*this); }]; } @@ -420,7 +420,7 @@ def Dot : HLFHELinalg_Op<"dot_eint_int"> { let results = (outs EncryptedIntegerType:$out); let verifier = [{ - return ::mlir::zamalang::HLFHELinalg::verifyDotEintInt(*this); + return ::mlir::concretelang::HLFHELinalg::verifyDotEintInt(*this); }]; } @@ -458,7 +458,7 @@ def MatMulEintIntOp : HLFHELinalg_Op<"matmul_eint_int", [TensorBinaryEintInt]> { let results = (outs Type.predicate, HasStaticShapePred]>>); let verifier = [{ - return ::mlir::zamalang::HLFHELinalg::verifyMatmul(*this); + return ::mlir::concretelang::HLFHELinalg::verifyMatmul(*this); }]; } @@ -496,7 +496,7 @@ def MatMulIntEintOp : HLFHELinalg_Op<"matmul_int_eint", [TensorBinaryIntEint]> { let results = (outs Type.predicate, HasStaticShapePred]>>); let verifier = [{ - return ::mlir::zamalang::HLFHELinalg::verifyMatmul(*this); + return ::mlir::concretelang::HLFHELinalg::verifyMatmul(*this); }]; } diff --git a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h similarity index 62% rename from compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h rename to compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h index 2a74f5816..3dead9b1a 100644 --- a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h +++ b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h @@ -1,14 +1,14 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_HLFHELinalg_IR_HLFHELinalgTYPES_H -#define ZAMALANG_DIALECT_HLFHELinalg_IR_HLFHELinalgTYPES_H +#ifndef CONCRETELANG_DIALECT_HLFHELinalg_IR_HLFHELinalgTYPES_H +#define CONCRETELANG_DIALECT_HLFHELinalg_IR_HLFHELinalgTYPES_H #include #include #include #define GET_TYPEDEF_CLASSES -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOpsTypes.h.inc" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOpsTypes.h.inc" #endif diff --git a/compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.td b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.td new file mode 100644 index 000000000..ea54a4e47 --- /dev/null +++ b/compiler/include/concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.td @@ -0,0 +1,11 @@ +#ifndef CONCRETELANG_DIALECT_HLFHELinalg_IR_HLFHELinalg_TYPES +#define CONCRETELANG_DIALECT_HLFHELinalg_IR_HLFHELinalg_TYPES + +include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.td" +include "mlir/IR/BuiltinTypes.td" +include "concretelang/Dialect/HLFHE/IR/HLFHETypes.td" + +class HLFHELinalg_Type traits = []> : + TypeDef { } + +#endif diff --git a/compiler/include/zamalang/Dialect/HLFHELinalg/Transforms/CMakeLists.txt b/compiler/include/concretelang/Dialect/HLFHELinalg/Transforms/CMakeLists.txt similarity index 59% rename from compiler/include/zamalang/Dialect/HLFHELinalg/Transforms/CMakeLists.txt rename to compiler/include/concretelang/Dialect/HLFHELinalg/Transforms/CMakeLists.txt index afccddaa5..3364504e9 100644 --- a/compiler/include/zamalang/Dialect/HLFHELinalg/Transforms/CMakeLists.txt +++ b/compiler/include/concretelang/Dialect/HLFHELinalg/Transforms/CMakeLists.txt @@ -1,3 +1,3 @@ set(LLVM_TARGET_DEFINITIONS Tiling.td) mlir_tablegen(Tiling.h.inc -gen-pass-decls -name Transforms) -add_public_tablegen_target(ZamalangHLFHELinalgTilingPassIncGen) +add_public_tablegen_target(ConcretelangHLFHELinalgTilingPassIncGen) diff --git a/compiler/include/zamalang/Dialect/HLFHELinalg/Transforms/Tiling.h b/compiler/include/concretelang/Dialect/HLFHELinalg/Transforms/Tiling.h similarity index 62% rename from compiler/include/zamalang/Dialect/HLFHELinalg/Transforms/Tiling.h rename to compiler/include/concretelang/Dialect/HLFHELinalg/Transforms/Tiling.h index fdf9b3f6c..9d894d710 100644 --- a/compiler/include/zamalang/Dialect/HLFHELinalg/Transforms/Tiling.h +++ b/compiler/include/concretelang/Dialect/HLFHELinalg/Transforms/Tiling.h @@ -1,22 +1,22 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_HLFHELINALG_TILING_PASS_H -#define ZAMALANG_HLFHELINALG_TILING_PASS_H +#ifndef CONCRETELANG_HLFHELINALG_TILING_PASS_H +#define CONCRETELANG_HLFHELINALG_TILING_PASS_H #include -#include +#include #define GEN_PASS_CLASSES -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { std::unique_ptr> createHLFHELinalgTilingMarkerPass(llvm::ArrayRef tileSizes); std::unique_ptr> createHLFHELinalgTilingPass(); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif diff --git a/compiler/include/zamalang/Dialect/HLFHELinalg/Transforms/Tiling.td b/compiler/include/concretelang/Dialect/HLFHELinalg/Transforms/Tiling.td similarity index 50% rename from compiler/include/zamalang/Dialect/HLFHELinalg/Transforms/Tiling.td rename to compiler/include/concretelang/Dialect/HLFHELinalg/Transforms/Tiling.td index cd1210cd4..3d93fb0d8 100644 --- a/compiler/include/zamalang/Dialect/HLFHELinalg/Transforms/Tiling.td +++ b/compiler/include/concretelang/Dialect/HLFHELinalg/Transforms/Tiling.td @@ -1,22 +1,22 @@ -#ifndef ZAMALANG_HLFHELINALG_TILING_PASS -#define ZAMALANG_HLFHELINALG_TILING_PASS +#ifndef CONCRETELANG_HLFHELINALG_TILING_PASS +#define CONCRETELANG_HLFHELINALG_TILING_PASS include "mlir/Pass/PassBase.td" def HLFHELinalgTilingMarker : Pass<"hlfhe-linalg-tiling-marker"> { let summary = "Marks HLFHELinalg operations for tiling using a vector of tile sizes"; - let constructor = "mlir::zamalang::createHLFHELinalgTilingMarkerPass()"; + let constructor = "mlir::concretelang::createHLFHELinalgTilingMarkerPass()"; let options = []; - let dependentDialects = [ "mlir::zamalang::HLFHELinalg::HLFHELinalgDialect" ]; + let dependentDialects = [ "mlir::concretelang::HLFHELinalg::HLFHELinalgDialect" ]; } def HLFHELinalgTiling : Pass<"hlfhe-linalg-tiling"> { let summary = "Performs tiling of HLFHELinalg operations based on the " "tile-size attribute"; - let constructor = "mlir::zamalang::createHLFHELinalgTilingPass()"; + let constructor = "mlir::concretelang::createHLFHELinalgTilingPass()"; let options = []; - let dependentDialects = [ "mlir::zamalang::HLFHELinalg::HLFHELinalgDialect" ]; + let dependentDialects = [ "mlir::concretelang::HLFHELinalg::HLFHELinalgDialect" ]; } #endif diff --git a/compiler/include/zamalang/Dialect/LowLFHE/CMakeLists.txt b/compiler/include/concretelang/Dialect/LowLFHE/CMakeLists.txt similarity index 100% rename from compiler/include/zamalang/Dialect/LowLFHE/CMakeLists.txt rename to compiler/include/concretelang/Dialect/LowLFHE/CMakeLists.txt diff --git a/compiler/include/zamalang/Dialect/LowLFHE/IR/CMakeLists.txt b/compiler/include/concretelang/Dialect/LowLFHE/IR/CMakeLists.txt similarity index 70% rename from compiler/include/zamalang/Dialect/LowLFHE/IR/CMakeLists.txt rename to compiler/include/concretelang/Dialect/LowLFHE/IR/CMakeLists.txt index 35eb4e438..cb85ae76d 100644 --- a/compiler/include/zamalang/Dialect/LowLFHE/IR/CMakeLists.txt +++ b/compiler/include/concretelang/Dialect/LowLFHE/IR/CMakeLists.txt @@ -8,6 +8,6 @@ mlir_tablegen(LowLFHEOpsDialect.cpp.inc -gen-dialect-defs -dialect=LowLFHE) add_public_tablegen_target(MLIRLowLFHEOpsIncGen) add_dependencies(mlir-headers MLIRLowLFHEOpsIncGen) -add_zamalang_doc(LowLFHEDialect LowLFHEDialect zamalang/ -gen-dialect-doc) -add_zamalang_doc(LowLFHEOps LowLFHEOps zamalang/ -gen-op-doc) -add_zamalang_doc(LowLFHETypes LowLFHETypes zamalang/ -gen-typedef-doc) +add_concretelang_doc(LowLFHEDialect LowLFHEDialect concretelang/ -gen-dialect-doc) +add_concretelang_doc(LowLFHEOps LowLFHEOps concretelang/ -gen-op-doc) +add_concretelang_doc(LowLFHETypes LowLFHETypes concretelang/ -gen-typedef-doc) diff --git a/compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.h b/compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.h similarity index 66% rename from compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.h rename to compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.h index 15585988e..0015eb096 100644 --- a/compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.h +++ b/compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_LowLFHE_IR_LowLFHEDIALECT_H -#define ZAMALANG_DIALECT_LowLFHE_IR_LowLFHEDIALECT_H +#ifndef CONCRETELANG_DIALECT_LowLFHE_IR_LowLFHEDIALECT_H +#define CONCRETELANG_DIALECT_LowLFHE_IR_LowLFHEDIALECT_H #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" @@ -11,6 +11,6 @@ #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEOpsDialect.h.inc" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEOpsDialect.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.td b/compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.td similarity index 62% rename from compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.td rename to compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.td index 039801339..d121cf2e0 100644 --- a/compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.td +++ b/compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.td @@ -1,5 +1,5 @@ -#ifndef ZAMALANG_DIALECT_LowLFHE_IR_LowLFHE_DIALECT -#define ZAMALANG_DIALECT_LowLFHE_IR_LowLFHE_DIALECT +#ifndef CONCRETELANG_DIALECT_LowLFHE_IR_LowLFHE_DIALECT +#define CONCRETELANG_DIALECT_LowLFHE_IR_LowLFHE_DIALECT include "mlir/IR/OpBase.td" @@ -9,7 +9,7 @@ def LowLFHE_Dialect : Dialect { let description = [{ A dialect for representation of low level operation on fully homomorphic ciphertext. }]; - let cppNamespace = "::mlir::zamalang::LowLFHE"; + let cppNamespace = "::mlir::concretelang::LowLFHE"; } #endif diff --git a/compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHEOps.h b/compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHEOps.h similarity index 65% rename from compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHEOps.h rename to compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHEOps.h index dc0996d21..c9ff8a468 100644 --- a/compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHEOps.h +++ b/compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHEOps.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_LowLFHE_LowLFHE_OPS_H -#define ZAMALANG_DIALECT_LowLFHE_LowLFHE_OPS_H +#ifndef CONCRETELANG_DIALECT_LowLFHE_LowLFHE_OPS_H +#define CONCRETELANG_DIALECT_LowLFHE_LowLFHE_OPS_H #include #include @@ -10,9 +10,9 @@ #include #include -#include "zamalang/Dialect/LowLFHE/IR/LowLFHETypes.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHETypes.h" #define GET_OP_CLASSES -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEOps.h.inc" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEOps.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHEOps.td b/compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHEOps.td similarity index 93% rename from compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHEOps.td rename to compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHEOps.td index f68c43655..0ad889813 100644 --- a/compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHEOps.td +++ b/compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHEOps.td @@ -1,11 +1,11 @@ -#ifndef ZAMALANG_DIALECT_LowLFHE_IR_LowLFHE_OPS -#define ZAMALANG_DIALECT_LowLFHE_IR_LowLFHE_OPS +#ifndef CONCRETELANG_DIALECT_LowLFHE_IR_LowLFHE_OPS +#define CONCRETELANG_DIALECT_LowLFHE_IR_LowLFHE_OPS include "mlir/Interfaces/SideEffectInterfaces.td" include "mlir/Interfaces/ControlFlowInterfaces.td" -include "zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.td" -include "zamalang/Dialect/LowLFHE/IR/LowLFHETypes.td" +include "concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.td" +include "concretelang/Dialect/LowLFHE/IR/LowLFHETypes.td" class LowLFHE_Op traits = []> : Op; diff --git a/compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHETypes.h b/compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHETypes.h similarity index 67% rename from compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHETypes.h rename to compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHETypes.h index c34b0fe37..8ced2bc20 100644 --- a/compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHETypes.h +++ b/compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHETypes.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_LowLFHE_IR_LowLFHETYPES_H -#define ZAMALANG_DIALECT_LowLFHE_IR_LowLFHETYPES_H +#ifndef CONCRETELANG_DIALECT_LowLFHE_IR_LowLFHETYPES_H +#define CONCRETELANG_DIALECT_LowLFHE_IR_LowLFHETYPES_H #include "llvm/ADT/TypeSwitch.h" #include @@ -10,6 +10,6 @@ #include #define GET_TYPEDEF_CLASSES -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEOpsTypes.h.inc" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEOpsTypes.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHETypes.td b/compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHETypes.td similarity index 97% rename from compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHETypes.td rename to compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHETypes.td index dddaae236..652267c34 100644 --- a/compiler/include/zamalang/Dialect/LowLFHE/IR/LowLFHETypes.td +++ b/compiler/include/concretelang/Dialect/LowLFHE/IR/LowLFHETypes.td @@ -1,9 +1,9 @@ -#ifndef ZAMALANG_DIALECT_LowLFHE_IR_LowLFHE_TYPES -#define ZAMALANG_DIALECT_LowLFHE_IR_LowLFHE_TYPES +#ifndef CONCRETELANG_DIALECT_LowLFHE_IR_LowLFHE_TYPES +#define CONCRETELANG_DIALECT_LowLFHE_IR_LowLFHE_TYPES include "mlir/IR/BuiltinTypes.td" -include "zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.td" +include "concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.td" class LowLFHE_Type traits = []> : TypeDef { } diff --git a/compiler/include/zamalang/Dialect/MidLFHE/CMakeLists.txt b/compiler/include/concretelang/Dialect/MidLFHE/CMakeLists.txt similarity index 100% rename from compiler/include/zamalang/Dialect/MidLFHE/CMakeLists.txt rename to compiler/include/concretelang/Dialect/MidLFHE/CMakeLists.txt diff --git a/compiler/include/zamalang/Dialect/MidLFHE/IR/CMakeLists.txt b/compiler/include/concretelang/Dialect/MidLFHE/IR/CMakeLists.txt similarity index 70% rename from compiler/include/zamalang/Dialect/MidLFHE/IR/CMakeLists.txt rename to compiler/include/concretelang/Dialect/MidLFHE/IR/CMakeLists.txt index 478cd12a1..c14c43e0a 100644 --- a/compiler/include/zamalang/Dialect/MidLFHE/IR/CMakeLists.txt +++ b/compiler/include/concretelang/Dialect/MidLFHE/IR/CMakeLists.txt @@ -8,6 +8,6 @@ mlir_tablegen(MidLFHEOpsDialect.cpp.inc -gen-dialect-defs -dialect=MidLFHE) add_public_tablegen_target(MLIRMidLFHEOpsIncGen) add_dependencies(mlir-headers MLIRMidLFHEOpsIncGen) -add_zamalang_doc(MidLFHEDialect MidLFHEDialect zamalang/ -gen-dialect-doc) -add_zamalang_doc(MidLFHEOps MidLFHEOps zamalang/ -gen-op-doc) -add_zamalang_doc(MidLFHETypes MidLFHETypes zamalang/ -gen-typedef-doc) +add_concretelang_doc(MidLFHEDialect MidLFHEDialect concretelang/ -gen-dialect-doc) +add_concretelang_doc(MidLFHEOps MidLFHEOps concretelang/ -gen-op-doc) +add_concretelang_doc(MidLFHETypes MidLFHETypes concretelang/ -gen-typedef-doc) diff --git a/compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.h b/compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.h similarity index 66% rename from compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.h rename to compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.h index e52c8f6d4..0b68fb443 100644 --- a/compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.h +++ b/compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_MIDLFHE_IR_MIDLFHEDIALECT_H -#define ZAMALANG_DIALECT_MIDLFHE_IR_MIDLFHEDIALECT_H +#ifndef CONCRETELANG_DIALECT_MIDLFHE_IR_MIDLFHEDIALECT_H +#define CONCRETELANG_DIALECT_MIDLFHE_IR_MIDLFHEDIALECT_H #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" @@ -11,6 +11,6 @@ #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEOpsDialect.h.inc" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEOpsDialect.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.td b/compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.td similarity index 79% rename from compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.td rename to compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.td index 042149a05..0676b7268 100644 --- a/compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.td +++ b/compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.td @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef ZAMALANG_DIALECT_MidLFHE_IR_MidLFHE_DIALECT -#define ZAMALANG_DIALECT_MidLFHE_IR_MidLFHE_DIALECT +#ifndef CONCRETELANG_DIALECT_MidLFHE_IR_MidLFHE_DIALECT +#define CONCRETELANG_DIALECT_MidLFHE_IR_MidLFHE_DIALECT include "mlir/IR/OpBase.td" @@ -17,7 +17,7 @@ def MidLFHE_Dialect : Dialect { let description = [{ A dialect for representation of high level operation on fully homomorphic ciphertext. }]; - let cppNamespace = "::mlir::zamalang::MidLFHE"; + let cppNamespace = "::mlir::concretelang::MidLFHE"; } #endif diff --git a/compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHEOps.h b/compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHEOps.h similarity index 65% rename from compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHEOps.h rename to compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHEOps.h index edeafbfdc..8fa41cb14 100644 --- a/compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHEOps.h +++ b/compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHEOps.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_MIDLFHE_IR_MIDLFHEOPS_H -#define ZAMALANG_DIALECT_MIDLFHE_IR_MIDLFHEOPS_H +#ifndef CONCRETELANG_DIALECT_MIDLFHE_IR_MIDLFHEOPS_H +#define CONCRETELANG_DIALECT_MIDLFHE_IR_MIDLFHEOPS_H #include #include @@ -10,9 +10,9 @@ #include #include -#include "zamalang/Dialect/MidLFHE/IR/MidLFHETypes.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHETypes.h" #define GET_OP_CLASSES -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEOps.h.inc" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEOps.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHEOps.td b/compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHEOps.td similarity index 77% rename from compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHEOps.td rename to compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHEOps.td index 713ed1f2f..f5752a0ba 100644 --- a/compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHEOps.td +++ b/compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHEOps.td @@ -6,14 +6,14 @@ // //===----------------------------------------------------------------------===// -#ifndef ZAMALANG_DIALECT_MidLFHE_IR_MidLFHE_OPS -#define ZAMALANG_DIALECT_MidLFHE_IR_MidLFHE_OPS +#ifndef CONCRETELANG_DIALECT_MidLFHE_IR_MidLFHE_OPS +#define CONCRETELANG_DIALECT_MidLFHE_IR_MidLFHE_OPS include "mlir/Interfaces/SideEffectInterfaces.td" include "mlir/Interfaces/ControlFlowInterfaces.td" -include "zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.td" -include "zamalang/Dialect/MidLFHE/IR/MidLFHETypes.td" +include "concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.td" +include "concretelang/Dialect/MidLFHE/IR/MidLFHETypes.td" class MidLFHE_Op traits = []> : Op; @@ -32,7 +32,7 @@ def AddGLWEIntOp : MidLFHE_Op<"add_glwe_int"> { let results = (outs GLWECipherTextType); let verifier = [{ - return mlir::zamalang::MidLFHE::verifyGLWEIntegerOperator(*this); + return mlir::concretelang::MidLFHE::verifyGLWEIntegerOperator(*this); }]; } @@ -43,7 +43,7 @@ def AddGLWEOp : MidLFHE_Op<"add_glwe"> { let results = (outs GLWECipherTextType); let verifier = [{ - return ::mlir::zamalang::MidLFHE::verifyBinaryGLWEOperator(*this); + return ::mlir::concretelang::MidLFHE::verifyBinaryGLWEOperator(*this); }]; } @@ -54,7 +54,7 @@ def SubIntGLWEOp : MidLFHE_Op<"sub_int_glwe"> { let results = (outs GLWECipherTextType); let verifier = [{ - return ::mlir::zamalang::MidLFHE::verifyIntegerGLWEOperator(*this); + return ::mlir::concretelang::MidLFHE::verifyIntegerGLWEOperator(*this); }]; } @@ -65,7 +65,7 @@ def NegGLWEOp : MidLFHE_Op<"neg_glwe"> { let results = (outs GLWECipherTextType); let verifier = [{ - return ::mlir::zamalang::MidLFHE::verifyUnaryGLWEOperator(*this); + return ::mlir::concretelang::MidLFHE::verifyUnaryGLWEOperator(*this); }]; } @@ -77,7 +77,7 @@ def MulGLWEIntOp : MidLFHE_Op<"mul_glwe_int"> { let results = (outs GLWECipherTextType); let verifier = [{ - return mlir::zamalang::MidLFHE::verifyGLWEIntegerOperator(*this); + return mlir::concretelang::MidLFHE::verifyGLWEIntegerOperator(*this); }]; } @@ -96,7 +96,7 @@ def ApplyLookupTable : MidLFHE_Op<"apply_lookup_table"> { let results = (outs GLWECipherTextType); let verifier = [{ - return ::mlir::zamalang::MidLFHE::verifyApplyLookupTable(*this); + return ::mlir::concretelang::MidLFHE::verifyApplyLookupTable(*this); }]; } diff --git a/compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHETypes.h b/compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHETypes.h similarity index 70% rename from compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHETypes.h rename to compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHETypes.h index e6b1df3ac..0eb06b1f1 100644 --- a/compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHETypes.h +++ b/compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHETypes.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_MIDLFHE_IR_MIDLFHETYPES_H -#define ZAMALANG_DIALECT_MIDLFHE_IR_MIDLFHETYPES_H +#ifndef CONCRETELANG_DIALECT_MIDLFHE_IR_MIDLFHETYPES_H +#define CONCRETELANG_DIALECT_MIDLFHE_IR_MIDLFHETYPES_H #include "llvm/ADT/TypeSwitch.h" #include @@ -11,6 +11,6 @@ #include #define GET_TYPEDEF_CLASSES -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEOpsTypes.h.inc" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEOpsTypes.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHETypes.td b/compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHETypes.td similarity index 94% rename from compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHETypes.td rename to compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHETypes.td index 49982e21a..c733c8ab5 100644 --- a/compiler/include/zamalang/Dialect/MidLFHE/IR/MidLFHETypes.td +++ b/compiler/include/concretelang/Dialect/MidLFHE/IR/MidLFHETypes.td @@ -1,9 +1,9 @@ -#ifndef ZAMALANG_DIALECT_MidLFHE_IR_MidLFHE_TYPES -#define ZAMALANG_DIALECT_MidLFHE_IR_MidLFHE_TYPES +#ifndef CONCRETELANG_DIALECT_MidLFHE_IR_MidLFHE_TYPES +#define CONCRETELANG_DIALECT_MidLFHE_IR_MidLFHE_TYPES // TODO: MLWE / GSW -include "zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.td" +include "concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.td" include "mlir/IR/BuiltinTypes.td" class MidLFHE_Type traits = []> : TypeDef { } diff --git a/compiler/include/zamalang/Dialect/RT/Analysis/Autopar.h b/compiler/include/concretelang/Dialect/RT/Analysis/Autopar.h similarity index 83% rename from compiler/include/zamalang/Dialect/RT/Analysis/Autopar.h rename to compiler/include/concretelang/Dialect/RT/Analysis/Autopar.h index 568154e36..5c68fd370 100644 --- a/compiler/include/zamalang/Dialect/RT/Analysis/Autopar.h +++ b/compiler/include/concretelang/Dialect/RT/Analysis/Autopar.h @@ -1,12 +1,12 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_RT_ANALYSIS_AUTOPAR_H -#define ZAMALANG_DIALECT_RT_ANALYSIS_AUTOPAR_H +#ifndef CONCRETELANG_DIALECT_RT_ANALYSIS_AUTOPAR_H +#define CONCRETELANG_DIALECT_RT_ANALYSIS_AUTOPAR_H #include #include -#include +#include namespace mlir { @@ -14,7 +14,7 @@ class LLVMTypeConverter; class BufferizeTypeConverter; class RewritePatternSet; -namespace zamalang { +namespace concretelang { std::unique_ptr createBuildDataflowTaskGraphPass(bool debug = false); std::unique_ptr createLowerDataflowTasksPass(bool debug = false); @@ -25,7 +25,7 @@ void populateRTToLLVMConversionPatterns(mlir::LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns); void populateRTBufferizePatterns(mlir::BufferizeTypeConverter &typeConverter, mlir::RewritePatternSet &patterns); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif diff --git a/compiler/include/zamalang/Dialect/RT/Analysis/Autopar.td b/compiler/include/concretelang/Dialect/RT/Analysis/Autopar.td similarity index 96% rename from compiler/include/zamalang/Dialect/RT/Analysis/Autopar.td rename to compiler/include/concretelang/Dialect/RT/Analysis/Autopar.td index 27ccd327f..7d7287559 100644 --- a/compiler/include/zamalang/Dialect/RT/Analysis/Autopar.td +++ b/compiler/include/concretelang/Dialect/RT/Analysis/Autopar.td @@ -1,5 +1,5 @@ -#ifndef ZAMALANG_DIALECT_RT_ANALYSIS_AUTOPAR -#define ZAMALANG_DIALECT_RT_ANALYSIS_AUTOPAR +#ifndef CONCRETELANG_DIALECT_RT_ANALYSIS_AUTOPAR +#define CONCRETELANG_DIALECT_RT_ANALYSIS_AUTOPAR include "mlir/Pass/PassBase.td" diff --git a/compiler/include/zamalang/Dialect/RT/Analysis/CMakeLists.txt b/compiler/include/concretelang/Dialect/RT/Analysis/CMakeLists.txt similarity index 100% rename from compiler/include/zamalang/Dialect/RT/Analysis/CMakeLists.txt rename to compiler/include/concretelang/Dialect/RT/Analysis/CMakeLists.txt diff --git a/compiler/include/zamalang/Dialect/RT/CMakeLists.txt b/compiler/include/concretelang/Dialect/RT/CMakeLists.txt similarity index 100% rename from compiler/include/zamalang/Dialect/RT/CMakeLists.txt rename to compiler/include/concretelang/Dialect/RT/CMakeLists.txt diff --git a/compiler/include/zamalang/Dialect/RT/IR/CMakeLists.txt b/compiler/include/concretelang/Dialect/RT/IR/CMakeLists.txt similarity index 100% rename from compiler/include/zamalang/Dialect/RT/IR/CMakeLists.txt rename to compiler/include/concretelang/Dialect/RT/IR/CMakeLists.txt diff --git a/compiler/include/zamalang/Dialect/RT/IR/RTDialect.h b/compiler/include/concretelang/Dialect/RT/IR/RTDialect.h similarity index 70% rename from compiler/include/zamalang/Dialect/RT/IR/RTDialect.h rename to compiler/include/concretelang/Dialect/RT/IR/RTDialect.h index 1fc4089cd..1f5117827 100644 --- a/compiler/include/zamalang/Dialect/RT/IR/RTDialect.h +++ b/compiler/include/concretelang/Dialect/RT/IR/RTDialect.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_RT_IR_RTDIALECT_H -#define ZAMALANG_DIALECT_RT_IR_RTDIALECT_H +#ifndef CONCRETELANG_DIALECT_RT_IR_RTDIALECT_H +#define CONCRETELANG_DIALECT_RT_IR_RTDIALECT_H #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" @@ -11,6 +11,6 @@ #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" -#include "zamalang/Dialect/RT/IR/RTOpsDialect.h.inc" +#include "concretelang/Dialect/RT/IR/RTOpsDialect.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/RT/IR/RTDialect.td b/compiler/include/concretelang/Dialect/RT/IR/RTDialect.td similarity index 61% rename from compiler/include/zamalang/Dialect/RT/IR/RTDialect.td rename to compiler/include/concretelang/Dialect/RT/IR/RTDialect.td index 73318e448..96f85c681 100644 --- a/compiler/include/zamalang/Dialect/RT/IR/RTDialect.td +++ b/compiler/include/concretelang/Dialect/RT/IR/RTDialect.td @@ -1,5 +1,5 @@ -#ifndef ZAMALANG_DIALECT_RT_IR_RT_DIALECT -#define ZAMALANG_DIALECT_RT_IR_RT_DIALECT +#ifndef CONCRETELANG_DIALECT_RT_IR_RT_DIALECT +#define CONCRETELANG_DIALECT_RT_IR_RT_DIALECT include "mlir/IR/OpBase.td" @@ -9,7 +9,7 @@ def RT_Dialect : Dialect { let description = [{ A dialect for representation the abstraction needed for the runtime. }]; - let cppNamespace = "::mlir::zamalang::RT"; + let cppNamespace = "::mlir::concretelang::RT"; } #endif diff --git a/compiler/include/zamalang/Dialect/RT/IR/RTOps.h b/compiler/include/concretelang/Dialect/RT/IR/RTOps.h similarity index 67% rename from compiler/include/zamalang/Dialect/RT/IR/RTOps.h rename to compiler/include/concretelang/Dialect/RT/IR/RTOps.h index 31fb17b24..64b13e13f 100644 --- a/compiler/include/zamalang/Dialect/RT/IR/RTOps.h +++ b/compiler/include/concretelang/Dialect/RT/IR/RTOps.h @@ -1,17 +1,17 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_RT_IR_RTOPS_H -#define ZAMALANG_DIALECT_RT_IR_RTOPS_H +#ifndef CONCRETELANG_DIALECT_RT_IR_RTOPS_H +#define CONCRETELANG_DIALECT_RT_IR_RTOPS_H #include #include #include #include -#include "zamalang/Dialect/RT/IR/RTTypes.h" +#include "concretelang/Dialect/RT/IR/RTTypes.h" #define GET_OP_CLASSES -#include "zamalang/Dialect/RT/IR/RTOps.h.inc" +#include "concretelang/Dialect/RT/IR/RTOps.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/RT/IR/RTOps.td b/compiler/include/concretelang/Dialect/RT/IR/RTOps.td similarity index 96% rename from compiler/include/zamalang/Dialect/RT/IR/RTOps.td rename to compiler/include/concretelang/Dialect/RT/IR/RTOps.td index bca9edef9..5a4164fc9 100644 --- a/compiler/include/zamalang/Dialect/RT/IR/RTOps.td +++ b/compiler/include/concretelang/Dialect/RT/IR/RTOps.td @@ -1,13 +1,13 @@ -#ifndef ZAMALANG_DIALECT_RT_IR_RT_OPS -#define ZAMALANG_DIALECT_RT_IR_RT_OPS +#ifndef CONCRETELANG_DIALECT_RT_IR_RT_OPS +#define CONCRETELANG_DIALECT_RT_IR_RT_OPS include "mlir/Interfaces/ControlFlowInterfaces.td" include "mlir/Interfaces/SideEffectInterfaces.td" include "mlir/IR/SymbolInterfaces.td" include "mlir/Interfaces/DataLayoutInterfaces.td" -include "zamalang/Dialect/RT/IR/RTDialect.td" -include "zamalang/Dialect/RT/IR/RTTypes.td" +include "concretelang/Dialect/RT/IR/RTDialect.td" +include "concretelang/Dialect/RT/IR/RTTypes.td" class RT_Op traits = []> : Op; diff --git a/compiler/include/zamalang/Dialect/RT/IR/RTTypes.h b/compiler/include/concretelang/Dialect/RT/IR/RTTypes.h similarity index 71% rename from compiler/include/zamalang/Dialect/RT/IR/RTTypes.h rename to compiler/include/concretelang/Dialect/RT/IR/RTTypes.h index 8f7dee83f..fb7f15bd7 100644 --- a/compiler/include/zamalang/Dialect/RT/IR/RTTypes.h +++ b/compiler/include/concretelang/Dialect/RT/IR/RTTypes.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DIALECT_RT_IR_RTTYPES_H -#define ZAMALANG_DIALECT_RT_IR_RTTYPES_H +#ifndef CONCRETELANG_DIALECT_RT_IR_RTTYPES_H +#define CONCRETELANG_DIALECT_RT_IR_RTTYPES_H #include "llvm/ADT/TypeSwitch.h" #include @@ -10,6 +10,6 @@ #include #define GET_TYPEDEF_CLASSES -#include "zamalang/Dialect/RT/IR/RTOpsTypes.h.inc" +#include "concretelang/Dialect/RT/IR/RTOpsTypes.h.inc" #endif diff --git a/compiler/include/zamalang/Dialect/RT/IR/RTTypes.td b/compiler/include/concretelang/Dialect/RT/IR/RTTypes.td similarity index 92% rename from compiler/include/zamalang/Dialect/RT/IR/RTTypes.td rename to compiler/include/concretelang/Dialect/RT/IR/RTTypes.td index 7d7d577a5..4e5dbf957 100644 --- a/compiler/include/zamalang/Dialect/RT/IR/RTTypes.td +++ b/compiler/include/concretelang/Dialect/RT/IR/RTTypes.td @@ -1,7 +1,7 @@ -#ifndef ZAMALANG_DIALECT_HLFHE_IR_HLFHE_TYPES -#define ZAMALANG_DIALECT_HLFHE_IR_HLFHE_TYPES +#ifndef CONCRETELANG_DIALECT_HLFHE_IR_HLFHE_TYPES +#define CONCRETELANG_DIALECT_HLFHE_IR_HLFHE_TYPES -include "zamalang/Dialect/RT/IR/RTDialect.td" +include "concretelang/Dialect/RT/IR/RTDialect.td" include "mlir/IR/BuiltinTypes.td" class RT_Type traits = []> : diff --git a/compiler/include/zamalang/Runtime/DFRuntime.hpp b/compiler/include/concretelang/Runtime/DFRuntime.hpp similarity index 95% rename from compiler/include/zamalang/Runtime/DFRuntime.hpp rename to compiler/include/concretelang/Runtime/DFRuntime.hpp index afa1b6a09..186f9d9c3 100644 --- a/compiler/include/zamalang/Runtime/DFRuntime.hpp +++ b/compiler/include/concretelang/Runtime/DFRuntime.hpp @@ -1,17 +1,17 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DFR_DFRUNTIME_HPP -#define ZAMALANG_DFR_DFRUNTIME_HPP +#ifndef CONCRETELANG_DFR_DFRUNTIME_HPP +#define CONCRETELANG_DFR_DFRUNTIME_HPP #include #include #include -#include "zamalang/Runtime/runtime_api.h" +#include "concretelang/Runtime/runtime_api.h" /* Debug interface. */ -#include "zamalang/Runtime/dfr_debug_interface.h" +#include "concretelang/Runtime/dfr_debug_interface.h" extern void *dl_handle; struct WorkFunctionRegistry; diff --git a/compiler/include/zamalang/Runtime/context.h b/compiler/include/concretelang/Runtime/context.h similarity index 85% rename from compiler/include/zamalang/Runtime/context.h rename to compiler/include/concretelang/Runtime/context.h index b412526df..1b42630e5 100644 --- a/compiler/include/zamalang/Runtime/context.h +++ b/compiler/include/concretelang/Runtime/context.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_RUNTIME_CONTEXT_H -#define ZAMALANG_RUNTIME_CONTEXT_H +#ifndef CONCRETELANG_RUNTIME_CONTEXT_H +#define CONCRETELANG_RUNTIME_CONTEXT_H #include "concrete-ffi.h" diff --git a/compiler/include/zamalang/Runtime/dfr_debug_interface.h b/compiler/include/concretelang/Runtime/dfr_debug_interface.h similarity index 83% rename from compiler/include/zamalang/Runtime/dfr_debug_interface.h rename to compiler/include/concretelang/Runtime/dfr_debug_interface.h index 25a1eac0a..84b763162 100644 --- a/compiler/include/zamalang/Runtime/dfr_debug_interface.h +++ b/compiler/include/concretelang/Runtime/dfr_debug_interface.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DRF_DEBUG_INTERFACE_H -#define ZAMALANG_DRF_DEBUG_INTERFACE_H +#ifndef CONCRETELANG_DRF_DEBUG_INTERFACE_H +#define CONCRETELANG_DRF_DEBUG_INTERFACE_H #include #include diff --git a/compiler/include/zamalang/Runtime/distributed_generic_task_server.hpp b/compiler/include/concretelang/Runtime/distributed_generic_task_server.hpp similarity index 97% rename from compiler/include/zamalang/Runtime/distributed_generic_task_server.hpp rename to compiler/include/concretelang/Runtime/distributed_generic_task_server.hpp index d4e9e367e..56b6ab0cb 100644 --- a/compiler/include/zamalang/Runtime/distributed_generic_task_server.hpp +++ b/compiler/include/concretelang/Runtime/distributed_generic_task_server.hpp @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DFR_DISTRIBUTED_GENERIC_TASK_SERVER_HPP -#define ZAMALANG_DFR_DISTRIBUTED_GENERIC_TASK_SERVER_HPP +#ifndef CONCRETELANG_DFR_DISTRIBUTED_GENERIC_TASK_SERVER_HPP +#define CONCRETELANG_DFR_DISTRIBUTED_GENERIC_TASK_SERVER_HPP #include #include @@ -24,8 +24,8 @@ #include #include -#include "zamalang/Runtime/DFRuntime.hpp" -#include "zamalang/Runtime/key_manager.hpp" +#include "concretelang/Runtime/DFRuntime.hpp" +#include "concretelang/Runtime/key_manager.hpp" extern WorkFunctionRegistry *node_level_work_function_registry; extern std::list new_allocated; diff --git a/compiler/include/zamalang/Runtime/key_manager.hpp b/compiler/include/concretelang/Runtime/key_manager.hpp similarity index 96% rename from compiler/include/zamalang/Runtime/key_manager.hpp rename to compiler/include/concretelang/Runtime/key_manager.hpp index afecdff61..5d9d618d9 100644 --- a/compiler/include/zamalang/Runtime/key_manager.hpp +++ b/compiler/include/concretelang/Runtime/key_manager.hpp @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_DFR_KEY_MANAGER_HPP -#define ZAMALANG_DFR_KEY_MANAGER_HPP +#ifndef CONCRETELANG_DFR_KEY_MANAGER_HPP +#define CONCRETELANG_DFR_KEY_MANAGER_HPP #include #include @@ -10,7 +10,7 @@ #include #include -#include "zamalang/Runtime/DFRuntime.hpp" +#include "concretelang/Runtime/DFRuntime.hpp" struct PbsKeyManager; extern PbsKeyManager *node_level_key_manager; diff --git a/compiler/include/zamalang/Runtime/runtime_api.h b/compiler/include/concretelang/Runtime/runtime_api.h similarity index 93% rename from compiler/include/zamalang/Runtime/runtime_api.h rename to compiler/include/concretelang/Runtime/runtime_api.h index 814b87c4b..c5d3e47d8 100644 --- a/compiler/include/zamalang/Runtime/runtime_api.h +++ b/compiler/include/concretelang/Runtime/runtime_api.h @@ -5,8 +5,8 @@ Define the API exposed to the compiler for code generation. */ -#ifndef ZAMALANG_DFR_RUNTIME_API_H -#define ZAMALANG_DFR_RUNTIME_API_H +#ifndef CONCRETELANG_DFR_RUNTIME_API_H +#define CONCRETELANG_DFR_RUNTIME_API_H #include #include diff --git a/compiler/include/zamalang/Runtime/wrappers.h b/compiler/include/concretelang/Runtime/wrappers.h similarity index 86% rename from compiler/include/zamalang/Runtime/wrappers.h rename to compiler/include/concretelang/Runtime/wrappers.h index d53709304..6a546f709 100644 --- a/compiler/include/zamalang/Runtime/wrappers.h +++ b/compiler/include/concretelang/Runtime/wrappers.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_RUNTIME_WRAPPERS_H -#define ZAMALANG_RUNTIME_WRAPPERS_H +#ifndef CONCRETELANG_RUNTIME_WRAPPERS_H +#define CONCRETELANG_RUNTIME_WRAPPERS_H #include "concrete-ffi.h" diff --git a/compiler/include/zamalang/Support/ClientParameters.h b/compiler/include/concretelang/Support/ClientParameters.h similarity index 91% rename from compiler/include/zamalang/Support/ClientParameters.h rename to compiler/include/concretelang/Support/ClientParameters.h index d50d39b15..5bf038c74 100644 --- a/compiler/include/zamalang/Support/ClientParameters.h +++ b/compiler/include/concretelang/Support/ClientParameters.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_CLIENTPARAMETERS_H_ -#define ZAMALANG_SUPPORT_CLIENTPARAMETERS_H_ +#ifndef CONCRETELANG_SUPPORT_CLIENTPARAMETERS_H_ +#define CONCRETELANG_SUPPORT_CLIENTPARAMETERS_H_ #include #include #include @@ -10,10 +10,10 @@ #include #include -#include "zamalang/Support/V0Parameters.h" +#include "concretelang/Support/V0Parameters.h" namespace mlir { -namespace zamalang { +namespace concretelang { typedef size_t DecompositionLevelCount; typedef size_t DecompositionBaseLog; @@ -91,7 +91,7 @@ llvm::Expected createClientParametersForV0(V0FHEContext context, llvm::StringRef name, mlir::ModuleOp module); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Support/CompilerEngine.h b/compiler/include/concretelang/Support/CompilerEngine.h similarity index 91% rename from compiler/include/zamalang/Support/CompilerEngine.h rename to compiler/include/concretelang/Support/CompilerEngine.h index 8b3d9858d..e328713b4 100644 --- a/compiler/include/zamalang/Support/CompilerEngine.h +++ b/compiler/include/concretelang/Support/CompilerEngine.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_COMPILER_ENGINE_H -#define ZAMALANG_SUPPORT_COMPILER_ENGINE_H +#ifndef CONCRETELANG_SUPPORT_COMPILER_ENGINE_H +#define CONCRETELANG_SUPPORT_COMPILER_ENGINE_H #include #include @@ -10,11 +10,11 @@ #include #include #include -#include -#include +#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { // Compilation context that acts as the root owner of LLVM and MLIR // data structures directly and indirectly referenced by artefacts @@ -45,9 +45,9 @@ public: : compilationContext(compilationContext) {} llvm::Optional mlirModuleRef; - llvm::Optional clientParameters; + llvm::Optional clientParameters; std::unique_ptr llvmModule; - llvm::Optional fheContext; + llvm::Optional fheContext; protected: std::shared_ptr compilationContext; @@ -145,7 +145,7 @@ public: llvm::Expected compile(std::vector inputs, std::string libraryPath); - void setFHEConstraints(const mlir::zamalang::V0FHEConstraint &c); + void setFHEConstraints(const mlir::concretelang::V0FHEConstraint &c); void setMaxEintPrecision(size_t v); void setMaxMANP(size_t v); void setVerifyDiagnostics(bool v); @@ -169,12 +169,12 @@ protected: std::shared_ptr compilationContext; private: - llvm::Expected> + llvm::Expected> getV0FHEConstraint(CompilationResult &res); llvm::Error determineFHEParameters(CompilationResult &res); }; -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif diff --git a/compiler/include/zamalang/Support/Constants.h b/compiler/include/concretelang/Support/Constants.h similarity index 67% rename from compiler/include/zamalang/Support/Constants.h rename to compiler/include/concretelang/Support/Constants.h index dc05f3b1a..c804802dc 100644 --- a/compiler/include/zamalang/Support/Constants.h +++ b/compiler/include/concretelang/Support/Constants.h @@ -1,13 +1,13 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_CONSTANTS_H_ -#define ZAMALANG_SUPPORT_CONSTANTS_H_ +#ifndef CONCRETELANG_SUPPORT_CONSTANTS_H_ +#define CONCRETELANG_SUPPORT_CONSTANTS_H_ namespace mlir { -namespace zamalang { +namespace concretelang { constexpr unsigned DEFAULT_PATTERN_BENEFIT = 1; -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif diff --git a/compiler/include/zamalang/Support/Error.h b/compiler/include/concretelang/Support/Error.h similarity index 90% rename from compiler/include/zamalang/Support/Error.h rename to compiler/include/concretelang/Support/Error.h index 3669f4d7e..04ee597f2 100644 --- a/compiler/include/zamalang/Support/Error.h +++ b/compiler/include/concretelang/Support/Error.h @@ -1,13 +1,13 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_STRING_ERROR_H -#define ZAMALANG_SUPPORT_STRING_ERROR_H +#ifndef CONCRETELANG_SUPPORT_STRING_ERROR_H +#define CONCRETELANG_SUPPORT_STRING_ERROR_H #include namespace mlir { -namespace zamalang { +namespace concretelang { // Internal error class that allows for composing `llvm::Error`s // similar to `llvm::createStringError()`, but using stream-like @@ -50,7 +50,7 @@ protected: StreamStringError &operator<<(StreamStringError &se, llvm::Error &err); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif diff --git a/compiler/include/zamalang/Support/Jit.h b/compiler/include/concretelang/Support/Jit.h similarity index 98% rename from compiler/include/zamalang/Support/Jit.h rename to compiler/include/concretelang/Support/Jit.h index 267d9f942..bd0b365b2 100644 --- a/compiler/include/zamalang/Support/Jit.h +++ b/compiler/include/concretelang/Support/Jit.h @@ -8,10 +8,10 @@ #include #include -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { /// JITLambda is a tool to JIT compile an mlir module and to invoke a function /// of the module. @@ -131,7 +131,7 @@ private: std::unique_ptr engine; }; -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif // COMPILER_JIT_H diff --git a/compiler/include/zamalang/Support/JitCompilerEngine.h b/compiler/include/concretelang/Support/JitCompilerEngine.h similarity index 95% rename from compiler/include/zamalang/Support/JitCompilerEngine.h rename to compiler/include/concretelang/Support/JitCompilerEngine.h index bdab8a0fb..0bbcf8c15 100644 --- a/compiler/include/zamalang/Support/JitCompilerEngine.h +++ b/compiler/include/concretelang/Support/JitCompilerEngine.h @@ -1,18 +1,18 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_JIT_COMPILER_ENGINE_H -#define ZAMALANG_SUPPORT_JIT_COMPILER_ENGINE_H +#ifndef CONCRETELANG_SUPPORT_JIT_COMPILER_ENGINE_H +#define CONCRETELANG_SUPPORT_JIT_COMPILER_ENGINE_H -#include "zamalang/Support/KeySetCache.h" +#include "concretelang/Support/KeySetCache.h" #include -#include -#include -#include -#include +#include +#include +#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { namespace { // Generic function template as well as specializations of @@ -246,7 +246,7 @@ public: operator()(llvm::ArrayRef lambdaArgs) { // Create the arguments of the JIT lambda llvm::Expected> argsOrErr = - mlir::zamalang::JITLambda::Argument::create(*this->keySet.get()); + mlir::concretelang::JITLambda::Argument::create(*this->keySet.get()); if (llvm::Error err = argsOrErr.takeError()) return StreamStringError("Could not create lambda arguments"); @@ -274,7 +274,7 @@ public: llvm::Expected operator()(const llvm::ArrayRef args) { // Create the arguments of the JIT lambda llvm::Expected> argsOrErr = - mlir::zamalang::JITLambda::Argument::create(*this->keySet.get()); + mlir::concretelang::JITLambda::Argument::create(*this->keySet.get()); if (llvm::Error err = argsOrErr.takeError()) return StreamStringError("Could not create lambda arguments"); @@ -302,7 +302,7 @@ public: llvm::Expected operator()(const Ts... ts) { // Create the arguments of the JIT lambda llvm::Expected> argsOrErr = - mlir::zamalang::JITLambda::Argument::create(*this->keySet.get()); + mlir::concretelang::JITLambda::Argument::create(*this->keySet.get()); if (llvm::Error err = argsOrErr.takeError()) return StreamStringError("Could not create lambda arguments"); @@ -387,7 +387,7 @@ protected: unsigned int optimizationLevel; }; -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif diff --git a/compiler/include/zamalang/Support/KeySet.h b/compiler/include/concretelang/Support/KeySet.h similarity index 93% rename from compiler/include/zamalang/Support/KeySet.h rename to compiler/include/concretelang/Support/KeySet.h index c0d473e32..cf754ba32 100644 --- a/compiler/include/zamalang/Support/KeySet.h +++ b/compiler/include/concretelang/Support/KeySet.h @@ -1,22 +1,22 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_KEYSET_H_ -#define ZAMALANG_SUPPORT_KEYSET_H_ +#ifndef CONCRETELANG_SUPPORT_KEYSET_H_ +#define CONCRETELANG_SUPPORT_KEYSET_H_ #include "llvm/Support/Error.h" #include extern "C" { #include "concrete-ffi.h" -#include "zamalang/Runtime/context.h" +#include "concretelang/Runtime/context.h" } -#include "zamalang/Support/ClientParameters.h" -#include "zamalang/Support/KeySetCache.h" +#include "concretelang/Support/ClientParameters.h" +#include "concretelang/Support/KeySetCache.h" namespace mlir { -namespace zamalang { +namespace concretelang { class KeySet { public: @@ -105,7 +105,7 @@ private: keyswitchKeys); }; -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Support/KeySetCache.h b/compiler/include/concretelang/Support/KeySetCache.h similarity index 80% rename from compiler/include/zamalang/Support/KeySetCache.h rename to compiler/include/concretelang/Support/KeySetCache.h index 3030610a9..3ef58d406 100644 --- a/compiler/include/zamalang/Support/KeySetCache.h +++ b/compiler/include/concretelang/Support/KeySetCache.h @@ -1,13 +1,13 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_KEYSETCACHE_H_ -#define ZAMALANG_SUPPORT_KEYSETCACHE_H_ +#ifndef CONCRETELANG_SUPPORT_KEYSETCACHE_H_ +#define CONCRETELANG_SUPPORT_KEYSETCACHE_H_ -#include "zamalang/Support/KeySet.h" +#include "concretelang/Support/KeySet.h" namespace mlir { -namespace zamalang { +namespace concretelang { class KeySet; @@ -28,7 +28,7 @@ private: llvm::SmallString<0> &folderPath); }; -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Support/LLVMEmitFile.h b/compiler/include/concretelang/Support/LLVMEmitFile.h similarity index 76% rename from compiler/include/zamalang/Support/LLVMEmitFile.h rename to compiler/include/concretelang/Support/LLVMEmitFile.h index 301efd2c2..da4709772 100644 --- a/compiler/include/zamalang/Support/LLVMEmitFile.h +++ b/compiler/include/concretelang/Support/LLVMEmitFile.h @@ -1,18 +1,18 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_LLVMEMITFILE -#define ZAMALANG_SUPPORT_LLVMEMITFILE +#ifndef CONCRETELANG_SUPPORT_LLVMEMITFILE +#define CONCRETELANG_SUPPORT_LLVMEMITFILE namespace mlir { -namespace zamalang { +namespace concretelang { llvm::Error emitObject(llvm::Module &module, std::string objectPath); llvm::Error emitLibrary(std::vector objectsPath, std::string libraryPath, std::string linker); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Support/LambdaArgument.h b/compiler/include/concretelang/Support/LambdaArgument.h similarity index 97% rename from compiler/include/zamalang/Support/LambdaArgument.h rename to compiler/include/concretelang/Support/LambdaArgument.h index ee28ae1c1..12fdb8c00 100644 --- a/compiler/include/zamalang/Support/LambdaArgument.h +++ b/compiler/include/concretelang/Support/LambdaArgument.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_LAMBDA_ARGUMENT_H -#define ZAMALANG_SUPPORT_LAMBDA_ARGUMENT_H +#ifndef CONCRETELANG_SUPPORT_LAMBDA_ARGUMENT_H +#define CONCRETELANG_SUPPORT_LAMBDA_ARGUMENT_H #include #include @@ -10,10 +10,10 @@ #include #include #include -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { // Abstract base class for lambda arguments class LambdaArgument @@ -185,7 +185,7 @@ protected: template char TensorLambdaArgument::ID = 0; -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif diff --git a/compiler/include/zamalang/Support/Pipeline.h b/compiler/include/concretelang/Support/Pipeline.h similarity index 89% rename from compiler/include/zamalang/Support/Pipeline.h rename to compiler/include/concretelang/Support/Pipeline.h index aec3447e3..f95b7b624 100644 --- a/compiler/include/zamalang/Support/Pipeline.h +++ b/compiler/include/concretelang/Support/Pipeline.h @@ -1,24 +1,24 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_PIPELINE_H_ -#define ZAMALANG_SUPPORT_PIPELINE_H_ +#ifndef CONCRETELANG_SUPPORT_PIPELINE_H_ +#define CONCRETELANG_SUPPORT_PIPELINE_H_ #include #include #include #include -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { namespace pipeline { mlir::LogicalResult autopar(mlir::MLIRContext &context, mlir::ModuleOp &module, std::function enablePass); -llvm::Expected> +llvm::Expected> getFHEConstraintsFromHLFHE(mlir::MLIRContext &context, mlir::ModuleOp &module, std::function enablePass); @@ -57,7 +57,7 @@ lowerLLVMDialectToLLVMIR(mlir::MLIRContext &context, mlir::ModuleOp &module); } // namespace pipeline -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif diff --git a/compiler/include/zamalang/Support/V0Curves.h b/compiler/include/concretelang/Support/V0Curves.h similarity index 89% rename from compiler/include/zamalang/Support/V0Curves.h rename to compiler/include/concretelang/Support/V0Curves.h index 8fee5dac6..c354809ad 100644 --- a/compiler/include/zamalang/Support/V0Curves.h +++ b/compiler/include/concretelang/Support/V0Curves.h @@ -1,13 +1,13 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_V0CURVES_H_ -#define ZAMALANG_SUPPORT_V0CURVES_H_ +#ifndef CONCRETELANG_SUPPORT_V0CURVES_H_ +#define CONCRETELANG_SUPPORT_V0CURVES_H_ #include namespace mlir { -namespace zamalang { +namespace concretelang { #define SECURITY_LEVEL_80 0 #define SECURITY_LEVEL_128 1 @@ -39,6 +39,6 @@ struct V0Curves { V0Curves *getV0Curves(int securityLevel, int keyFormat); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif \ No newline at end of file diff --git a/compiler/include/zamalang/Support/V0Parameters.h b/compiler/include/concretelang/Support/V0Parameters.h similarity index 61% rename from compiler/include/zamalang/Support/V0Parameters.h rename to compiler/include/concretelang/Support/V0Parameters.h index fc413fcfd..b6336a39d 100644 --- a/compiler/include/zamalang/Support/V0Parameters.h +++ b/compiler/include/concretelang/Support/V0Parameters.h @@ -1,17 +1,17 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_V0Parameter_H_ -#define ZAMALANG_SUPPORT_V0Parameter_H_ +#ifndef CONCRETELANG_SUPPORT_V0Parameter_H_ +#define CONCRETELANG_SUPPORT_V0Parameter_H_ -#include "zamalang/Conversion/Utils/GlobalFHEContext.h" +#include "concretelang/Conversion/Utils/GlobalFHEContext.h" #include namespace mlir { -namespace zamalang { +namespace concretelang { const V0Parameter *getV0Parameter(V0FHEConstraint constraint); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif diff --git a/compiler/include/zamalang/Support/logging.h b/compiler/include/concretelang/Support/logging.h similarity index 89% rename from compiler/include/zamalang/Support/logging.h rename to compiler/include/concretelang/Support/logging.h index 46e0cbaca..8721987bd 100644 --- a/compiler/include/zamalang/Support/logging.h +++ b/compiler/include/concretelang/Support/logging.h @@ -1,13 +1,13 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_LOGGING_H_ -#define ZAMALANG_SUPPORT_LOGGING_H_ +#ifndef CONCRETELANG_SUPPORT_LOGGING_H_ +#define CONCRETELANG_SUPPORT_LOGGING_H_ #include namespace mlir { -namespace zamalang { +namespace concretelang { // Returning references to instances of different classes `S` and `T` // is prohibited, even if `T` inherits from `S`. The wrapper class @@ -36,7 +36,7 @@ StreamWrap &log_error(void); StreamWrap &log_verbose(void); void setupLogging(bool verbose); bool isVerbose(); -} // namespace zamalang +} // namespace concretelang } // namespace mlir #endif diff --git a/compiler/include/zamalang/Support/math.h b/compiler/include/concretelang/Support/math.h similarity index 87% rename from compiler/include/zamalang/Support/math.h rename to compiler/include/concretelang/Support/math.h index 8130e38ce..85eba121a 100644 --- a/compiler/include/zamalang/Support/math.h +++ b/compiler/include/concretelang/Support/math.h @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_SUPPORT_MATH_H_ -#define ZAMALANG_SUPPORT_MATH_H_ +#ifndef CONCRETELANG_SUPPORT_MATH_H_ +#define CONCRETELANG_SUPPORT_MATH_H_ // Calculates (T)ceil(log2f(v)) // TODO: Replace with some fancy bit twiddling hack diff --git a/compiler/include/zamalang/Conversion/HLFHEToMidLFHE/Patterns.td b/compiler/include/zamalang/Conversion/HLFHEToMidLFHE/Patterns.td deleted file mode 100644 index d03998cf2..000000000 --- a/compiler/include/zamalang/Conversion/HLFHEToMidLFHE/Patterns.td +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef ZAMALANG_CONVERSION_HLFHETOMIDLFHE_PATTERNS -#define ZAMALANG_CONVERSION_HLFHETOMIDLFHE_PATTERNS - -include "mlir/Pass/PassBase.td" -include "zamalang/Dialect/HLFHE/IR/HLFHEOps.td" -include "zamalang/Dialect/MidLFHE/IR/MidLFHEOps.td" - -def createZeroGLWEOp : NativeCodeCall<"mlir::zamalang::createZeroGLWEOpFromHLFHE($_builder, $_loc, $0)">; - -def ZeroEintPattern : Pat< - (ZeroEintOp:$result), - (createZeroGLWEOp $result)>; - -def createAddGLWEIntOp : NativeCodeCall<"mlir::zamalang::createGLWEOpFromHLFHE($_builder, $_loc, $0, $1, $2)">; - -def AddEintIntPattern : Pat< - (AddEintIntOp:$result $arg0, $arg1), - (createAddGLWEIntOp $arg0, $arg1, $result)>; - -def createAddGLWEOp : NativeCodeCall<"mlir::zamalang::createGLWEOpFromHLFHE($_builder, $_loc, $0, $1, $2)">; - -def AddEintPattern : Pat< - (AddEintOp:$result $arg0, $arg1), - (createAddGLWEOp $arg0, $arg1, $result)>; - -def createSubIntGLWEOp : NativeCodeCall<"mlir::zamalang::createGLWEOpFromHLFHE($_builder, $_loc, $0, $1, $2)">; - -def SubIntEintPattern : Pat< - (SubIntEintOp:$result $arg0, $arg1), - (createSubIntGLWEOp $arg0, $arg1, $result)>; - -def createNegGLWEOp : NativeCodeCall<"mlir::zamalang::createGLWEOpFromHLFHE($_builder, $_loc, $0, $1)">; - -def NegEintPattern : Pat< - (NegEintOp:$result $arg0), - (createNegGLWEOp $arg0, $result)>; - -def createMulGLWEIntOp : NativeCodeCall<"mlir::zamalang::createGLWEOpFromHLFHE($_builder, $_loc, $0, $1, $2)">; - -def MulEintIntPattern : Pat< - (MulEintIntOp:$result $arg0, $arg1), - (createMulGLWEIntOp $arg0, $arg1, $result)>; - -def createApplyLookupTableGLWEOp : NativeCodeCall<"mlir::zamalang::createApplyLookupTableGLWEOpFromHLFHE($_builder, $_loc, $0, $1, $2)">; - -def ApplyLookupTableEintPattern : Pat< - (ApplyLookupTableEintOp:$result $arg0, $arg1), - (createApplyLookupTableGLWEOp $arg0, $arg1, $result)>; - -#endif diff --git a/compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/Patterns.td b/compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/Patterns.td deleted file mode 100644 index 5d5925271..000000000 --- a/compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/Patterns.td +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef ZAMALANG_CONVERSION_MIDLFHETOLOWLFHE_PATTERNS -#define ZAMALANG_CONVERSION_MIDLFHETOLOWLFHE_PATTERNS - -include "mlir/Pass/PassBase.td" -include "mlir/Dialect/StandardOps/IR/Ops.td" -include "zamalang/Dialect/LowLFHE/IR/LowLFHEOps.td" -include "zamalang/Dialect/MidLFHE/IR/MidLFHEOps.td" - -def createZeroLWEOp : NativeCodeCall<"mlir::zamalang::createZeroLWEOpFromMidLFHE($_builder, $_loc, $0)">; - -def ZeroGLWEPattern : Pat< - (ZeroGLWEOp:$result), - (createZeroLWEOp $result)>; - -def createAddLWEOp : NativeCodeCall<"mlir::zamalang::createLowLFHEOpFromMidLFHE($_builder, $_loc, $0, $1, $2)">; - -def AddGLWEPattern : Pat< - (AddGLWEOp:$result $arg0, $arg1), - (createAddLWEOp $arg0, $arg1, $result)>; - -def createAddPlainLweOp : NativeCodeCall<"mlir::zamalang::createAddPlainLweCiphertext($_builder, $_loc, $0, $1, $2)">; - -def AddGLWEIntPattern : Pat< - (AddGLWEIntOp:$result $arg0, $arg1), - (createAddPlainLweOp $arg0, $arg1, $result)>; - -def createMulClearLweOp : NativeCodeCall<"mlir::zamalang::createMulClearLweCiphertext($_builder, $_loc, $0, $1, $2)">; - -def MulGLWEIntPattern : Pat< - (MulGLWEIntOp:$result $arg0, $arg1), - (createMulClearLweOp $arg0, $arg1, $result)>; - -def createSubIntLweOp : NativeCodeCall<"mlir::zamalang::createSubIntLweCiphertext($_builder, $_loc, $0, $1, $2)">; - -def SubIntGLWEPattern : Pat< - (SubIntGLWEOp:$result $arg0, $arg1), - (createSubIntLweOp $arg0, $arg1, $result)>; - -def createNegLweOp : NativeCodeCall<"mlir::zamalang::createNegLweCiphertext($_builder, $_loc, $0, $1)">; - -def NegGLWEPattern : Pat< - (NegGLWEOp:$result $arg0), - (createNegLweOp $arg0, $result)>; - -def createPBS : NativeCodeCall<"mlir::zamalang::createPBS($_builder, $_loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9)">; - -def ApplyLookupTableGLWEPattern : Pat< - (ApplyLookupTable:$result $ct, $table, $glweDimension, $polynomialSize, $levelKS, $baseLogKS, $levelBS, $baseLogBS, $outputDimensionKS), - (createPBS $ct, $table, $glweDimension, $polynomialSize, $levelKS, $baseLogKS, $levelBS, $baseLogBS, $outputDimensionKS, $result)>; - -#endif diff --git a/compiler/include/zamalang/Conversion/Passes.h b/compiler/include/zamalang/Conversion/Passes.h deleted file mode 100644 index df731ed1a..000000000 --- a/compiler/include/zamalang/Conversion/Passes.h +++ /dev/null @@ -1,26 +0,0 @@ -// Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. -// See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. - -#ifndef ZAMALANG_TRANSFORMS_PASSES_H -#define ZAMALANG_TRANSFORMS_PASSES_H - -#include "mlir/Dialect/LLVMIR/LLVMDialect.h" -#include "mlir/Dialect/Linalg/IR/LinalgOps.h" -#include "mlir/Dialect/SCF/SCF.h" -#include "mlir/Dialect/StandardOps/IR/Ops.h" - -#include "zamalang/Conversion/HLFHETensorOpsToLinalg/Pass.h" -#include "zamalang/Conversion/HLFHEToMidLFHE/Pass.h" -#include "zamalang/Conversion/LowLFHEToConcreteCAPI/Pass.h" -#include "zamalang/Conversion/LowLFHEUnparametrize/Pass.h" -#include "zamalang/Conversion/MLIRLowerableDialectsToLLVM/Pass.h" -#include "zamalang/Conversion/MidLFHEGlobalParametrization/Pass.h" -#include "zamalang/Conversion/MidLFHEToLowLFHE/Pass.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEDialect.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.h" - -#define GEN_PASS_CLASSES -#include "zamalang/Conversion/Passes.h.inc" - -#endif diff --git a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.td b/compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.td deleted file mode 100644 index 27c307aed..000000000 --- a/compiler/include/zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.td +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef ZAMALANG_DIALECT_HLFHELinalg_IR_HLFHELinalg_TYPES -#define ZAMALANG_DIALECT_HLFHELinalg_IR_HLFHELinalg_TYPES - -include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.td" -include "mlir/IR/BuiltinTypes.td" -include "zamalang/Dialect/HLFHE/IR/HLFHETypes.td" - -class HLFHELinalg_Type traits = []> : - TypeDef { } - -#endif diff --git a/compiler/lib/Bindings/CMakeLists.txt b/compiler/lib/Bindings/CMakeLists.txt index a0ca7e6b5..c05900364 100644 --- a/compiler/lib/Bindings/CMakeLists.txt +++ b/compiler/lib/Bindings/CMakeLists.txt @@ -1,3 +1,3 @@ -if (ZAMALANG_BINDINGS_PYTHON_ENABLED) +if (CONCRETELANG_BINDINGS_PYTHON_ENABLED) add_subdirectory(Python) endif() \ No newline at end of file diff --git a/compiler/lib/Bindings/Python/CMakeLists.txt b/compiler/lib/Bindings/Python/CMakeLists.txt index 0ed8a40fc..4152aaf74 100644 --- a/compiler/lib/Bindings/Python/CMakeLists.txt +++ b/compiler/lib/Bindings/Python/CMakeLists.txt @@ -4,57 +4,57 @@ include(AddMLIRPython) # Decalare native Python extension ################################################################################ -declare_mlir_python_sources(ZamalangBindingsPythonExtension) +declare_mlir_python_sources(ConcretelangBindingsPythonExtension) -declare_mlir_python_extension(ZamalangBindingsPythonExtension.Core - MODULE_NAME _zamalang - ADD_TO_PARENT ZamalangBindingsPythonExtension +declare_mlir_python_extension(ConcretelangBindingsPythonExtension.Core + MODULE_NAME _concretelang + ADD_TO_PARENT ConcretelangBindingsPythonExtension SOURCES - ZamalangModule.cpp + ConcretelangModule.cpp HLFHEModule.cpp CompilerAPIModule.cpp EMBED_CAPI_LINK_LIBS - ZAMALANGCAPIHLFHE - ZAMALANGCAPIHLFHELINALG - ZAMALANGCAPISupport + CONCRETELANGCAPIHLFHE + CONCRETELANGCAPIHLFHELINALG + CONCRETELANGCAPISupport ) ################################################################################ # Declare python sources ################################################################################ -declare_mlir_python_sources(ZamalangBindingsPythonSources +declare_mlir_python_sources(ConcretelangBindingsPythonSources ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" SOURCES - zamalang/__init__.py - zamalang/compiler.py - zamalang/version.py - zamalang/dialects/__init__.py - zamalang/dialects/_ods_common.py) + concretelang/__init__.py + concretelang/compiler.py + concretelang/version.py + concretelang/dialects/__init__.py + concretelang/dialects/_ods_common.py) ################################################################################ # Declare dialect-specific bindings. ################################################################################ -declare_mlir_python_sources(ZamalangBindingsPythonSources.Dialects - ADD_TO_PARENT ZamalangBindingsPythonSources) +declare_mlir_python_sources(ConcretelangBindingsPythonSources.Dialects + ADD_TO_PARENT ConcretelangBindingsPythonSources) declare_mlir_dialect_python_bindings( - ADD_TO_PARENT ZamalangBindingsPythonSources.Dialects + ADD_TO_PARENT ConcretelangBindingsPythonSources.Dialects ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" - ZAMALANGBindingsPythonHLFHEOps - TD_FILE zamalang/dialects/HLFHEOps.td + CONCRETELANGBindingsPythonHLFHEOps + TD_FILE concretelang/dialects/HLFHEOps.td SOURCES - zamalang/dialects/hlfhe.py + concretelang/dialects/hlfhe.py DIALECT_NAME HLFHE) declare_mlir_dialect_python_bindings( - ADD_TO_PARENT ZamalangBindingsPythonSources.Dialects + ADD_TO_PARENT ConcretelangBindingsPythonSources.Dialects ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" - ZAMALANGBindingsPythonHLFHELinalgOps - TD_FILE zamalang/dialects/HLFHELinalgOps.td + CONCRETELANGBindingsPythonHLFHELinalgOps + TD_FILE concretelang/dialects/HLFHELinalgOps.td SOURCES - zamalang/dialects/hlfhelinalg.py + concretelang/dialects/hlfhelinalg.py DIALECT_NAME HLFHELinalg) @@ -63,44 +63,44 @@ declare_mlir_dialect_python_bindings( ################################################################################ # Bundle our own, self-contained CAPI library with all of our deps. -add_mlir_python_common_capi_library(ZamalangBindingsPythonCAPI - INSTALL_COMPONENT ZamalangBindingsPythonModules - INSTALL_DESTINATION python_packages/zamalang_core/mlir/_mlir_libs - # NOTE: When the MLIR API is relocated under zamalang, this would change to - # .../zamalang/_mlir_libs - OUTPUT_DIRECTORY "${ZAMALANG_PYTHON_PACKAGES_DIR}/zamalang_core/mlir/_mlir_libs" +add_mlir_python_common_capi_library(ConcretelangBindingsPythonCAPI + INSTALL_COMPONENT ConcretelangBindingsPythonModules + INSTALL_DESTINATION python_packages/concretelang_core/mlir/_mlir_libs + # NOTE: When the MLIR API is relocated under concretelang, this would change to + # .../concretelang/_mlir_libs + OUTPUT_DIRECTORY "${CONCRETELANG_PYTHON_PACKAGES_DIR}/concretelang_core/mlir/_mlir_libs" RELATIVE_INSTALL_ROOT "../../../.." DECLARED_SOURCES # TODO: This can be chopped down significantly for size. MLIRPythonSources MLIRPythonExtension.AllPassesRegistration - ZamalangBindingsPythonSources - ZamalangBindingsPythonExtension + ConcretelangBindingsPythonSources + ConcretelangBindingsPythonExtension ) # Bundle the MLIR python sources into our package. # The MLIR API is position independent, so we explicitly output it to the mlir/ -# folder as a temporary measure. It will eventually migrate under the zamalang/ -# folder and be accessible under the unified "import zamalang..." namespace. -add_mlir_python_modules(ZamalangMLIRPythonModules - ROOT_PREFIX "${ZAMALANG_PYTHON_PACKAGES_DIR}/zamalang_core/mlir" - INSTALL_PREFIX "python_packages/zamalang_core/mlir" +# folder as a temporary measure. It will eventually migrate under the concretelang/ +# folder and be accessible under the unified "import concretelang..." namespace. +add_mlir_python_modules(ConcretelangMLIRPythonModules + ROOT_PREFIX "${CONCRETELANG_PYTHON_PACKAGES_DIR}/concretelang_core/mlir" + INSTALL_PREFIX "python_packages/concretelang_core/mlir" DECLARED_SOURCES MLIRPythonSources MLIRPythonExtension.AllPassesRegistration # We need the circt extensions co-located with the MLIR extensions. When # the namespace is unified, this moves to the below. - ZamalangBindingsPythonExtension + ConcretelangBindingsPythonExtension COMMON_CAPI_LINK_LIBS - ZamalangBindingsPythonCAPI + ConcretelangBindingsPythonCAPI ) -# Bundle the ZAMALANG python sources into our package. -add_mlir_python_modules(ZamalangPythonModules - ROOT_PREFIX "${ZAMALANG_PYTHON_PACKAGES_DIR}/zamalang_core" - INSTALL_PREFIX "python_packages/zamalang_core" +# Bundle the CONCRETELANG python sources into our package. +add_mlir_python_modules(ConcretelangPythonModules + ROOT_PREFIX "${CONCRETELANG_PYTHON_PACKAGES_DIR}/concretelang_core" + INSTALL_PREFIX "python_packages/concretelang_core" DECLARED_SOURCES - ZamalangBindingsPythonSources + ConcretelangBindingsPythonSources COMMON_CAPI_LINK_LIBS - ZamalangBindingsPythonCAPI + ConcretelangBindingsPythonCAPI ) \ No newline at end of file diff --git a/compiler/lib/Bindings/Python/CompilerAPIModule.cpp b/compiler/lib/Bindings/Python/CompilerAPIModule.cpp index c8891d194..88a7314bf 100644 --- a/compiler/lib/Bindings/Python/CompilerAPIModule.cpp +++ b/compiler/lib/Bindings/Python/CompilerAPIModule.cpp @@ -2,10 +2,10 @@ // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. #include "CompilerAPIModule.h" -#include "zamalang-c/Support/CompilerEngine.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEOpsDialect.h.inc" -#include "zamalang/Support/Jit.h" -#include "zamalang/Support/JitCompilerEngine.h" +#include "concretelang-c/Support/CompilerEngine.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOpsDialect.h.inc" +#include "concretelang/Support/Jit.h" +#include "concretelang/Support/JitCompilerEngine.h" #include #include #include @@ -17,16 +17,16 @@ #include #include -using mlir::zamalang::JitCompilerEngine; -using mlir::zamalang::LambdaArgument; +using mlir::concretelang::JitCompilerEngine; +using mlir::concretelang::LambdaArgument; const char *noEmptyStringPtr(std::string &s) { return (s.empty()) ? nullptr : s.c_str(); } /// Populate the compiler API python module. -void mlir::zamalang::python::populateCompilerAPISubmodule(pybind11::module &m) { - m.doc() = "Zamalang compiler python API"; +void mlir::concretelang::python::populateCompilerAPISubmodule(pybind11::module &m) { + m.doc() = "Concretelang compiler python API"; m.def("round_trip", [](std::string mlir_input) { return roundTrip(mlir_input.c_str()); }); diff --git a/compiler/lib/Bindings/Python/CompilerAPIModule.h b/compiler/lib/Bindings/Python/CompilerAPIModule.h index ba3e15541..5b68b08dd 100644 --- a/compiler/lib/Bindings/Python/CompilerAPIModule.h +++ b/compiler/lib/Bindings/Python/CompilerAPIModule.h @@ -1,19 +1,19 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_PYTHON_COMPILER_API_MODULE_H -#define ZAMALANG_PYTHON_COMPILER_API_MODULE_H +#ifndef CONCRETELANG_PYTHON_COMPILER_API_MODULE_H +#define CONCRETELANG_PYTHON_COMPILER_API_MODULE_H #include namespace mlir { -namespace zamalang { +namespace concretelang { namespace python { void populateCompilerAPISubmodule(pybind11::module &m); } // namespace python -} // namespace zamalang +} // namespace concretelang } // namespace mlir -#endif // ZAMALANG_PYTHON_DIALECTMODULES_H \ No newline at end of file +#endif // CONCRETELANG_PYTHON_DIALECTMODULES_H \ No newline at end of file diff --git a/compiler/lib/Bindings/Python/ZamalangModule.cpp b/compiler/lib/Bindings/Python/ConcretelangModule.cpp similarity index 76% rename from compiler/lib/Bindings/Python/ZamalangModule.cpp rename to compiler/lib/Bindings/Python/ConcretelangModule.cpp index 51f711f67..03e9bb795 100644 --- a/compiler/lib/Bindings/Python/ZamalangModule.cpp +++ b/compiler/lib/Bindings/Python/ConcretelangModule.cpp @@ -7,8 +7,8 @@ #include "mlir-c/Bindings/Python/Interop.h" #include "mlir-c/Registration.h" #include "mlir/Bindings/Python/PybindAdaptors.h" -#include "zamalang-c/Dialect/HLFHE.h" -#include "zamalang-c/Dialect/HLFHELinalg.h" +#include "concretelang-c/Dialect/HLFHE.h" +#include "concretelang-c/Dialect/HLFHELinalg.h" #include "llvm-c/ErrorHandling.h" #include "llvm/Support/Signals.h" @@ -16,8 +16,8 @@ #include namespace py = pybind11; -PYBIND11_MODULE(_zamalang, m) { - m.doc() = "Zamalang Python Native Extension"; +PYBIND11_MODULE(_concretelang, m) { + m.doc() = "Concretelang Python Native Extension"; llvm::sys::PrintStackTraceOnErrorSignal(/*argv=*/""); LLVMEnablePrettyStackTrace(); @@ -28,7 +28,7 @@ PYBIND11_MODULE(_zamalang, m) { auto wrappedCapsule = capsule.attr(MLIR_PYTHON_CAPI_PTR_ATTR); MlirContext context = mlirPythonCapsuleToContext(wrappedCapsule.ptr()); - // Collect Zamalang dialects to register. + // Collect Concretelang dialects to register. MlirDialectHandle hlfhe = mlirGetDialectHandle__hlfhe__(); mlirDialectHandleRegisterDialect(hlfhe, context); mlirDialectHandleLoadDialect(hlfhe, context); @@ -36,11 +36,11 @@ PYBIND11_MODULE(_zamalang, m) { mlirDialectHandleRegisterDialect(hlfhelinalg, context); mlirDialectHandleLoadDialect(hlfhelinalg, context); }, - "Register Zamalang dialects on a PyMlirContext."); + "Register Concretelang dialects on a PyMlirContext."); py::module hlfhe = m.def_submodule("_hlfhe", "HLFHE API"); - mlir::zamalang::python::populateDialectHLFHESubmodule(hlfhe); + mlir::concretelang::python::populateDialectHLFHESubmodule(hlfhe); py::module api = m.def_submodule("_compiler", "Compiler API"); - mlir::zamalang::python::populateCompilerAPISubmodule(api); + mlir::concretelang::python::populateCompilerAPISubmodule(api); } \ No newline at end of file diff --git a/compiler/lib/Bindings/Python/DialectModules.h b/compiler/lib/Bindings/Python/DialectModules.h index 60227489b..cc3c6f417 100644 --- a/compiler/lib/Bindings/Python/DialectModules.h +++ b/compiler/lib/Bindings/Python/DialectModules.h @@ -1,19 +1,19 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#ifndef ZAMALANG_PYTHON_DIALECTMODULES_H -#define ZAMALANG_PYTHON_DIALECTMODULES_H +#ifndef CONCRETELANG_PYTHON_DIALECTMODULES_H +#define CONCRETELANG_PYTHON_DIALECTMODULES_H #include namespace mlir { -namespace zamalang { +namespace concretelang { namespace python { void populateDialectHLFHESubmodule(pybind11::module &m); } // namespace python -} // namespace zamalang +} // namespace concretelang } // namespace mlir -#endif // ZAMALANG_PYTHON_DIALECTMODULES_H \ No newline at end of file +#endif // CONCRETELANG_PYTHON_DIALECTMODULES_H \ No newline at end of file diff --git a/compiler/lib/Bindings/Python/HLFHEModule.cpp b/compiler/lib/Bindings/Python/HLFHEModule.cpp index ad74d2719..755d2abc3 100644 --- a/compiler/lib/Bindings/Python/HLFHEModule.cpp +++ b/compiler/lib/Bindings/Python/HLFHEModule.cpp @@ -3,7 +3,7 @@ #include "DialectModules.h" -#include "zamalang-c/Dialect/HLFHE.h" +#include "concretelang-c/Dialect/HLFHE.h" #include "mlir-c/BuiltinAttributes.h" #include "mlir/Bindings/Python/PybindAdaptors.h" @@ -15,11 +15,11 @@ #include #include -using namespace mlir::zamalang; +using namespace mlir::concretelang; using namespace mlir::python::adaptors; /// Populate the hlfhe python module. -void mlir::zamalang::python::populateDialectHLFHESubmodule( +void mlir::concretelang::python::populateDialectHLFHESubmodule( pybind11::module &m) { m.doc() = "HLFHE dialect Python native extension"; diff --git a/compiler/lib/Bindings/Python/zamalang/__init__.py b/compiler/lib/Bindings/Python/concretelang/__init__.py similarity index 75% rename from compiler/lib/Bindings/Python/zamalang/__init__.py rename to compiler/lib/Bindings/Python/concretelang/__init__.py index 66aa49487..99d2a59b0 100644 --- a/compiler/lib/Bindings/Python/zamalang/__init__.py +++ b/compiler/lib/Bindings/Python/concretelang/__init__.py @@ -1,6 +1,6 @@ # Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. # See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -"""Zamalang python module""" -from mlir._mlir_libs._zamalang import * +"""Concretelang python module""" +from mlir._mlir_libs._concretelang import * from .compiler import CompilerEngine, library diff --git a/compiler/lib/Bindings/Python/zamalang/compiler.py b/compiler/lib/Bindings/Python/concretelang/compiler.py similarity index 94% rename from compiler/lib/Bindings/Python/zamalang/compiler.py rename to compiler/lib/Bindings/Python/concretelang/compiler.py index 0823cdbdb..11a087e17 100644 --- a/compiler/lib/Bindings/Python/zamalang/compiler.py +++ b/compiler/lib/Bindings/Python/concretelang/compiler.py @@ -6,10 +6,10 @@ from collections.abc import Iterable import os from typing import List, Union -from mlir._mlir_libs._zamalang._compiler import JitCompilerEngine as _JitCompilerEngine -from mlir._mlir_libs._zamalang._compiler import LambdaArgument as _LambdaArgument -from mlir._mlir_libs._zamalang._compiler import round_trip as _round_trip -from mlir._mlir_libs._zamalang._compiler import library as _library +from mlir._mlir_libs._concretelang._compiler import JitCompilerEngine as _JitCompilerEngine +from mlir._mlir_libs._concretelang._compiler import LambdaArgument as _LambdaArgument +from mlir._mlir_libs._concretelang._compiler import round_trip as _round_trip +from mlir._mlir_libs._concretelang._compiler import library as _library import numpy as np @@ -36,7 +36,7 @@ def _lookup_runtime_lib() -> str: runtime_library_paths = [ filename for filename in os.listdir(libs_path) - if filename.startswith("libZamalangRuntime") + if filename.startswith("libConcretelangRuntime") ] assert len(runtime_library_paths) == 1, "should be one and only one runtime library" return os.path.join(libs_path, runtime_library_paths[0]) diff --git a/compiler/lib/Bindings/Python/zamalang/dialects/HLFHELinalgOps.td b/compiler/lib/Bindings/Python/concretelang/dialects/HLFHELinalgOps.td similarity index 67% rename from compiler/lib/Bindings/Python/zamalang/dialects/HLFHELinalgOps.td rename to compiler/lib/Bindings/Python/concretelang/dialects/HLFHELinalgOps.td index 5a7a1592c..7c0db2fbe 100644 --- a/compiler/lib/Bindings/Python/zamalang/dialects/HLFHELinalgOps.td +++ b/compiler/lib/Bindings/Python/concretelang/dialects/HLFHELinalgOps.td @@ -2,6 +2,6 @@ #define PYTHON_BINDINGS_HLFHELINALG_OPS include "mlir/Bindings/Python/Attributes.td" -include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.td" +include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.td" #endif diff --git a/compiler/lib/Bindings/Python/zamalang/dialects/HLFHEOps.td b/compiler/lib/Bindings/Python/concretelang/dialects/HLFHEOps.td similarity index 70% rename from compiler/lib/Bindings/Python/zamalang/dialects/HLFHEOps.td rename to compiler/lib/Bindings/Python/concretelang/dialects/HLFHEOps.td index c4ec57dfe..23ab36065 100644 --- a/compiler/lib/Bindings/Python/zamalang/dialects/HLFHEOps.td +++ b/compiler/lib/Bindings/Python/concretelang/dialects/HLFHEOps.td @@ -2,6 +2,6 @@ #define PYTHON_BINDINGS_HLFHE_OPS include "mlir/Bindings/Python/Attributes.td" -include "zamalang/Dialect/HLFHE/IR/HLFHEOps.td" +include "concretelang/Dialect/HLFHE/IR/HLFHEOps.td" #endif diff --git a/compiler/lib/Bindings/Python/zamalang/dialects/__init__.py b/compiler/lib/Bindings/Python/concretelang/dialects/__init__.py similarity index 100% rename from compiler/lib/Bindings/Python/zamalang/dialects/__init__.py rename to compiler/lib/Bindings/Python/concretelang/dialects/__init__.py diff --git a/compiler/lib/Bindings/Python/zamalang/dialects/_ods_common.py b/compiler/lib/Bindings/Python/concretelang/dialects/_ods_common.py similarity index 100% rename from compiler/lib/Bindings/Python/zamalang/dialects/_ods_common.py rename to compiler/lib/Bindings/Python/concretelang/dialects/_ods_common.py diff --git a/compiler/lib/Bindings/Python/zamalang/dialects/hlfhe.py b/compiler/lib/Bindings/Python/concretelang/dialects/hlfhe.py similarity index 82% rename from compiler/lib/Bindings/Python/zamalang/dialects/hlfhe.py rename to compiler/lib/Bindings/Python/concretelang/dialects/hlfhe.py index 0bd940439..de0a65a6f 100644 --- a/compiler/lib/Bindings/Python/zamalang/dialects/hlfhe.py +++ b/compiler/lib/Bindings/Python/concretelang/dialects/hlfhe.py @@ -3,4 +3,4 @@ """HLFHE dialect module""" from ._HLFHE_ops_gen import * -from mlir._mlir_libs._zamalang._hlfhe import * +from mlir._mlir_libs._concretelang._hlfhe import * diff --git a/compiler/lib/Bindings/Python/zamalang/dialects/hlfhelinalg.py b/compiler/lib/Bindings/Python/concretelang/dialects/hlfhelinalg.py similarity index 100% rename from compiler/lib/Bindings/Python/zamalang/dialects/hlfhelinalg.py rename to compiler/lib/Bindings/Python/concretelang/dialects/hlfhelinalg.py diff --git a/compiler/lib/Bindings/Python/zamalang/version.py b/compiler/lib/Bindings/Python/concretelang/version.py similarity index 100% rename from compiler/lib/Bindings/Python/zamalang/version.py rename to compiler/lib/Bindings/Python/concretelang/version.py diff --git a/compiler/lib/CAPI/Dialect/HLFHE/CMakeLists.txt b/compiler/lib/CAPI/Dialect/HLFHE/CMakeLists.txt index 112e1c3c7..2c1984ce2 100644 --- a/compiler/lib/CAPI/Dialect/HLFHE/CMakeLists.txt +++ b/compiler/lib/CAPI/Dialect/HLFHE/CMakeLists.txt @@ -1,6 +1,6 @@ set(LLVM_OPTIONAL_SOURCES HLFHE.cpp) -add_mlir_public_c_api_library(ZAMALANGCAPIHLFHE +add_mlir_public_c_api_library(CONCRETELANGCAPIHLFHE HLFHE.cpp diff --git a/compiler/lib/CAPI/Dialect/HLFHE/HLFHE.cpp b/compiler/lib/CAPI/Dialect/HLFHE/HLFHE.cpp index aa665c975..19601acfe 100644 --- a/compiler/lib/CAPI/Dialect/HLFHE/HLFHE.cpp +++ b/compiler/lib/CAPI/Dialect/HLFHE/HLFHE.cpp @@ -1,15 +1,15 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#include "zamalang-c/Dialect/HLFHE.h" +#include "concretelang-c/Dialect/HLFHE.h" #include "mlir/CAPI/IR.h" #include "mlir/CAPI/Registration.h" #include "mlir/CAPI/Support.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEDialect.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEOps.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHETypes.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEDialect.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOps.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHETypes.h" -using namespace mlir::zamalang::HLFHE; +using namespace mlir::concretelang::HLFHE; //===----------------------------------------------------------------------===// // Dialect API. diff --git a/compiler/lib/CAPI/Dialect/HLFHELinalg/CMakeLists.txt b/compiler/lib/CAPI/Dialect/HLFHELinalg/CMakeLists.txt index 1d41d3a56..2c7c77373 100644 --- a/compiler/lib/CAPI/Dialect/HLFHELinalg/CMakeLists.txt +++ b/compiler/lib/CAPI/Dialect/HLFHELinalg/CMakeLists.txt @@ -1,6 +1,6 @@ set(LLVM_OPTIONAL_SOURCES HLFHELinalg.cpp) -add_mlir_public_c_api_library(ZAMALANGCAPIHLFHELINALG +add_mlir_public_c_api_library(CONCRETELANGCAPIHLFHELINALG HLFHELinalg.cpp diff --git a/compiler/lib/CAPI/Dialect/HLFHELinalg/HLFHELinalg.cpp b/compiler/lib/CAPI/Dialect/HLFHELinalg/HLFHELinalg.cpp index 7e85e6d1c..bdb13d36e 100644 --- a/compiler/lib/CAPI/Dialect/HLFHELinalg/HLFHELinalg.cpp +++ b/compiler/lib/CAPI/Dialect/HLFHELinalg/HLFHELinalg.cpp @@ -1,15 +1,15 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#include "zamalang-c/Dialect/HLFHELinalg.h" +#include "concretelang-c/Dialect/HLFHELinalg.h" #include "mlir/CAPI/IR.h" #include "mlir/CAPI/Registration.h" #include "mlir/CAPI/Support.h" -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.h" -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h" -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.h" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h" -using namespace mlir::zamalang::HLFHELinalg; +using namespace mlir::concretelang::HLFHELinalg; //===----------------------------------------------------------------------===// // Dialect API. diff --git a/compiler/lib/CAPI/Support/CMakeLists.txt b/compiler/lib/CAPI/Support/CMakeLists.txt index 7dbd947be..f2d855e27 100644 --- a/compiler/lib/CAPI/Support/CMakeLists.txt +++ b/compiler/lib/CAPI/Support/CMakeLists.txt @@ -1,10 +1,10 @@ set(LLVM_OPTIONAL_SOURCES CompilerEngine.cpp) -add_mlir_public_c_api_library(ZAMALANGCAPISupport +add_mlir_public_c_api_library(CONCRETELANGCAPISupport CompilerEngine.cpp LINK_LIBS PUBLIC MLIRCAPIIR - ZamalangSupport + ConcretelangSupport ) diff --git a/compiler/lib/CAPI/Support/CompilerEngine.cpp b/compiler/lib/CAPI/Support/CompilerEngine.cpp index 4e8f93a57..306ba8d6e 100644 --- a/compiler/lib/CAPI/Support/CompilerEngine.cpp +++ b/compiler/lib/CAPI/Support/CompilerEngine.cpp @@ -3,31 +3,31 @@ #include "llvm/ADT/SmallString.h" -#include "zamalang-c/Support/CompilerEngine.h" -#include "zamalang/Support/CompilerEngine.h" -#include "zamalang/Support/Jit.h" -#include "zamalang/Support/JitCompilerEngine.h" -#include "zamalang/Support/KeySetCache.h" +#include "concretelang-c/Support/CompilerEngine.h" +#include "concretelang/Support/CompilerEngine.h" +#include "concretelang/Support/Jit.h" +#include "concretelang/Support/JitCompilerEngine.h" +#include "concretelang/Support/KeySetCache.h" -using mlir::zamalang::JitCompilerEngine; +using mlir::concretelang::JitCompilerEngine; -mlir::zamalang::JitCompilerEngine::Lambda +mlir::concretelang::JitCompilerEngine::Lambda buildLambda(const char *module, const char *funcName, const char *runtimeLibPath, const char *keySetCachePath) { // Set the runtime library path if not nullptr llvm::Optional runtimeLibPathOptional = {}; if (runtimeLibPath != nullptr) runtimeLibPathOptional = runtimeLibPath; - mlir::zamalang::JitCompilerEngine engine; + mlir::concretelang::JitCompilerEngine engine; - using KeySetCache = mlir::zamalang::KeySetCache; - using optKeySetCache = llvm::Optional; + using KeySetCache = mlir::concretelang::KeySetCache; + using optKeySetCache = llvm::Optional; auto cacheOpt = optKeySetCache(); if (keySetCachePath != nullptr) { cacheOpt = KeySetCache(std::string(keySetCachePath)); } - llvm::Expected lambdaOrErr = + llvm::Expected lambdaOrErr = engine.buildLambda(module, funcName, cacheOpt, runtimeLibPathOptional); if (!lambdaOrErr) { std::string backingString; @@ -40,23 +40,23 @@ buildLambda(const char *module, const char *funcName, } lambdaArgument invokeLambda(lambda l, executionArguments args) { - mlir::zamalang::JitCompilerEngine::Lambda *lambda_ptr = - (mlir::zamalang::JitCompilerEngine::Lambda *)l.ptr; + mlir::concretelang::JitCompilerEngine::Lambda *lambda_ptr = + (mlir::concretelang::JitCompilerEngine::Lambda *)l.ptr; if (args.size != lambda_ptr->getNumArguments()) { throw std::invalid_argument("wrong number of arguments"); } // Set the integer/tensor arguments - std::vector lambdaArgumentsRef; + std::vector lambdaArgumentsRef; for (auto i = 0; i < args.size; i++) { lambdaArgumentsRef.push_back(args.data[i].ptr.get()); } // Run lambda - llvm::Expected> resOrError = + llvm::Expected> resOrError = (*lambda_ptr) . - operator()>( - llvm::ArrayRef( + operator()>( + llvm::ArrayRef( lambdaArgumentsRef)); if (!resOrError) { @@ -71,15 +71,15 @@ lambdaArgument invokeLambda(lambda l, executionArguments args) { } std::string roundTrip(const char *module) { - std::shared_ptr ccx = - mlir::zamalang::CompilationContext::createShared(); - mlir::zamalang::JitCompilerEngine ce{ccx}; + std::shared_ptr ccx = + mlir::concretelang::CompilationContext::createShared(); + mlir::concretelang::JitCompilerEngine ce{ccx}; std::string backingString; llvm::raw_string_ostream os(backingString); - llvm::Expected retOrErr = - ce.compile(module, mlir::zamalang::CompilerEngine::Target::ROUND_TRIP); + llvm::Expected retOrErr = + ce.compile(module, mlir::concretelang::CompilerEngine::Target::ROUND_TRIP); if (!retOrErr) { os << "MLIR parsing failed: " << llvm::toString(std::move(retOrErr.takeError())); @@ -91,15 +91,15 @@ std::string roundTrip(const char *module) { } bool lambdaArgumentIsTensor(lambdaArgument &lambda_arg) { - return lambda_arg.ptr->isa>>(); + return lambda_arg.ptr->isa>>(); } std::vector lambdaArgumentGetTensorData(lambdaArgument &lambda_arg) { - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> *arg = - lambda_arg.ptr->dyn_cast>>(); + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> *arg = + lambda_arg.ptr->dyn_cast>>(); if (arg == nullptr) { throw std::invalid_argument( "LambdaArgument isn't a tensor, should " @@ -120,10 +120,10 @@ std::vector lambdaArgumentGetTensorData(lambdaArgument &lambda_arg) { std::vector lambdaArgumentGetTensorDimensions(lambdaArgument &lambda_arg) { - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> *arg = - lambda_arg.ptr->dyn_cast>>(); + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> *arg = + lambda_arg.ptr->dyn_cast>>(); if (arg == nullptr) { throw std::invalid_argument( "LambdaArgument isn't a tensor, should " @@ -133,12 +133,12 @@ lambdaArgumentGetTensorDimensions(lambdaArgument &lambda_arg) { } bool lambdaArgumentIsScalar(lambdaArgument &lambda_arg) { - return lambda_arg.ptr->isa>(); + return lambda_arg.ptr->isa>(); } uint64_t lambdaArgumentGetScalar(lambdaArgument &lambda_arg) { - mlir::zamalang::IntLambdaArgument *arg = - lambda_arg.ptr->dyn_cast>(); + mlir::concretelang::IntLambdaArgument *arg = + lambda_arg.ptr->dyn_cast>(); if (arg == nullptr) { throw std::invalid_argument("LambdaArgument isn't a scalar, should " "be an IntLambdaArgument"); @@ -149,38 +149,38 @@ uint64_t lambdaArgumentGetScalar(lambdaArgument &lambda_arg) { lambdaArgument lambdaArgumentFromTensorU8(std::vector data, std::vector dimensions) { lambdaArgument tensor_arg{ - std::make_shared>>(data, dimensions)}; + std::make_shared>>(data, dimensions)}; return tensor_arg; } lambdaArgument lambdaArgumentFromTensorU16(std::vector data, std::vector dimensions) { lambdaArgument tensor_arg{ - std::make_shared>>(data, dimensions)}; + std::make_shared>>(data, dimensions)}; return tensor_arg; } lambdaArgument lambdaArgumentFromTensorU32(std::vector data, std::vector dimensions) { lambdaArgument tensor_arg{ - std::make_shared>>(data, dimensions)}; + std::make_shared>>(data, dimensions)}; return tensor_arg; } lambdaArgument lambdaArgumentFromTensorU64(std::vector data, std::vector dimensions) { lambdaArgument tensor_arg{ - std::make_shared>>(data, dimensions)}; + std::make_shared>>(data, dimensions)}; return tensor_arg; } lambdaArgument lambdaArgumentFromScalar(uint64_t scalar) { lambdaArgument scalar_arg{ - std::make_shared>(scalar)}; + std::make_shared>(scalar)}; return scalar_arg; } @@ -191,7 +191,7 @@ std::runtime_error library_error(std::string prefix, llvm::Expected &error) { std::string library(std::string libraryPath, std::vector mlir_modules) { - using namespace mlir::zamalang; + using namespace mlir::concretelang; JitCompilerEngine ce{CompilationContext::createShared()}; auto lib = ce.compile(mlir_modules, libraryPath); diff --git a/compiler/lib/CMakeLists.txt b/compiler/lib/CMakeLists.txt index d12a91733..a8aede839 100644 --- a/compiler/lib/CMakeLists.txt +++ b/compiler/lib/CMakeLists.txt @@ -5,6 +5,6 @@ add_subdirectory(Runtime) add_subdirectory(Bindings) # CAPI needed only for python bindings -if (ZAMALANG_BINDINGS_PYTHON_ENABLED) +if (CONCRETELANG_BINDINGS_PYTHON_ENABLED) add_subdirectory(CAPI) endif() diff --git a/compiler/lib/Conversion/HLFHETensorOpsToLinalg/CMakeLists.txt b/compiler/lib/Conversion/HLFHETensorOpsToLinalg/CMakeLists.txt index 9af0bfef9..099ce4215 100644 --- a/compiler/lib/Conversion/HLFHETensorOpsToLinalg/CMakeLists.txt +++ b/compiler/lib/Conversion/HLFHETensorOpsToLinalg/CMakeLists.txt @@ -2,7 +2,7 @@ add_mlir_dialect_library(HLFHETensorOpsToLinalg TensorOpsToLinalg.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/HLFHE + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/HLFHE DEPENDS HLFHEDialect diff --git a/compiler/lib/Conversion/HLFHETensorOpsToLinalg/TensorOpsToLinalg.cpp b/compiler/lib/Conversion/HLFHETensorOpsToLinalg/TensorOpsToLinalg.cpp index 4db9c93d1..b6543fa9b 100644 --- a/compiler/lib/Conversion/HLFHETensorOpsToLinalg/TensorOpsToLinalg.cpp +++ b/compiler/lib/Conversion/HLFHETensorOpsToLinalg/TensorOpsToLinalg.cpp @@ -13,18 +13,18 @@ #include "llvm/ADT/SmallVector.h" #include -#include "zamalang/Conversion/Passes.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEDialect.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEOps.h" -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.h" -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h" -#include "zamalang/Support/Constants.h" +#include "concretelang/Conversion/Passes.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEDialect.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOps.h" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.h" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h" +#include "concretelang/Support/Constants.h" struct DotToLinalgGeneric - : public ::mlir::OpRewritePattern { + : public ::mlir::OpRewritePattern { DotToLinalgGeneric(::mlir::MLIRContext *context) - : ::mlir::OpRewritePattern<::mlir::zamalang::HLFHELinalg::Dot>( - context, mlir::zamalang::DEFAULT_PATTERN_BENEFIT) {} + : ::mlir::OpRewritePattern<::mlir::concretelang::HLFHELinalg::Dot>( + context, mlir::concretelang::DEFAULT_PATTERN_BENEFIT) {} // This rewrite pattern transforms any instance of // `HLFHELinalg.dot_eint_int` to an instance of `linalg.generic` with an @@ -63,10 +63,10 @@ struct DotToLinalgGeneric // %o = tensor.extract %2[%c0] : tensor<1x!HLFHE.eint<0>> // ::mlir::LogicalResult - matchAndRewrite(::mlir::zamalang::HLFHELinalg::Dot dotOp, + matchAndRewrite(::mlir::concretelang::HLFHELinalg::Dot dotOp, ::mlir::PatternRewriter &rewriter) const override { // Zero value to initialize accumulator - mlir::Value zeroCst = rewriter.create( + mlir::Value zeroCst = rewriter.create( dotOp.getLoc(), dotOp.lhs().getType().cast().getElementType()); @@ -95,11 +95,11 @@ struct DotToLinalgGeneric auto regBuilder = [&](mlir::OpBuilder &nestedBuilder, mlir::Location nestedLoc, mlir::ValueRange blockArgs) { - mlir::zamalang::HLFHE::MulEintIntOp mul = - nestedBuilder.create( + mlir::concretelang::HLFHE::MulEintIntOp mul = + nestedBuilder.create( dotOp.getLoc(), blockArgs[0], blockArgs[1]); - mlir::zamalang::HLFHE::AddEintOp add = - nestedBuilder.create( + mlir::concretelang::HLFHE::AddEintOp add = + nestedBuilder.create( dotOp.getLoc(), mul, blockArgs[2]); nestedBuilder.create(dotOp.getLoc(), @@ -222,7 +222,7 @@ struct HLFHELinalgOpToLinalgGeneric : public mlir::OpRewritePattern { HLFHELinalgOpToLinalgGeneric( ::mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) : ::mlir::OpRewritePattern(context, benefit) {} ::mlir::LogicalResult @@ -332,7 +332,7 @@ llvm::SmallVector parallelIteratorType(int n) { // !MidLFHE.glwe<{_,_,_}{2}> // } -> tensor<2x3x!MidLFHE.glwe<{_,_,_}{2}>> -namespace HLFHELinalg = mlir::zamalang::HLFHELinalg; +namespace HLFHELinalg = mlir::concretelang::HLFHELinalg; struct HLFHELinalgApplyMappedLookupTableToLinalgGeneric : public mlir::OpRewritePattern { @@ -347,7 +347,7 @@ struct HLFHELinalgApplyMappedLookupTableToLinalgGeneric namespace arith = mlir::arith; namespace linalg = mlir::linalg; namespace tensor = mlir::tensor; - namespace HLFHE = mlir::zamalang::HLFHE; + namespace HLFHE = mlir::concretelang::HLFHE; using Values = llvm::SmallVector; using Types = llvm::SmallVector; using AffineMaps = llvm::SmallVector; @@ -491,17 +491,17 @@ struct HLFHELinalgApplyMappedLookupTableToLinalgGeneric // struct HLFHELinalgApplyMultiLookupTableToLinalgGeneric : public mlir::OpRewritePattern< - mlir::zamalang::HLFHELinalg::ApplyMultiLookupTableEintOp> { + mlir::concretelang::HLFHELinalg::ApplyMultiLookupTableEintOp> { HLFHELinalgApplyMultiLookupTableToLinalgGeneric( ::mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) : ::mlir::OpRewritePattern< - mlir::zamalang::HLFHELinalg::ApplyMultiLookupTableEintOp>(context, + mlir::concretelang::HLFHELinalg::ApplyMultiLookupTableEintOp>(context, benefit) { } ::mlir::LogicalResult matchAndRewrite( - mlir::zamalang::HLFHELinalg::ApplyMultiLookupTableEintOp hlfheLinalgLutOp, + mlir::concretelang::HLFHELinalg::ApplyMultiLookupTableEintOp hlfheLinalgLutOp, ::mlir::PatternRewriter &rewriter) const override { mlir::RankedTensorType resultTy = ((mlir::Type)hlfheLinalgLutOp->getResult(0).getType()) @@ -542,8 +542,8 @@ struct HLFHELinalgApplyMultiLookupTableToLinalgGeneric mlir::tensor::FromElementsOp lut = nestedBuilder.create( hlfheLinalgLutOp.getLoc(), blockArgs.slice(1, lut_size)); - mlir::zamalang::HLFHE::ApplyLookupTableEintOp lutOp = - nestedBuilder.create( + mlir::concretelang::HLFHE::ApplyLookupTableEintOp lutOp = + nestedBuilder.create( hlfheLinalgLutOp.getLoc(), resultTy.getElementType(), blockArgs[0], lut.result()); @@ -612,16 +612,16 @@ struct HLFHELinalgApplyMultiLookupTableToLinalgGeneric // struct HLFHELinalgApplyLookupTableToLinalgGeneric : public mlir::OpRewritePattern< - mlir::zamalang::HLFHELinalg::ApplyLookupTableEintOp> { + mlir::concretelang::HLFHELinalg::ApplyLookupTableEintOp> { HLFHELinalgApplyLookupTableToLinalgGeneric( ::mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) : ::mlir::OpRewritePattern< - mlir::zamalang::HLFHELinalg::ApplyLookupTableEintOp>(context, + mlir::concretelang::HLFHELinalg::ApplyLookupTableEintOp>(context, benefit) {} ::mlir::LogicalResult - matchAndRewrite(mlir::zamalang::HLFHELinalg::ApplyLookupTableEintOp lutOp, + matchAndRewrite(mlir::concretelang::HLFHELinalg::ApplyLookupTableEintOp lutOp, ::mlir::PatternRewriter &rewriter) const override { mlir::RankedTensorType resultTy = ((mlir::Type)lutOp->getResult(0).getType()) @@ -649,8 +649,8 @@ struct HLFHELinalgApplyLookupTableToLinalgGeneric auto bodyBuilder = [&](mlir::OpBuilder &nestedBuilder, mlir::Location nestedLoc, mlir::ValueRange blockArgs) { - mlir::zamalang::HLFHE::ApplyLookupTableEintOp hlfheOp = - nestedBuilder.create( + mlir::concretelang::HLFHE::ApplyLookupTableEintOp hlfheOp = + nestedBuilder.create( lutOp.getLoc(), resultTy.getElementType(), blockArgs[0], lutOp.lut()); @@ -710,15 +710,15 @@ struct HLFHELinalgApplyLookupTableToLinalgGeneric // } // struct HLFHELinalgNegEintToLinalgGeneric - : public mlir::OpRewritePattern { + : public mlir::OpRewritePattern { HLFHELinalgNegEintToLinalgGeneric( ::mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) - : ::mlir::OpRewritePattern( + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) + : ::mlir::OpRewritePattern( context, benefit) {} ::mlir::LogicalResult - matchAndRewrite(mlir::zamalang::HLFHELinalg::NegEintOp negEintOp, + matchAndRewrite(mlir::concretelang::HLFHELinalg::NegEintOp negEintOp, ::mlir::PatternRewriter &rewriter) const override { mlir::RankedTensorType resultTy = ((mlir::Type)negEintOp->getResult(0).getType()) @@ -746,8 +746,8 @@ struct HLFHELinalgNegEintToLinalgGeneric auto bodyBuilder = [&](mlir::OpBuilder &nestedBuilder, mlir::Location nestedLoc, mlir::ValueRange blockArgs) { - mlir::zamalang::HLFHE::NegEintOp hlfheOp = - nestedBuilder.create( + mlir::concretelang::HLFHE::NegEintOp hlfheOp = + nestedBuilder.create( negEintOp.getLoc(), resultTy.getElementType(), blockArgs[0]); nestedBuilder.create(negEintOp.getLoc(), @@ -819,11 +819,11 @@ struct HLFHELinalgMatmulToLinalgGeneric : public mlir::OpRewritePattern { HLFHELinalgMatmulToLinalgGeneric( mlir::MLIRContext *context, - std::function createMulOp, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) : ::mlir::OpRewritePattern(context, benefit), createMulOp(createMulOp) {} @@ -840,8 +840,8 @@ struct HLFHELinalgMatmulToLinalgGeneric mlir::Location nestedLoc, mlir::ValueRange blockArgs) { // %z = "HLFHE.zero" : () -> !HLFHE.eint<2> - mlir::zamalang::HLFHE::ZeroEintOp zeroOp = - nestedBuilder.create( + mlir::concretelang::HLFHE::ZeroEintOp zeroOp = + nestedBuilder.create( matmulLoc, resultElementTy); // linalg.yield %z : !HLFHE.eint

nestedBuilder.create(matmulLoc, @@ -874,13 +874,13 @@ struct HLFHELinalgMatmulToLinalgGeneric mlir::Location nestedLoc, mlir::ValueRange blockArgs) { // "HLFHE.mul_eint_int"(%a, %b) : (!HLFHE.eint

, ip') -> !HLFHE.eint

- mlir::zamalang::HLFHE::MulEintIntOp mulEintIntOp = + mlir::concretelang::HLFHE::MulEintIntOp mulEintIntOp = createMulOp(nestedBuilder, matmulLoc, resultElementTy, blockArgs[0], blockArgs[1]); // "HLFHE.add_eint"(%c, %d): (!HLFHE.eint

, !HLFHE.eint

) -> // !HLFHE.eint

- mlir::zamalang::HLFHE::AddEintOp addEintOp = - nestedBuilder.create( + mlir::concretelang::HLFHE::AddEintOp addEintOp = + nestedBuilder.create( matmulLoc, resultElementTy, blockArgs[2], mulEintIntOp); // linalg.yield %e : !HLFHE.eint

nestedBuilder.create(matmulLoc, @@ -905,7 +905,7 @@ struct HLFHELinalgMatmulToLinalgGeneric }; private: - std::function createMulOp; }; @@ -927,16 +927,16 @@ private: // } : tensor> // struct HLFHELinalgZeroToLinalgGenerate - : public mlir::OpRewritePattern { + : public mlir::OpRewritePattern { HLFHELinalgZeroToLinalgGenerate( ::mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) - : ::mlir::OpRewritePattern(context, + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) + : ::mlir::OpRewritePattern(context, benefit) { } ::mlir::LogicalResult - matchAndRewrite(mlir::zamalang::HLFHELinalg::ZeroOp zeroOp, + matchAndRewrite(mlir::concretelang::HLFHELinalg::ZeroOp zeroOp, ::mlir::PatternRewriter &rewriter) const override { mlir::RankedTensorType resultTy = zeroOp->getResult(0).getType().cast(); @@ -945,7 +945,7 @@ struct HLFHELinalgZeroToLinalgGenerate mlir::Location nestedLoc, mlir::ValueRange blockArgs) { mlir::Value zeroScalar = - nestedBuilder.create( + nestedBuilder.create( zeroOp.getLoc(), resultTy.getElementType()); nestedBuilder.create(zeroOp.getLoc(), zeroScalar); }; @@ -974,44 +974,44 @@ void HLFHETensorOpsToLinalg::runOnFunction() { target.addLegalDialect(); target.addLegalDialect(); target.addLegalDialect(); - target.addLegalDialect(); + target.addLegalDialect(); target.addLegalDialect(); target.addLegalDialect(); - target.addIllegalOp(); - target.addIllegalDialect(); + target.addIllegalOp(); + target.addIllegalDialect(); mlir::OwningRewritePatternList patterns(&getContext()); patterns.insert(&getContext()); patterns.insert< - HLFHELinalgOpToLinalgGeneric>( + HLFHELinalgOpToLinalgGeneric>( &getContext()); patterns.insert< - HLFHELinalgOpToLinalgGeneric>( + HLFHELinalgOpToLinalgGeneric>( &getContext()); patterns.insert< - HLFHELinalgOpToLinalgGeneric>( + HLFHELinalgOpToLinalgGeneric>( &getContext()); patterns.insert< - HLFHELinalgOpToLinalgGeneric>( + HLFHELinalgOpToLinalgGeneric>( &getContext()); patterns.insert(&getContext()); patterns.insert(&getContext()); patterns.insert>( + mlir::concretelang::HLFHELinalg::MatMulEintIntOp>>( &getContext(), [](mlir::OpBuilder &builder, mlir::Location loc, mlir::Type type, mlir::Value arg0, mlir::Value arg1) { - return builder.create(loc, type, + return builder.create(loc, type, arg0, arg1); }); patterns.insert>( + mlir::concretelang::HLFHELinalg::MatMulIntEintOp>>( &getContext(), [](mlir::OpBuilder &builder, mlir::Location loc, mlir::Type type, mlir::Value arg0, mlir::Value arg1) { - return builder.create(loc, type, + return builder.create(loc, type, arg1, arg0); }); patterns.insert( @@ -1028,9 +1028,9 @@ void HLFHETensorOpsToLinalg::runOnFunction() { } // namespace namespace mlir { -namespace zamalang { +namespace concretelang { std::unique_ptr createConvertHLFHETensorOpsToLinalg() { return std::make_unique(); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Conversion/HLFHEToMidLFHE/CMakeLists.txt b/compiler/lib/Conversion/HLFHEToMidLFHE/CMakeLists.txt index 2821945b6..1628073a7 100644 --- a/compiler/lib/Conversion/HLFHEToMidLFHE/CMakeLists.txt +++ b/compiler/lib/Conversion/HLFHEToMidLFHE/CMakeLists.txt @@ -2,7 +2,7 @@ add_mlir_dialect_library(HLFHEToMidLFHE HLFHEToMidLFHE.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/HLFHE + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/HLFHE DEPENDS HLFHEDialect diff --git a/compiler/lib/Conversion/HLFHEToMidLFHE/HLFHEToMidLFHE.cpp b/compiler/lib/Conversion/HLFHEToMidLFHE/HLFHEToMidLFHE.cpp index 9b38404e1..f569d75cc 100644 --- a/compiler/lib/Conversion/HLFHEToMidLFHE/HLFHEToMidLFHE.cpp +++ b/compiler/lib/Conversion/HLFHEToMidLFHE/HLFHEToMidLFHE.cpp @@ -6,15 +6,15 @@ #include "mlir/Pass/Pass.h" #include "mlir/Transforms/DialectConversion.h" -#include "zamalang/Conversion/HLFHEToMidLFHE/Patterns.h" -#include "zamalang/Conversion/Passes.h" -#include "zamalang/Conversion/Utils/RegionOpTypeConverterPattern.h" -#include "zamalang/Conversion/Utils/TensorOpTypeConversion.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEDialect.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHETypes.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHETypes.h" -#include "zamalang/Dialect/RT/IR/RTOps.h" +#include "concretelang/Conversion/HLFHEToMidLFHE/Patterns.h" +#include "concretelang/Conversion/Passes.h" +#include "concretelang/Conversion/Utils/RegionOpTypeConverterPattern.h" +#include "concretelang/Conversion/Utils/TensorOpTypeConversion.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEDialect.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHETypes.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHETypes.h" +#include "concretelang/Dialect/RT/IR/RTOps.h" namespace { struct HLFHEToMidLFHEPass : public HLFHEToMidLFHEBase { @@ -22,8 +22,8 @@ struct HLFHEToMidLFHEPass : public HLFHEToMidLFHEBase { }; } // namespace -using mlir::zamalang::HLFHE::EncryptedIntegerType; -using mlir::zamalang::MidLFHE::GLWECipherTextType; +using mlir::concretelang::HLFHE::EncryptedIntegerType; +using mlir::concretelang::MidLFHE::GLWECipherTextType; /// HLFHEToMidLFHETypeConverter is a TypeConverter that transform /// `HLFHE.eint

` to `MidLFHE.glwe<{_,_,_}{p}>` @@ -33,7 +33,7 @@ public: HLFHEToMidLFHETypeConverter() { addConversion([](mlir::Type type) { return type; }); addConversion([](EncryptedIntegerType type) { - return mlir::zamalang::convertTypeEncryptedIntegerToGLWE( + return mlir::concretelang::convertTypeEncryptedIntegerToGLWE( type.getContext(), type); }); addConversion([](mlir::RankedTensorType type) { @@ -43,7 +43,7 @@ public: return (mlir::Type)(type); } mlir::Type r = mlir::RankedTensorType::get( - type.getShape(), mlir::zamalang::convertTypeEncryptedIntegerToGLWE( + type.getShape(), mlir::concretelang::convertTypeEncryptedIntegerToGLWE( eint.getContext(), eint)); return r; }); @@ -57,10 +57,10 @@ void HLFHEToMidLFHEPass::runOnOperation() { HLFHEToMidLFHETypeConverter converter; // Mark ops from the target dialect as legal operations - target.addLegalDialect(); + target.addLegalDialect(); // Make sure that no ops from `HLFHE` remain after the lowering - target.addIllegalDialect(); + target.addIllegalDialect(); // Make sure that no ops `linalg.generic` that have illegal types target @@ -92,14 +92,14 @@ void HLFHEToMidLFHEPass::runOnOperation() { HLFHEToMidLFHETypeConverter>>( &getContext(), converter); - mlir::zamalang::populateWithTensorTypeConverterPatterns(patterns, target, + mlir::concretelang::populateWithTensorTypeConverterPatterns(patterns, target, converter); mlir::populateFuncOpTypeConversionPattern(patterns, converter); // Conversion of RT Dialect Ops - patterns.add>(patterns.getContext(), converter); - mlir::zamalang::addDynamicallyLegalTypeOp( + patterns.add>(patterns.getContext(), converter); + mlir::concretelang::addDynamicallyLegalTypeOp( target, converter); // Apply conversion @@ -109,9 +109,9 @@ void HLFHEToMidLFHEPass::runOnOperation() { } namespace mlir { -namespace zamalang { +namespace concretelang { std::unique_ptr> createConvertHLFHEToMidLFHEPass() { return std::make_unique(); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Conversion/LowLFHEToConcreteCAPI/CMakeLists.txt b/compiler/lib/Conversion/LowLFHEToConcreteCAPI/CMakeLists.txt index 0ec258924..7f108edca 100644 --- a/compiler/lib/Conversion/LowLFHEToConcreteCAPI/CMakeLists.txt +++ b/compiler/lib/Conversion/LowLFHEToConcreteCAPI/CMakeLists.txt @@ -2,7 +2,7 @@ add_mlir_dialect_library(LowLFHEToConcreteCAPI LowLFHEToConcreteCAPI.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/HLFHE + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/HLFHE DEPENDS LowLFHEDialect diff --git a/compiler/lib/Conversion/LowLFHEToConcreteCAPI/LowLFHEToConcreteCAPI.cpp b/compiler/lib/Conversion/LowLFHEToConcreteCAPI/LowLFHEToConcreteCAPI.cpp index 35bca8008..a61ca14ec 100644 --- a/compiler/lib/Conversion/LowLFHEToConcreteCAPI/LowLFHEToConcreteCAPI.cpp +++ b/compiler/lib/Conversion/LowLFHEToConcreteCAPI/LowLFHEToConcreteCAPI.cpp @@ -9,21 +9,21 @@ #include "mlir/IR/SymbolTable.h" #include "mlir/Transforms/DialectConversion.h" -#include "zamalang/Conversion/Passes.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEOps.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHETypes.h" -#include "zamalang/Support/Constants.h" +#include "concretelang/Conversion/Passes.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEOps.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHETypes.h" +#include "concretelang/Support/Constants.h" class LowLFHEToConcreteCAPITypeConverter : public mlir::TypeConverter { public: LowLFHEToConcreteCAPITypeConverter() { addConversion([](mlir::Type type) { return type; }); - addConversion([&](mlir::zamalang::LowLFHE::PlaintextType type) { + addConversion([&](mlir::concretelang::LowLFHE::PlaintextType type) { return mlir::IntegerType::get(type.getContext(), 64); }); - addConversion([&](mlir::zamalang::LowLFHE::CleartextType type) { + addConversion([&](mlir::concretelang::LowLFHE::CleartextType type) { return mlir::IntegerType::get(type.getContext(), 64); }); } @@ -64,56 +64,56 @@ mlir::LogicalResult insertForwardDeclaration(mlir::Operation *op, // allocate them. All the calls to the C API should be done using this generic // types, and casting should then be performed back to the appropriate type. -inline mlir::zamalang::LowLFHE::LweCiphertextType +inline mlir::concretelang::LowLFHE::LweCiphertextType getGenericLweCiphertextType(mlir::MLIRContext *context) { - return mlir::zamalang::LowLFHE::LweCiphertextType::get(context, -1, -1); + return mlir::concretelang::LowLFHE::LweCiphertextType::get(context, -1, -1); } -inline mlir::zamalang::LowLFHE::GlweCiphertextType +inline mlir::concretelang::LowLFHE::GlweCiphertextType getGenericGlweCiphertextType(mlir::MLIRContext *context) { - return mlir::zamalang::LowLFHE::GlweCiphertextType::get(context); + return mlir::concretelang::LowLFHE::GlweCiphertextType::get(context); } -inline mlir::zamalang::LowLFHE::PlaintextType +inline mlir::concretelang::LowLFHE::PlaintextType getGenericPlaintextType(mlir::MLIRContext *context) { - return mlir::zamalang::LowLFHE::PlaintextType::get(context, -1); + return mlir::concretelang::LowLFHE::PlaintextType::get(context, -1); } -inline mlir::zamalang::LowLFHE::PlaintextListType +inline mlir::concretelang::LowLFHE::PlaintextListType getGenericPlaintextListType(mlir::MLIRContext *context) { - return mlir::zamalang::LowLFHE::PlaintextListType::get(context); + return mlir::concretelang::LowLFHE::PlaintextListType::get(context); } -inline mlir::zamalang::LowLFHE::ForeignPlaintextListType +inline mlir::concretelang::LowLFHE::ForeignPlaintextListType getGenericForeignPlaintextListType(mlir::MLIRContext *context) { - return mlir::zamalang::LowLFHE::ForeignPlaintextListType::get(context); + return mlir::concretelang::LowLFHE::ForeignPlaintextListType::get(context); } -inline mlir::zamalang::LowLFHE::CleartextType +inline mlir::concretelang::LowLFHE::CleartextType getGenericCleartextType(mlir::MLIRContext *context) { - return mlir::zamalang::LowLFHE::CleartextType::get(context, -1); + return mlir::concretelang::LowLFHE::CleartextType::get(context, -1); } -inline mlir::zamalang::LowLFHE::LweBootstrapKeyType +inline mlir::concretelang::LowLFHE::LweBootstrapKeyType getGenericLweBootstrapKeyType(mlir::MLIRContext *context) { - return mlir::zamalang::LowLFHE::LweBootstrapKeyType::get(context); + return mlir::concretelang::LowLFHE::LweBootstrapKeyType::get(context); } -inline mlir::zamalang::LowLFHE::LweKeySwitchKeyType +inline mlir::concretelang::LowLFHE::LweKeySwitchKeyType getGenericLweKeySwitchKeyType(mlir::MLIRContext *context) { - return mlir::zamalang::LowLFHE::LweKeySwitchKeyType::get(context); + return mlir::concretelang::LowLFHE::LweKeySwitchKeyType::get(context); } // Get the generic version of the type. // Useful when iterating over a set of types. mlir::Type getGenericType(mlir::Type baseType) { - if (baseType.isa()) { + if (baseType.isa()) { return getGenericLweCiphertextType(baseType.getContext()); } - if (baseType.isa()) { + if (baseType.isa()) { return getGenericPlaintextType(baseType.getContext()); } - if (baseType.isa()) { + if (baseType.isa()) { return getGenericCleartextType(baseType.getContext()); } return baseType; @@ -138,7 +138,7 @@ mlir::LogicalResult insertForwardDeclarations(mlir::Operation *op, auto genericBSKType = getGenericLweBootstrapKeyType(rewriter.getContext()); auto genericKSKType = getGenericLweKeySwitchKeyType(rewriter.getContext()); auto contextType = - mlir::zamalang::LowLFHE::ContextType::get(rewriter.getContext()); + mlir::concretelang::LowLFHE::ContextType::get(rewriter.getContext()); auto errType = mlir::IndexType::get(rewriter.getContext()); @@ -340,7 +340,7 @@ struct LowLFHEOpToConcreteCAPICallPattern : public mlir::OpRewritePattern { LowLFHEOpToConcreteCAPICallPattern( mlir::MLIRContext *context, mlir::StringRef funcName, mlir::StringRef allocName, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) : mlir::OpRewritePattern(context, benefit), funcName(funcName), allocName(allocName) {} @@ -350,7 +350,7 @@ struct LowLFHEOpToConcreteCAPICallPattern : public mlir::OpRewritePattern { mlir::Type resultType = op->getResultTypes().front(); auto lweResultType = - resultType.cast(); + resultType.cast(); // Replace the operation with a call to the `funcName` { // Create the err value @@ -403,20 +403,20 @@ private: }; struct LowLFHEZeroOpPattern - : public mlir::OpRewritePattern { + : public mlir::OpRewritePattern { LowLFHEZeroOpPattern( mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) - : mlir::OpRewritePattern(context, + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) + : mlir::OpRewritePattern(context, benefit) {} mlir::LogicalResult - matchAndRewrite(mlir::zamalang::LowLFHE::ZeroLWEOp op, + matchAndRewrite(mlir::concretelang::LowLFHE::ZeroLWEOp op, mlir::PatternRewriter &rewriter) const override { mlir::Type resultType = op->getResultTypes().front(); auto lweResultType = - resultType.cast(); + resultType.cast(); // Create the err value auto errOp = rewriter.create( op.getLoc(), rewriter.getIndexAttr(0)); @@ -439,15 +439,15 @@ struct LowLFHEZeroOpPattern }; struct LowLFHEEncodeIntOpPattern - : public mlir::OpRewritePattern { + : public mlir::OpRewritePattern { LowLFHEEncodeIntOpPattern( mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) - : mlir::OpRewritePattern(context, + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) + : mlir::OpRewritePattern(context, benefit) {} mlir::LogicalResult - matchAndRewrite(mlir::zamalang::LowLFHE::EncodeIntOp op, + matchAndRewrite(mlir::concretelang::LowLFHE::EncodeIntOp op, mlir::PatternRewriter &rewriter) const override { { mlir::Value castedInt = rewriter.create( @@ -464,15 +464,15 @@ struct LowLFHEEncodeIntOpPattern }; struct LowLFHEIntToCleartextOpPattern - : public mlir::OpRewritePattern { + : public mlir::OpRewritePattern { LowLFHEIntToCleartextOpPattern( mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) - : mlir::OpRewritePattern( + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) + : mlir::OpRewritePattern( context, benefit) {} mlir::LogicalResult - matchAndRewrite(mlir::zamalang::LowLFHE::IntToCleartextOp op, + matchAndRewrite(mlir::concretelang::LowLFHE::IntToCleartextOp op, mlir::PatternRewriter &rewriter) const override { rewriter.replaceOpWithNewOp( op, rewriter.getIntegerType(64), op->getOperands().front()); @@ -489,15 +489,15 @@ struct LowLFHEIntToCleartextOpPattern // - construct the GLWE accumulator by adding the plaintext_list to a freshly // allocated GLWE struct GlweFromTableOpPattern - : public mlir::OpRewritePattern { + : public mlir::OpRewritePattern { GlweFromTableOpPattern( mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) - : mlir::OpRewritePattern( + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) + : mlir::OpRewritePattern( context, benefit) {} mlir::LogicalResult - matchAndRewrite(mlir::zamalang::LowLFHE::GlweFromTable op, + matchAndRewrite(mlir::concretelang::LowLFHE::GlweFromTable op, mlir::PatternRewriter &rewriter) const override { LowLFHEToConcreteCAPITypeConverter typeConverter; auto errType = mlir::IndexType::get(rewriter.getContext()); @@ -589,7 +589,7 @@ mlir::Value getContextArgument(mlir::Operation *op) { mlir::Value context = block->getArguments().back(); - assert(context.getType().isa() && + assert(context.getType().isa() && "the LowLFHE.context should be the last argument of the enclosing " "function of the op"); @@ -607,22 +607,22 @@ mlir::Value getContextArgument(mlir::Operation *op) { // - use the key and the input accumulator (GLWE) to bootstrap the input // ciphertext struct LowLFHEBootstrapLweOpPattern - : public mlir::OpRewritePattern { + : public mlir::OpRewritePattern { LowLFHEBootstrapLweOpPattern( mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) - : mlir::OpRewritePattern( + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) + : mlir::OpRewritePattern( context, benefit) {} mlir::LogicalResult - matchAndRewrite(mlir::zamalang::LowLFHE::BootstrapLweOp op, + matchAndRewrite(mlir::concretelang::LowLFHE::BootstrapLweOp op, mlir::PatternRewriter &rewriter) const override { auto resultType = op->getResultTypes().front(); auto errOp = rewriter.create( op.getLoc(), rewriter.getIndexAttr(0)); // Get the size from the dimension int64_t outputLweDimension = - resultType.cast() + resultType.cast() .getDimension(); int64_t outputLweSize = outputLweDimension + 1; mlir::Value lweSizeOp = rewriter.create( @@ -671,15 +671,15 @@ struct LowLFHEBootstrapLweOpPattern // - get the global keyswitch key // - use the key to keyswitch the input ciphertext struct LowLFHEKeySwitchLweOpPattern - : public mlir::OpRewritePattern { + : public mlir::OpRewritePattern { LowLFHEKeySwitchLweOpPattern( mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) - : mlir::OpRewritePattern( + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) + : mlir::OpRewritePattern( context, benefit) {} mlir::LogicalResult - matchAndRewrite(mlir::zamalang::LowLFHE::KeySwitchLweOp op, + matchAndRewrite(mlir::concretelang::LowLFHE::KeySwitchLweOp op, mlir::PatternRewriter &rewriter) const override { auto errOp = rewriter.create( op.getLoc(), rewriter.getIndexAttr(0)); @@ -687,7 +687,7 @@ struct LowLFHEKeySwitchLweOpPattern int64_t lweDimension = op.getResult() .getType() - .cast() + .cast() .getDimension(); int64_t lweSize = lweDimension + 1; mlir::Value lweSizeOp = rewriter.create( @@ -728,19 +728,19 @@ struct LowLFHEKeySwitchLweOpPattern /// operators to the corresponding function call to the `Concrete C API`. void populateLowLFHEToConcreteCAPICall(mlir::RewritePatternSet &patterns) { patterns.add>( + mlir::concretelang::LowLFHE::AddLweCiphertextsOp>>( patterns.getContext(), "add_lwe_ciphertexts_u64", "allocate_lwe_ciphertext_u64"); patterns.add>( + mlir::concretelang::LowLFHE::AddPlaintextLweCiphertextOp>>( patterns.getContext(), "add_plaintext_lwe_ciphertext_u64", "allocate_lwe_ciphertext_u64"); patterns.add>( + mlir::concretelang::LowLFHE::MulCleartextLweCiphertextOp>>( patterns.getContext(), "mul_cleartext_lwe_ciphertext_u64", "allocate_lwe_ciphertext_u64"); patterns.add>( + mlir::concretelang::LowLFHE::NegateLweCiphertextOp>>( patterns.getContext(), "negate_lwe_ciphertext_u64", "allocate_lwe_ciphertext_u64"); patterns.add(patterns.getContext()); @@ -755,7 +755,7 @@ struct AddRuntimeContextToFuncOpPattern : public mlir::OpRewritePattern { AddRuntimeContextToFuncOpPattern( mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) : mlir::OpRewritePattern(context, benefit) {} mlir::LogicalResult @@ -768,7 +768,7 @@ struct AddRuntimeContextToFuncOpPattern mlir::SmallVector newInputs(oldFuncType.getInputs().begin(), oldFuncType.getInputs().end()); newInputs.push_back( - rewriter.getType()); + rewriter.getType()); mlir::FunctionType newFuncTy = rewriter.getType( newInputs, oldFuncType.getResults()); // Create the new func @@ -806,7 +806,7 @@ struct AddRuntimeContextToFuncOpPattern // if (auto tensorTy = t.dyn_cast_or_null()) { // t = tensorTy.getElementType(); // } - // return llvm::isa( + // return llvm::isa( // t.getDialect()); // })) { // return true; @@ -815,7 +815,7 @@ struct AddRuntimeContextToFuncOpPattern funcOp.getType() .getInputs() .back() - .isa(); + .isa(); } }; @@ -859,7 +859,7 @@ void LowLFHEToConcreteCAPIPass::runOnOperation() { mlir::ConversionTarget target(getContext()); mlir::RewritePatternSet patterns(&getContext()); - target.addIllegalDialect(); + target.addIllegalDialect(); target.addLegalDialect(); @@ -874,10 +874,10 @@ void LowLFHEToConcreteCAPIPass::runOnOperation() { } namespace mlir { -namespace zamalang { +namespace concretelang { std::unique_ptr> createConvertLowLFHEToConcreteCAPIPass() { return std::make_unique(); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Conversion/LowLFHEUnparametrize/CMakeLists.txt b/compiler/lib/Conversion/LowLFHEUnparametrize/CMakeLists.txt index 6f86ec7d5..46b50ce54 100644 --- a/compiler/lib/Conversion/LowLFHEUnparametrize/CMakeLists.txt +++ b/compiler/lib/Conversion/LowLFHEUnparametrize/CMakeLists.txt @@ -2,7 +2,7 @@ add_mlir_dialect_library(LowLFHEUnparametrize LowLFHEUnparametrize.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/HLFHE + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/HLFHE DEPENDS LowLFHEDialect diff --git a/compiler/lib/Conversion/LowLFHEUnparametrize/LowLFHEUnparametrize.cpp b/compiler/lib/Conversion/LowLFHEUnparametrize/LowLFHEUnparametrize.cpp index d62d81320..7c1b62a05 100644 --- a/compiler/lib/Conversion/LowLFHEUnparametrize/LowLFHEUnparametrize.cpp +++ b/compiler/lib/Conversion/LowLFHEUnparametrize/LowLFHEUnparametrize.cpp @@ -4,14 +4,14 @@ #include "mlir/Pass/Pass.h" #include "mlir/Transforms/DialectConversion.h" -#include "zamalang/Conversion/Passes.h" -#include "zamalang/Conversion/Utils/RegionOpTypeConverterPattern.h" -#include "zamalang/Conversion/Utils/TensorOpTypeConversion.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEOps.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHETypes.h" -#include "zamalang/Dialect/RT/IR/RTOps.h" -#include "zamalang/Support/Constants.h" +#include "concretelang/Conversion/Passes.h" +#include "concretelang/Conversion/Utils/RegionOpTypeConverterPattern.h" +#include "concretelang/Conversion/Utils/TensorOpTypeConversion.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEOps.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHETypes.h" +#include "concretelang/Dialect/RT/IR/RTOps.h" +#include "concretelang/Support/Constants.h" /// LowLFHEUnparametrizeTypeConverter is a type converter that unparametrize /// LowLFHE types @@ -19,14 +19,14 @@ class LowLFHEUnparametrizeTypeConverter : public mlir::TypeConverter { public: static mlir::Type unparematrizeLowLFHEType(mlir::Type type) { - if (type.isa()) { + if (type.isa()) { return mlir::IntegerType::get(type.getContext(), 64); } - if (type.isa()) { + if (type.isa()) { return mlir::IntegerType::get(type.getContext(), 64); } - if (type.isa()) { - return mlir::zamalang::LowLFHE::LweCiphertextType::get(type.getContext(), + if (type.isa()) { + return mlir::concretelang::LowLFHE::LweCiphertextType::get(type.getContext(), -1, -1); } auto tensorType = type.dyn_cast_or_null(); @@ -53,16 +53,16 @@ struct LowLFHEUnrealizedCastReplacementPattern : public mlir::OpRewritePattern { LowLFHEUnrealizedCastReplacementPattern( mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) : mlir::OpRewritePattern(context, benefit) {} mlir::LogicalResult matchAndRewrite(mlir::UnrealizedConversionCastOp op, mlir::PatternRewriter &rewriter) const override { - if (mlir::isa( + if (mlir::isa( op.getOperandTypes()[0].getDialect()) || - mlir::isa( + mlir::isa( op.getType(0).getDialect())) { rewriter.replaceOp(op, op.getOperands()); return mlir::success(); @@ -114,23 +114,23 @@ void LowLFHEUnparametrizePass::runOnOperation() { mlir::populateFuncOpTypeConversionPattern(patterns, converter); // Replacement of unrealized_conversion_cast - mlir::zamalang::addDynamicallyLegalTypeOp( + mlir::concretelang::addDynamicallyLegalTypeOp( target, converter); patterns.add(patterns.getContext()); // Conversion of tensor operators - mlir::zamalang::populateWithTensorTypeConverterPatterns(patterns, target, + mlir::concretelang::populateWithTensorTypeConverterPatterns(patterns, target, converter); // Conversion of CallOp - patterns.add>( + patterns.add>( patterns.getContext(), converter); - mlir::zamalang::addDynamicallyLegalTypeOp(target, converter); + mlir::concretelang::addDynamicallyLegalTypeOp(target, converter); // Conversion of RT Dialect Ops - patterns.add>(patterns.getContext(), converter); - mlir::zamalang::addDynamicallyLegalTypeOp( + patterns.add>(patterns.getContext(), converter); + mlir::concretelang::addDynamicallyLegalTypeOp( target, converter); // Apply conversion @@ -140,10 +140,10 @@ void LowLFHEUnparametrizePass::runOnOperation() { } namespace mlir { -namespace zamalang { +namespace concretelang { std::unique_ptr> createConvertLowLFHEUnparametrizePass() { return std::make_unique(); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Conversion/MLIRLowerableDialectsToLLVM/MLIRLowerableDialectsToLLVM.cpp b/compiler/lib/Conversion/MLIRLowerableDialectsToLLVM/MLIRLowerableDialectsToLLVM.cpp index a34d10ca1..7bf4ba8b0 100644 --- a/compiler/lib/Conversion/MLIRLowerableDialectsToLLVM/MLIRLowerableDialectsToLLVM.cpp +++ b/compiler/lib/Conversion/MLIRLowerableDialectsToLLVM/MLIRLowerableDialectsToLLVM.cpp @@ -20,10 +20,10 @@ #include "mlir/Transforms/DialectConversion.h" #include "llvm/ADT/Sequence.h" -#include "zamalang/Conversion/Passes.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHETypes.h" -#include "zamalang/Dialect/RT/Analysis/Autopar.h" -#include "zamalang/Dialect/RT/IR/RTTypes.h" +#include "concretelang/Conversion/Passes.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHETypes.h" +#include "concretelang/Dialect/RT/Analysis/Autopar.h" +#include "concretelang/Dialect/RT/IR/RTTypes.h" namespace { struct MLIRLowerableDialectsToLLVMPass @@ -47,17 +47,17 @@ void MLIRLowerableDialectsToLLVMPass::runOnOperation() { mlir::LowerToLLVMOptions options(&getContext()); mlir::LLVMTypeConverter typeConverter(&getContext(), options); typeConverter.addConversion(convertTypes); - typeConverter.addConversion([&](mlir::zamalang::LowLFHE::PlaintextType type) { + typeConverter.addConversion([&](mlir::concretelang::LowLFHE::PlaintextType type) { return mlir::IntegerType::get(type.getContext(), 64); }); - typeConverter.addConversion([&](mlir::zamalang::LowLFHE::CleartextType type) { + typeConverter.addConversion([&](mlir::concretelang::LowLFHE::CleartextType type) { return mlir::IntegerType::get(type.getContext(), 64); }); // Setup the set of the patterns rewriter. At this point we want to // convert the `scf` operations to `std` and `std` operations to `llvm`. mlir::RewritePatternSet patterns(&getContext()); - mlir::zamalang::populateRTToLLVMConversionPatterns(typeConverter, patterns); + mlir::concretelang::populateRTToLLVMConversionPatterns(typeConverter, patterns); mlir::populateStdToLLVMConversionPatterns(typeConverter, patterns); mlir::arith::populateArithmeticToLLVMConversionPatterns(typeConverter, patterns); @@ -72,31 +72,31 @@ void MLIRLowerableDialectsToLLVMPass::runOnOperation() { llvm::Optional MLIRLowerableDialectsToLLVMPass::convertTypes(mlir::Type type) { - if (type.isa() || - type.isa() || - type.isa() || - type.isa() || - type.isa() || - type.isa() || - type.isa() || - type.isa()) { + if (type.isa() || + type.isa() || + type.isa() || + type.isa() || + type.isa() || + type.isa() || + type.isa() || + type.isa()) { return mlir::LLVM::LLVMPointerType::get( mlir::IntegerType::get(type.getContext(), 64)); } - if (type.isa()) { + if (type.isa()) { mlir::LowerToLLVMOptions options(type.getContext()); mlir::LLVMTypeConverter typeConverter(type.getContext(), options); typeConverter.addConversion(convertTypes); typeConverter.addConversion( - [&](mlir::zamalang::LowLFHE::PlaintextType type) { + [&](mlir::concretelang::LowLFHE::PlaintextType type) { return mlir::IntegerType::get(type.getContext(), 64); }); typeConverter.addConversion( - [&](mlir::zamalang::LowLFHE::CleartextType type) { + [&](mlir::concretelang::LowLFHE::CleartextType type) { return mlir::IntegerType::get(type.getContext(), 64); }); mlir::Type subtype = - type.dyn_cast().getElementType(); + type.dyn_cast().getElementType(); mlir::Type convertedSubtype = typeConverter.convertType(subtype); return mlir::LLVM::LLVMPointerType::get(convertedSubtype); } @@ -104,12 +104,12 @@ MLIRLowerableDialectsToLLVMPass::convertTypes(mlir::Type type) { } namespace mlir { -namespace zamalang { +namespace concretelang { /// Create a pass for lowering operations the remaining mlir dialects /// operations, to the LLVM dialect for codegen. std::unique_ptr> createConvertMLIRLowerableDialectsToLLVMPass() { return std::make_unique(); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Conversion/MidLFHEGlobalParametrization/CMakeLists.txt b/compiler/lib/Conversion/MidLFHEGlobalParametrization/CMakeLists.txt index 1094979d8..075c9f2b9 100644 --- a/compiler/lib/Conversion/MidLFHEGlobalParametrization/CMakeLists.txt +++ b/compiler/lib/Conversion/MidLFHEGlobalParametrization/CMakeLists.txt @@ -2,7 +2,7 @@ add_mlir_dialect_library(MidLFHEGlobalParametrization MidLFHEGlobalParametrization.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/MidLFHE + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/MidLFHE DEPENDS MidLFHEDialect diff --git a/compiler/lib/Conversion/MidLFHEGlobalParametrization/MidLFHEGlobalParametrization.cpp b/compiler/lib/Conversion/MidLFHEGlobalParametrization/MidLFHEGlobalParametrization.cpp index 127d8f4c9..417c9cfc9 100644 --- a/compiler/lib/Conversion/MidLFHEGlobalParametrization/MidLFHEGlobalParametrization.cpp +++ b/compiler/lib/Conversion/MidLFHEGlobalParametrization/MidLFHEGlobalParametrization.cpp @@ -4,27 +4,27 @@ #include "mlir/Pass/Pass.h" #include "mlir/Transforms/DialectConversion.h" -#include "zamalang/Conversion/Passes.h" -#include "zamalang/Conversion/Utils/RegionOpTypeConverterPattern.h" -#include "zamalang/Conversion/Utils/TensorOpTypeConversion.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEOps.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHETypes.h" -#include "zamalang/Dialect/RT/IR/RTOps.h" -#include "zamalang/Support/Constants.h" +#include "concretelang/Conversion/Passes.h" +#include "concretelang/Conversion/Utils/RegionOpTypeConverterPattern.h" +#include "concretelang/Conversion/Utils/TensorOpTypeConversion.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEOps.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHETypes.h" +#include "concretelang/Dialect/RT/IR/RTOps.h" +#include "concretelang/Support/Constants.h" namespace { struct MidLFHEGlobalParametrizationPass : public MidLFHEGlobalParametrizationBase< MidLFHEGlobalParametrizationPass> { - MidLFHEGlobalParametrizationPass(mlir::zamalang::V0FHEContext &fheContext) + MidLFHEGlobalParametrizationPass(mlir::concretelang::V0FHEContext &fheContext) : fheContext(fheContext){}; void runOnOperation() final; - mlir::zamalang::V0FHEContext &fheContext; + mlir::concretelang::V0FHEContext &fheContext; }; } // namespace -using mlir::zamalang::MidLFHE::GLWECipherTextType; +using mlir::concretelang::MidLFHE::GLWECipherTextType; /// MidLFHEGlobalParametrizationTypeConverter is a TypeConverter that transform /// `MidLFHE.glwe<{_,_,_}{p}>` to @@ -33,9 +33,9 @@ class MidLFHEGlobalParametrizationTypeConverter : public mlir::TypeConverter { public: MidLFHEGlobalParametrizationTypeConverter( - mlir::zamalang::V0FHEContext &fheContext) { + mlir::concretelang::V0FHEContext &fheContext) { auto convertGLWECiphertextType = - [](GLWECipherTextType type, mlir::zamalang::V0FHEContext &fheContext) { + [](GLWECipherTextType type, mlir::concretelang::V0FHEContext &fheContext) { auto glweDimension = fheContext.parameter.getNBigGlweDimension(); auto p = fheContext.constraint.p; if (type.getDimension() == (signed)glweDimension && @@ -67,7 +67,7 @@ template struct MidLFHEOpTypeConversionPattern : public mlir::OpRewritePattern { MidLFHEOpTypeConversionPattern( mlir::MLIRContext *context, mlir::TypeConverter &typeConverter, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) : mlir::OpRewritePattern(context, benefit), typeConverter(typeConverter) {} @@ -87,17 +87,17 @@ private: }; struct MidLFHEApplyLookupTableParametrizationPattern - : public mlir::OpRewritePattern { + : public mlir::OpRewritePattern { MidLFHEApplyLookupTableParametrizationPattern( mlir::MLIRContext *context, mlir::TypeConverter &typeConverter, - mlir::zamalang::V0Parameter &v0Parameter, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) - : mlir::OpRewritePattern( + mlir::concretelang::V0Parameter &v0Parameter, + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) + : mlir::OpRewritePattern( context, benefit), typeConverter(typeConverter), v0Parameter(v0Parameter) {} mlir::LogicalResult - matchAndRewrite(mlir::zamalang::MidLFHE::ApplyLookupTable op, + matchAndRewrite(mlir::concretelang::MidLFHE::ApplyLookupTable op, mlir::PatternRewriter &rewriter) const override { mlir::SmallVector newResultTypes; if (typeConverter.convertTypes(op->getResultTypes(), newResultTypes) @@ -125,7 +125,7 @@ struct MidLFHEApplyLookupTableParametrizationPattern rewriter.getI32IntegerAttr(v0Parameter.nSmall)), }; - rewriter.replaceOpWithNewOp( + rewriter.replaceOpWithNewOp( op, newResultTypes, op->getOperands(), newAttributes); return mlir::success(); @@ -133,27 +133,27 @@ struct MidLFHEApplyLookupTableParametrizationPattern private: mlir::TypeConverter &typeConverter; - mlir::zamalang::V0Parameter &v0Parameter; + mlir::concretelang::V0Parameter &v0Parameter; }; struct MidLFHEApplyLookupTablePaddingPattern - : public mlir::OpRewritePattern { + : public mlir::OpRewritePattern { MidLFHEApplyLookupTablePaddingPattern( mlir::MLIRContext *context, - mlir::PatternBenefit benefit = mlir::zamalang::DEFAULT_PATTERN_BENEFIT) - : mlir::OpRewritePattern( + mlir::PatternBenefit benefit = mlir::concretelang::DEFAULT_PATTERN_BENEFIT) + : mlir::OpRewritePattern( context, benefit), typeConverter(typeConverter), v0Parameter(v0Parameter) {} mlir::LogicalResult - matchAndRewrite(mlir::zamalang::MidLFHE::ApplyLookupTable op, + matchAndRewrite(mlir::concretelang::MidLFHE::ApplyLookupTable op, mlir::PatternRewriter &rewriter) const override { auto glweInType = op.getOperandTypes()[0] - .cast(); + .cast(); auto tabulatedLambdaType = op.l_cst().getType().cast(); auto glweOutType = - op.getType().cast(); + op.getType().cast(); auto expectedSize = 1 << glweInType.getP(); if (tabulatedLambdaType.getShape()[0] < expectedSize) { auto constantOp = mlir::dyn_cast_or_null( @@ -188,7 +188,7 @@ struct MidLFHEApplyLookupTablePaddingPattern mlir::SmallVector newResultTypes{op.getType()}; llvm::SmallVector newOperands{op.ct(), newConstantOp}; llvm::ArrayRef newAttrs = op->getAttrs(); - rewriter.replaceOpWithNewOp( + rewriter.replaceOpWithNewOp( op, newResultTypes, newOperands, newAttrs); return mlir::success(); } @@ -198,7 +198,7 @@ struct MidLFHEApplyLookupTablePaddingPattern private: mlir::TypeConverter &typeConverter; - mlir::zamalang::V0Parameter &v0Parameter; + mlir::concretelang::V0Parameter &v0Parameter; }; template @@ -214,11 +214,11 @@ void populateWithMidLFHEOpTypeConversionPattern( void populateWithMidLFHEApplyLookupTableParametrizationPattern( mlir::RewritePatternSet &patterns, mlir::ConversionTarget &target, mlir::TypeConverter &typeConverter, - mlir::zamalang::V0Parameter &v0Parameter) { + mlir::concretelang::V0Parameter &v0Parameter) { patterns.add( patterns.getContext(), typeConverter, v0Parameter); - target.addDynamicallyLegalOp( - [&](mlir::zamalang::MidLFHE::ApplyLookupTable op) { + target.addDynamicallyLegalOp( + [&](mlir::concretelang::MidLFHE::ApplyLookupTable op) { if (op.glweDimension() != v0Parameter.glweDimension || // TODO remove the shift when we have true polynomial size op.polynomialSize() != (1 << v0Parameter.logPolynomialSize) || @@ -236,15 +236,15 @@ void populateWithMidLFHEApplyLookupTablePaddingPattern( mlir::RewritePatternSet &patterns, mlir::ConversionTarget &target) { patterns.add(patterns.getContext()); target.addLegalOp(); - target.addDynamicallyLegalOp( - [&](mlir::zamalang::MidLFHE::ApplyLookupTable op) { + target.addDynamicallyLegalOp( + [&](mlir::concretelang::MidLFHE::ApplyLookupTable op) { auto glweInType = op.getOperandTypes()[0] - .cast(); + .cast(); auto tabulatedLambdaType = op.getOperandTypes()[1].cast(); auto glweOutType = - op.getType().cast(); + op.getType().cast(); return tabulatedLambdaType.getShape()[0] == 1 << glweInType.getP(); }); @@ -255,19 +255,19 @@ void populateWithMidLFHEApplyLookupTablePaddingPattern( void populateWithMidLFHEOpTypeConversionPatterns( mlir::RewritePatternSet &patterns, mlir::ConversionTarget &target, mlir::TypeConverter &typeConverter, - mlir::zamalang::V0Parameter &v0Parameter) { + mlir::concretelang::V0Parameter &v0Parameter) { populateWithMidLFHEOpTypeConversionPattern< - mlir::zamalang::MidLFHE::ZeroGLWEOp>(patterns, target, typeConverter); + mlir::concretelang::MidLFHE::ZeroGLWEOp>(patterns, target, typeConverter); populateWithMidLFHEOpTypeConversionPattern< - mlir::zamalang::MidLFHE::AddGLWEIntOp>(patterns, target, typeConverter); + mlir::concretelang::MidLFHE::AddGLWEIntOp>(patterns, target, typeConverter); populateWithMidLFHEOpTypeConversionPattern< - mlir::zamalang::MidLFHE::AddGLWEOp>(patterns, target, typeConverter); + mlir::concretelang::MidLFHE::AddGLWEOp>(patterns, target, typeConverter); populateWithMidLFHEOpTypeConversionPattern< - mlir::zamalang::MidLFHE::SubIntGLWEOp>(patterns, target, typeConverter); + mlir::concretelang::MidLFHE::SubIntGLWEOp>(patterns, target, typeConverter); populateWithMidLFHEOpTypeConversionPattern< - mlir::zamalang::MidLFHE::NegGLWEOp>(patterns, target, typeConverter); + mlir::concretelang::MidLFHE::NegGLWEOp>(patterns, target, typeConverter); populateWithMidLFHEOpTypeConversionPattern< - mlir::zamalang::MidLFHE::MulGLWEIntOp>(patterns, target, typeConverter); + mlir::concretelang::MidLFHE::MulGLWEIntOp>(patterns, target, typeConverter); populateWithMidLFHEApplyLookupTableParametrizationPattern( patterns, target, typeConverter, v0Parameter); } @@ -301,14 +301,14 @@ void MidLFHEGlobalParametrizationPass::runOnOperation() { patterns.add>( &getContext(), converter); - mlir::zamalang::populateWithTensorTypeConverterPatterns(patterns, target, + mlir::concretelang::populateWithTensorTypeConverterPatterns(patterns, target, converter); // Conversion of RT Dialect Ops - patterns.add>(patterns.getContext(), converter); - mlir::zamalang::addDynamicallyLegalTypeOp< - mlir::zamalang::RT::DataflowTaskOp>(target, converter); + patterns.add>(patterns.getContext(), converter); + mlir::concretelang::addDynamicallyLegalTypeOp< + mlir::concretelang::RT::DataflowTaskOp>(target, converter); // Apply conversion if (mlir::applyPartialConversion(op, target, std::move(patterns)) @@ -333,11 +333,11 @@ void MidLFHEGlobalParametrizationPass::runOnOperation() { } namespace mlir { -namespace zamalang { +namespace concretelang { std::unique_ptr> createConvertMidLFHEGlobalParametrizationPass( - mlir::zamalang::V0FHEContext &fheContext) { + mlir::concretelang::V0FHEContext &fheContext) { return std::make_unique(fheContext); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Conversion/MidLFHEToLowLFHE/CMakeLists.txt b/compiler/lib/Conversion/MidLFHEToLowLFHE/CMakeLists.txt index bed556503..29ab42339 100644 --- a/compiler/lib/Conversion/MidLFHEToLowLFHE/CMakeLists.txt +++ b/compiler/lib/Conversion/MidLFHEToLowLFHE/CMakeLists.txt @@ -2,7 +2,7 @@ add_mlir_dialect_library(MidLFHEToLowLFHE MidLFHEToLowLFHE.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/MidLFHE + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/MidLFHE DEPENDS MidLFHEDialect diff --git a/compiler/lib/Conversion/MidLFHEToLowLFHE/MidLFHEToLowLFHE.cpp b/compiler/lib/Conversion/MidLFHEToLowLFHE/MidLFHEToLowLFHE.cpp index 112f0baaa..27e33b151 100644 --- a/compiler/lib/Conversion/MidLFHEToLowLFHE/MidLFHEToLowLFHE.cpp +++ b/compiler/lib/Conversion/MidLFHEToLowLFHE/MidLFHEToLowLFHE.cpp @@ -6,15 +6,15 @@ #include "mlir/Pass/Pass.h" #include "mlir/Transforms/DialectConversion.h" -#include "zamalang/Conversion/MidLFHEToLowLFHE/Patterns.h" -#include "zamalang/Conversion/Passes.h" -#include "zamalang/Conversion/Utils/RegionOpTypeConverterPattern.h" -#include "zamalang/Conversion/Utils/TensorOpTypeConversion.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHETypes.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHETypes.h" -#include "zamalang/Dialect/RT/IR/RTOps.h" +#include "concretelang/Conversion/MidLFHEToLowLFHE/Patterns.h" +#include "concretelang/Conversion/Passes.h" +#include "concretelang/Conversion/Utils/RegionOpTypeConverterPattern.h" +#include "concretelang/Conversion/Utils/TensorOpTypeConversion.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHETypes.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHETypes.h" +#include "concretelang/Dialect/RT/IR/RTOps.h" namespace { struct MidLFHEToLowLFHEPass @@ -23,8 +23,8 @@ struct MidLFHEToLowLFHEPass }; } // namespace -using mlir::zamalang::LowLFHE::LweCiphertextType; -using mlir::zamalang::MidLFHE::GLWECipherTextType; +using mlir::concretelang::LowLFHE::LweCiphertextType; +using mlir::concretelang::MidLFHE::GLWECipherTextType; /// MidLFHEToLowLFHETypeConverter is a TypeConverter that transform /// `MidLFHE.glwe<{_,_,_}{p}>` to LowLFHE.lwe_ciphertext @@ -34,7 +34,7 @@ public: MidLFHEToLowLFHETypeConverter() { addConversion([](mlir::Type type) { return type; }); addConversion([&](GLWECipherTextType type) { - return mlir::zamalang::convertTypeToLWE(type.getContext(), type); + return mlir::concretelang::convertTypeToLWE(type.getContext(), type); }); addConversion([&](mlir::RankedTensorType type) { auto glwe = type.getElementType().dyn_cast_or_null(); @@ -43,7 +43,7 @@ public: } mlir::Type r = mlir::RankedTensorType::get( type.getShape(), - mlir::zamalang::convertTypeToLWE(glwe.getContext(), glwe)); + mlir::concretelang::convertTypeToLWE(glwe.getContext(), glwe)); return r; }); } @@ -56,10 +56,10 @@ void MidLFHEToLowLFHEPass::runOnOperation() { MidLFHEToLowLFHETypeConverter converter; // Mark ops from the target dialect as legal operations - target.addLegalDialect(); + target.addLegalDialect(); // Make sure that no ops from `MidLFHE` remain after the lowering - target.addIllegalDialect(); + target.addIllegalDialect(); // Make sure that no ops `linalg.generic` that have illegal types target.addDynamicallyLegalOp>( &getContext(), converter); - mlir::zamalang::populateWithTensorTypeConverterPatterns(patterns, target, + mlir::concretelang::populateWithTensorTypeConverterPatterns(patterns, target, converter); mlir::populateFuncOpTypeConversionPattern(patterns, converter); // Conversion of RT Dialect Ops - patterns.add>(patterns.getContext(), converter); - mlir::zamalang::addDynamicallyLegalTypeOp( + patterns.add>(patterns.getContext(), converter); + mlir::concretelang::addDynamicallyLegalTypeOp( target, converter); // Apply conversion @@ -106,9 +106,9 @@ void MidLFHEToLowLFHEPass::runOnOperation() { } namespace mlir { -namespace zamalang { +namespace concretelang { std::unique_ptr> createConvertMidLFHEToLowLFHEPass() { return std::make_unique(); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Dialect/HLFHE/Analysis/CMakeLists.txt b/compiler/lib/Dialect/HLFHE/Analysis/CMakeLists.txt index 570db4b9f..f63ce373b 100644 --- a/compiler/lib/Dialect/HLFHE/Analysis/CMakeLists.txt +++ b/compiler/lib/Dialect/HLFHE/Analysis/CMakeLists.txt @@ -2,7 +2,7 @@ add_mlir_library(HLFHEDialectAnalysis MANP.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/HLFHE + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/HLFHE DEPENDS HLFHEDialect diff --git a/compiler/lib/Dialect/HLFHE/Analysis/MANP.cpp b/compiler/lib/Dialect/HLFHE/Analysis/MANP.cpp index 07906c77f..c9d1b3ee6 100644 --- a/compiler/lib/Dialect/HLFHE/Analysis/MANP.cpp +++ b/compiler/lib/Dialect/HLFHE/Analysis/MANP.cpp @@ -2,12 +2,12 @@ // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -24,10 +24,10 @@ #include #define GEN_PASS_CLASSES -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { namespace { // Returns `true` if the given value is a scalar or tensor argument of @@ -43,12 +43,12 @@ static bool isEncryptedFunctionParameter(mlir::Value value) { return false; } - return (value.getType().isa() || + return (value.getType().isa() || (value.getType().isa() && value.getType() .cast() .getElementType() - .isa())); + .isa())); } // Returns the bit width of `value` if `value` is an encrypted integer @@ -57,13 +57,13 @@ static bool isEncryptedFunctionParameter(mlir::Value value) { static unsigned int getEintPrecision(mlir::Value value) { if (auto ty = value.getType() .dyn_cast_or_null< - mlir::zamalang::HLFHE::EncryptedIntegerType>()) { + mlir::concretelang::HLFHE::EncryptedIntegerType>()) { return ty.getWidth(); } else if (auto tensorTy = value.getType().dyn_cast_or_null()) { if (auto ty = tensorTy.getElementType() .dyn_cast_or_null< - mlir::zamalang::HLFHE::EncryptedIntegerType>()) + mlir::concretelang::HLFHE::EncryptedIntegerType>()) return ty.getWidth(); } @@ -275,7 +275,7 @@ static llvm::APInt denseDynTensorNorm2Sq(mlir::TensorType tTy, // Calculates the squared Minimal Arithmetic Noise Padding of an // `HLFHELinalg.dot_eint_int` operation. static llvm::APInt getSqMANP( - mlir::zamalang::HLFHELinalg::Dot op, + mlir::concretelang::HLFHELinalg::Dot op, llvm::ArrayRef *> operandMANPs) { assert(operandMANPs.size() == 2 && operandMANPs[0]->getValue().getMANP().hasValue() && @@ -321,7 +321,7 @@ static llvm::APInt conservativeIntNorm2Sq(mlir::Type t) { // Calculates the squared Minimal Arithmetic Noise Padding of an // `HLFHE.add_eint_int` operation. static llvm::APInt getSqMANP( - mlir::zamalang::HLFHE::AddEintIntOp op, + mlir::concretelang::HLFHE::AddEintIntOp op, llvm::ArrayRef *> operandMANPs) { mlir::Type iTy = op->getOpOperand(1).get().getType(); @@ -356,7 +356,7 @@ static llvm::APInt getSqMANP( // Calculates the squared Minimal Arithmetic Noise Padding of a dot operation // that is equivalent to an `HLFHE.add_eint` operation. static llvm::APInt getSqMANP( - mlir::zamalang::HLFHE::AddEintOp op, + mlir::concretelang::HLFHE::AddEintOp op, llvm::ArrayRef *> operandMANPs) { assert(operandMANPs.size() == 2 && operandMANPs[0]->getValue().getMANP().hasValue() && @@ -373,7 +373,7 @@ static llvm::APInt getSqMANP( // Calculates the squared Minimal Arithmetic Noise Padding of a dot operation // that is equivalent to an `HLFHE.sub_int_eint` operation. static llvm::APInt getSqMANP( - mlir::zamalang::HLFHE::SubIntEintOp op, + mlir::concretelang::HLFHE::SubIntEintOp op, llvm::ArrayRef *> operandMANPs) { mlir::Type iTy = op->getOpOperand(0).get().getType(); @@ -407,7 +407,7 @@ static llvm::APInt getSqMANP( // Calculates the squared Minimal Arithmetic Noise Padding of a dot operation // that is equivalent to an `HLFHE.neg_eint` operation. static llvm::APInt getSqMANP( - mlir::zamalang::HLFHE::NegEintOp op, + mlir::concretelang::HLFHE::NegEintOp op, llvm::ArrayRef *> operandMANPs) { assert( @@ -423,7 +423,7 @@ static llvm::APInt getSqMANP( // Calculates the squared Minimal Arithmetic Noise Padding of a dot operation // that is equivalent to an `HLFHE.mul_eint_int` operation. static llvm::APInt getSqMANP( - mlir::zamalang::HLFHE::MulEintIntOp op, + mlir::concretelang::HLFHE::MulEintIntOp op, llvm::ArrayRef *> operandMANPs) { mlir::Type iTy = op->getOpOperand(1).get().getType(); @@ -458,7 +458,7 @@ static llvm::APInt getSqMANP( // Calculates the squared Minimal Arithmetic Noise Padding of an // `HLFHELinalg.add_eint_int` operation. static llvm::APInt getSqMANP( - mlir::zamalang::HLFHELinalg::AddEintIntOp op, + mlir::concretelang::HLFHELinalg::AddEintIntOp op, llvm::ArrayRef *> operandMANPs) { mlir::RankedTensorType op1Ty = @@ -504,7 +504,7 @@ static llvm::APInt getSqMANP( } static llvm::APInt getSqMANP( - mlir::zamalang::HLFHELinalg::AddEintOp op, + mlir::concretelang::HLFHELinalg::AddEintOp op, llvm::ArrayRef *> operandMANPs) { assert(operandMANPs.size() == 2 && operandMANPs[0]->getValue().getMANP().hasValue() && @@ -521,7 +521,7 @@ static llvm::APInt getSqMANP( // Calculates the squared Minimal Arithmetic Noise Padding of a dot operation // that is equivalent to an `HLFHELinalg.sub_int_eint` operation. static llvm::APInt getSqMANP( - mlir::zamalang::HLFHELinalg::SubIntEintOp op, + mlir::concretelang::HLFHELinalg::SubIntEintOp op, llvm::ArrayRef *> operandMANPs) { mlir::RankedTensorType op0Ty = @@ -568,7 +568,7 @@ static llvm::APInt getSqMANP( // Calculates the squared Minimal Arithmetic Noise Padding of a dot operation // that is equivalent to an `HLFHELinalg.neg_eint` operation. static llvm::APInt getSqMANP( - mlir::zamalang::HLFHELinalg::NegEintOp op, + mlir::concretelang::HLFHELinalg::NegEintOp op, llvm::ArrayRef *> operandMANPs) { assert( @@ -584,7 +584,7 @@ static llvm::APInt getSqMANP( // Calculates the squared Minimal Arithmetic Noise Padding of a dot operation // that is equivalent to an `HLFHE.mul_eint_int` operation. static llvm::APInt getSqMANP( - mlir::zamalang::HLFHELinalg::MulEintIntOp op, + mlir::concretelang::HLFHELinalg::MulEintIntOp op, llvm::ArrayRef *> operandMANPs) { mlir::RankedTensorType op0Ty = @@ -632,7 +632,7 @@ static llvm::APInt getSqMANP( // Calculates the squared Minimal Arithmetic Noise Padding of a dot operation // that is equivalent to an `HLFHE.mul_eint_int` operation. static llvm::APInt getSqMANP( - mlir::zamalang::HLFHELinalg::MatMulEintIntOp op, + mlir::concretelang::HLFHELinalg::MatMulEintIntOp op, llvm::ArrayRef *> operandMANPs) { mlir::RankedTensorType rhsTy = @@ -697,7 +697,7 @@ static llvm::APInt getSqMANP( } static llvm::APInt getSqMANP( - mlir::zamalang::HLFHELinalg::MatMulIntEintOp op, + mlir::concretelang::HLFHELinalg::MatMulIntEintOp op, llvm::ArrayRef *> operandMANPs) { mlir::RankedTensorType rhsTy = @@ -854,59 +854,59 @@ struct MANPAnalysis : public mlir::ForwardDataFlowAnalysis { // HLFHE Operators if (auto addEintIntOp = - llvm::dyn_cast(op)) { + llvm::dyn_cast(op)) { norm2SqEquiv = getSqMANP(addEintIntOp, operands); } else if (auto addEintOp = - llvm::dyn_cast(op)) { + llvm::dyn_cast(op)) { norm2SqEquiv = getSqMANP(addEintOp, operands); } else if (auto subIntEintOp = - llvm::dyn_cast(op)) { + llvm::dyn_cast(op)) { norm2SqEquiv = getSqMANP(subIntEintOp, operands); } else if (auto negEintOp = - llvm::dyn_cast(op)) { + llvm::dyn_cast(op)) { norm2SqEquiv = getSqMANP(negEintOp, operands); } else if (auto mulEintIntOp = - llvm::dyn_cast(op)) { + llvm::dyn_cast(op)) { norm2SqEquiv = getSqMANP(mulEintIntOp, operands); - } else if (llvm::isa(op) || - llvm::isa(op) || - llvm::isa(op)) { + } else if (llvm::isa(op) || + llvm::isa(op) || + llvm::isa(op)) { norm2SqEquiv = llvm::APInt{1, 1, false}; } // HLFHELinalg Operators else if (auto dotOp = - llvm::dyn_cast(op)) { + llvm::dyn_cast(op)) { norm2SqEquiv = getSqMANP(dotOp, operands); } else if (auto addEintIntOp = - llvm::dyn_cast( + llvm::dyn_cast( op)) { norm2SqEquiv = getSqMANP(addEintIntOp, operands); } else if (auto addEintOp = - llvm::dyn_cast(op)) { + llvm::dyn_cast(op)) { norm2SqEquiv = getSqMANP(addEintOp, operands); } else if (auto subIntEintOp = - llvm::dyn_cast( + llvm::dyn_cast( op)) { norm2SqEquiv = getSqMANP(subIntEintOp, operands); } else if (auto negEintOp = - llvm::dyn_cast(op)) { + llvm::dyn_cast(op)) { norm2SqEquiv = getSqMANP(negEintOp, operands); } else if (auto mulEintIntOp = - llvm::dyn_cast( + llvm::dyn_cast( op)) { norm2SqEquiv = getSqMANP(mulEintIntOp, operands); } else if (auto matmulEintIntOp = - llvm::dyn_cast( + llvm::dyn_cast( op)) { norm2SqEquiv = getSqMANP(matmulEintIntOp, operands); } else if (auto matmulIntEintOp = - llvm::dyn_cast( + llvm::dyn_cast( op)) { norm2SqEquiv = getSqMANP(matmulIntEintOp, operands); } else if (llvm::isa< - mlir::zamalang::HLFHELinalg::ApplyLookupTableEintOp, - mlir::zamalang::HLFHELinalg::ApplyMultiLookupTableEintOp, - mlir::zamalang::HLFHELinalg::ApplyMappedLookupTableEintOp>( + mlir::concretelang::HLFHELinalg::ApplyLookupTableEintOp, + mlir::concretelang::HLFHELinalg::ApplyMultiLookupTableEintOp, + mlir::concretelang::HLFHELinalg::ApplyMappedLookupTableEintOp>( op)) { norm2SqEquiv = llvm::APInt{1, 1, false}; } @@ -915,7 +915,7 @@ struct MANPAnalysis : public mlir::ForwardDataFlowAnalysis { else if (auto extractOp = llvm::dyn_cast(op)) { if (extractOp.result() .getType() - .isa()) { + .isa()) { norm2SqEquiv = getSqMANP(extractOp, operands); } else { isDummy = true; @@ -928,7 +928,7 @@ struct MANPAnalysis : public mlir::ForwardDataFlowAnalysis { .getType() .cast() .getElementType() - .isa()) { + .isa()) { norm2SqEquiv = getSqMANP(extractSliceOp, operands); } else { isDummy = true; @@ -941,7 +941,7 @@ struct MANPAnalysis : public mlir::ForwardDataFlowAnalysis { .getType() .cast() .getElementType() - .isa()) { + .isa()) { norm2SqEquiv = getSqMANP(insertSliceOp, operands); } else { isDummy = true; @@ -953,7 +953,7 @@ struct MANPAnalysis : public mlir::ForwardDataFlowAnalysis { .getType() .cast() .getElementType() - .isa()) { + .isa()) { norm2SqEquiv = getSqMANP(fromOp, operands); } else { isDummy = true; @@ -966,7 +966,7 @@ struct MANPAnalysis : public mlir::ForwardDataFlowAnalysis { .getType() .cast() .getElementType() - .isa()) { + .isa()) { norm2SqEquiv = getSqMANP(reshapeOp, operands); } else { isDummy = true; @@ -979,7 +979,7 @@ struct MANPAnalysis : public mlir::ForwardDataFlowAnalysis { .getType() .cast() .getElementType() - .isa()) { + .isa()) { norm2SqEquiv = getSqMANP(reshapeOp, operands); } else { isDummy = true; @@ -988,7 +988,7 @@ struct MANPAnalysis : public mlir::ForwardDataFlowAnalysis { else if (llvm::isa(op)) { isDummy = true; - } else if (llvm::isa( + } else if (llvm::isa( *op->getDialect())) { op->emitError("Unsupported operation"); assert(false && "Unsupported operation"); @@ -1090,15 +1090,15 @@ protected: // Process all results using MANP attribute from MANP pas for (mlir::OpResult res : op->getResults()) { - mlir::zamalang::HLFHE::EncryptedIntegerType eTy = + mlir::concretelang::HLFHE::EncryptedIntegerType eTy = res.getType() - .dyn_cast_or_null(); + .dyn_cast_or_null(); if (eTy == nullptr) { auto tensorTy = res.getType().dyn_cast_or_null(); if (tensorTy != nullptr) { eTy = tensorTy.getElementType() .dyn_cast_or_null< - mlir::zamalang::HLFHE::EncryptedIntegerType>(); + mlir::concretelang::HLFHE::EncryptedIntegerType>(); } } @@ -1138,5 +1138,5 @@ std::unique_ptr createMaxMANPPass( return std::make_unique(updateMax); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Dialect/HLFHE/IR/CMakeLists.txt b/compiler/lib/Dialect/HLFHE/IR/CMakeLists.txt index f432ad8ed..c615091be 100644 --- a/compiler/lib/Dialect/HLFHE/IR/CMakeLists.txt +++ b/compiler/lib/Dialect/HLFHE/IR/CMakeLists.txt @@ -3,7 +3,7 @@ add_mlir_dialect_library(HLFHEDialect HLFHEOps.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/HLFHE + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/HLFHE DEPENDS MLIRHLFHEOpsIncGen diff --git a/compiler/lib/Dialect/HLFHE/IR/HLFHEDialect.cpp b/compiler/lib/Dialect/HLFHE/IR/HLFHEDialect.cpp index 57647e779..81174a010 100644 --- a/compiler/lib/Dialect/HLFHE/IR/HLFHEDialect.cpp +++ b/compiler/lib/Dialect/HLFHE/IR/HLFHEDialect.cpp @@ -1,26 +1,26 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#include "zamalang/Dialect/HLFHE/IR/HLFHEDialect.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEOps.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHETypes.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEDialect.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOps.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHETypes.h" #define GET_TYPEDEF_CLASSES -#include "zamalang/Dialect/HLFHE/IR/HLFHEOpsTypes.cpp.inc" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOpsTypes.cpp.inc" -#include "zamalang/Dialect/HLFHE/IR/HLFHEOpsDialect.cpp.inc" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOpsDialect.cpp.inc" -using namespace mlir::zamalang::HLFHE; +using namespace mlir::concretelang::HLFHE; void HLFHEDialect::initialize() { addOperations< #define GET_OP_LIST -#include "zamalang/Dialect/HLFHE/IR/HLFHEOps.cpp.inc" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOps.cpp.inc" >(); addTypes< #define GET_TYPEDEF_LIST -#include "zamalang/Dialect/HLFHE/IR/HLFHEOpsTypes.cpp.inc" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOpsTypes.cpp.inc" >(); } diff --git a/compiler/lib/Dialect/HLFHE/IR/HLFHEOps.cpp b/compiler/lib/Dialect/HLFHE/IR/HLFHEOps.cpp index 4c75421e3..bbb002fcd 100644 --- a/compiler/lib/Dialect/HLFHE/IR/HLFHEOps.cpp +++ b/compiler/lib/Dialect/HLFHE/IR/HLFHEOps.cpp @@ -4,11 +4,11 @@ #include "mlir/IR/Region.h" #include "mlir/IR/TypeUtilities.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEOps.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHETypes.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOps.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHETypes.h" namespace mlir { -namespace zamalang { +namespace concretelang { namespace HLFHE { bool verifyEncryptedIntegerInputAndResultConsistency( @@ -126,8 +126,8 @@ bool verifyEncryptedIntegerInputsConsistency(::mlir::OpState &op, } } // namespace HLFHE -} // namespace zamalang +} // namespace concretelang } // namespace mlir #define GET_OP_CLASSES -#include "zamalang/Dialect/HLFHE/IR/HLFHEOps.cpp.inc" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOps.cpp.inc" diff --git a/compiler/lib/Dialect/HLFHELinalg/IR/CMakeLists.txt b/compiler/lib/Dialect/HLFHELinalg/IR/CMakeLists.txt index e86a8d305..6b0624d27 100644 --- a/compiler/lib/Dialect/HLFHELinalg/IR/CMakeLists.txt +++ b/compiler/lib/Dialect/HLFHELinalg/IR/CMakeLists.txt @@ -3,7 +3,7 @@ add_mlir_dialect_library(HLFHELinalgDialect HLFHELinalgOps.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/HLFHELinalg + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/HLFHELinalg DEPENDS MLIRHLFHELinalgOpsIncGen diff --git a/compiler/lib/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.cpp b/compiler/lib/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.cpp index f26d5d82f..156ed9d40 100644 --- a/compiler/lib/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.cpp +++ b/compiler/lib/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.cpp @@ -1,25 +1,25 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.h" -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h" -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgDialect.h" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h" #define GET_TYPEDEF_CLASSES -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOpsTypes.cpp.inc" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOpsTypes.cpp.inc" -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOpsDialect.cpp.inc" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOpsDialect.cpp.inc" -using namespace mlir::zamalang::HLFHELinalg; +using namespace mlir::concretelang::HLFHELinalg; void HLFHELinalgDialect::initialize() { addOperations< #define GET_OP_LIST -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.cpp.inc" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.cpp.inc" >(); addTypes< #define GET_TYPEDEF_LIST -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOpsTypes.cpp.inc" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOpsTypes.cpp.inc" >(); } diff --git a/compiler/lib/Dialect/HLFHELinalg/IR/HLFHELinalgOps.cpp b/compiler/lib/Dialect/HLFHELinalg/IR/HLFHELinalgOps.cpp index 5466cea11..5aa5b82fb 100644 --- a/compiler/lib/Dialect/HLFHELinalg/IR/HLFHELinalgOps.cpp +++ b/compiler/lib/Dialect/HLFHELinalg/IR/HLFHELinalgOps.cpp @@ -3,9 +3,9 @@ #include "mlir/IR/TypeUtilities.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEOps.h" -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h" -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOps.h" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.h" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgTypes.h" namespace mlir { namespace OpTrait { @@ -111,7 +111,7 @@ LogicalResult verifyTensorBinaryEintInt(mlir::Operation *op) { } auto el0Ty = op0Ty.getElementType() - .dyn_cast_or_null(); + .dyn_cast_or_null(); if (el0Ty == nullptr) { op->emitOpError() << "should have a !HLFHE.eint as the element type of the " "tensor of operand #0"; @@ -151,7 +151,7 @@ LogicalResult verifyTensorBinaryIntEint(mlir::Operation *op) { } auto el1Ty = op1Ty.getElementType() - .dyn_cast_or_null(); + .dyn_cast_or_null(); if (el1Ty == nullptr) { op->emitOpError() << "should have a !HLFHE.eint as the element type of the " "tensor of operand #1"; @@ -179,7 +179,7 @@ LogicalResult verifyTensorBinaryEint(mlir::Operation *op) { } auto el0Ty = op0Ty.getElementType() - .dyn_cast_or_null(); + .dyn_cast_or_null(); if (el0Ty == nullptr) { op->emitOpError() << "should have a !HLFHE.eint as the element type of the " "tensor of operand #0"; @@ -187,7 +187,7 @@ LogicalResult verifyTensorBinaryEint(mlir::Operation *op) { } auto el1Ty = op1Ty.getElementType() - .dyn_cast_or_null(); + .dyn_cast_or_null(); if (el1Ty == nullptr) { op->emitOpError() << "should have a !HLFHE.eint as the element type of the " "tensor of operand #1"; @@ -214,7 +214,7 @@ LogicalResult verifyTensorUnaryEint(mlir::Operation *op) { } auto el0Ty = op0Ty.getElementType() - .dyn_cast_or_null(); + .dyn_cast_or_null(); if (el0Ty == nullptr) { op->emitOpError() << "should have a !HLFHE.eint as the element type of the " "tensor operand"; @@ -229,13 +229,13 @@ LogicalResult verifyTensorUnaryEint(mlir::Operation *op) { } // namespace mlir namespace mlir { -namespace zamalang { +namespace concretelang { namespace HLFHELinalg { mlir::LogicalResult verifyApplyLookupTable(ApplyLookupTableEintOp &op) { auto tTy = op.t().getType().cast(); auto tEltTy = - tTy.getElementType().cast(); + tTy.getElementType().cast(); auto lutTy = op.lut().getType().cast(); auto lutEltTy = lutTy.getElementType().cast(); auto resultTy = op.getResult().getType().cast(); @@ -261,7 +261,7 @@ mlir::LogicalResult verifyApplyMultiLookupTable(ApplyMultiLookupTableEintOp &op) { auto tTy = op.t().getType().cast(); auto tEltTy = - tTy.getElementType().cast(); + tTy.getElementType().cast(); auto lutTy = op.luts().getType().cast(); auto lutEltTy = lutTy.getElementType().cast(); auto resultTy = op.getResult().getType().cast(); @@ -298,7 +298,7 @@ mlir::IntegerType getClearElmentType(::mlir::Value value) { } HLFHE::EncryptedIntegerType getEncryptedElmentType(::mlir::Value value) { - using namespace mlir::zamalang::HLFHE; + using namespace mlir::concretelang::HLFHE; return getElmentType(value); } @@ -380,7 +380,7 @@ verifyApplyMappedLookupTable(ApplyMappedLookupTableEintOp &op) { .cast(); auto resultType = op.getResult().getType().cast(); - if (!mlir::zamalang::HLFHE::verifyEncryptedIntegerAndIntegerInputsConsistency( + if (!mlir::concretelang::HLFHE::verifyEncryptedIntegerAndIntegerInputsConsistency( op, lhsEltType, rhsEltType)) { return ::mlir::failure(); } @@ -423,8 +423,8 @@ template mlir::LogicalResult verifyMatmul(MatMulOp &op) { return mlir::success(); } } // namespace HLFHELinalg -} // namespace zamalang +} // namespace concretelang } // namespace mlir #define GET_OP_CLASSES -#include "zamalang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.cpp.inc" +#include "concretelang/Dialect/HLFHELinalg/IR/HLFHELinalgOps.cpp.inc" diff --git a/compiler/lib/Dialect/HLFHELinalg/Transforms/CMakeLists.txt b/compiler/lib/Dialect/HLFHELinalg/Transforms/CMakeLists.txt index 723fb698c..f8d4ea2f7 100644 --- a/compiler/lib/Dialect/HLFHELinalg/Transforms/CMakeLists.txt +++ b/compiler/lib/Dialect/HLFHELinalg/Transforms/CMakeLists.txt @@ -2,11 +2,11 @@ add_mlir_library(HLFHELinalgDialectTransforms Tiling.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/HLFHELinalg + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/HLFHELinalg DEPENDS HLFHELinalgDialect - ZamalangHLFHELinalgTilingPassIncGen + ConcretelangHLFHELinalgTilingPassIncGen LINK_LIBS PUBLIC MLIRIR diff --git a/compiler/lib/Dialect/HLFHELinalg/Transforms/Tiling.cpp b/compiler/lib/Dialect/HLFHELinalg/Transforms/Tiling.cpp index 104d3186e..d81375c51 100644 --- a/compiler/lib/Dialect/HLFHELinalg/Transforms/Tiling.cpp +++ b/compiler/lib/Dialect/HLFHELinalg/Transforms/Tiling.cpp @@ -8,14 +8,14 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { namespace { @@ -124,14 +124,14 @@ static const mlir::StringLiteral kTransformMarker = // Partial tiles are currently not supported, i.e., `N` must be a // multiple of `T`, `M` a multiple of `U` and `K` a multiple of `V`. class MatMulTilingPattern : public mlir::OpRewritePattern< - mlir::zamalang::HLFHELinalg::MatMulEintIntOp> { + mlir::concretelang::HLFHELinalg::MatMulEintIntOp> { public: MatMulTilingPattern(mlir::MLIRContext *context) - : mlir::OpRewritePattern( - context, ::mlir::zamalang::DEFAULT_PATTERN_BENEFIT) {} + : mlir::OpRewritePattern( + context, ::mlir::concretelang::DEFAULT_PATTERN_BENEFIT) {} mlir::LogicalResult - matchAndRewrite(mlir::zamalang::HLFHELinalg::MatMulEintIntOp op, + matchAndRewrite(mlir::concretelang::HLFHELinalg::MatMulEintIntOp op, mlir::PatternRewriter &rewriter) const override { // Avoid infinite recursion by marking each matmul operation and // bailing out for the marker @@ -186,8 +186,8 @@ public: mlir::Value B = op.getOperand(1); // Initialization of the output matrix with zeros - mlir::zamalang::HLFHELinalg::ZeroOp Cinit = - rewriter.create( + mlir::concretelang::HLFHELinalg::ZeroOp Cinit = + rewriter.create( origLoc, op.getResult().getType()); mlir::TensorType ATTy = A.getType().cast(); @@ -259,8 +259,8 @@ public: {inductionVars[0], inductionVars[2]}); // Multiplication of the tiles - mlir::zamalang::HLFHELinalg::MatMulEintIntOp tiledMul = - builder.create( + mlir::concretelang::HLFHELinalg::MatMulEintIntOp tiledMul = + builder.create( origLoc, mlir::RankedTensorType::get(llvm::SmallVector{iT, iV}, CTTy.getElementType()), @@ -273,8 +273,8 @@ public: // Add result of the multiplication of the tiles to the // result tile from C - mlir::zamalang::HLFHELinalg::AddEintOp accuTile = - builder.create(origLoc, CTile, + mlir::concretelang::HLFHELinalg::AddEintOp accuTile = + builder.create(origLoc, CTile, tiledMul); // Write updated C tile back into C @@ -323,7 +323,7 @@ public: this->signalPassFailure(); } - op->walk([](mlir::zamalang::HLFHELinalg::MatMulEintIntOp matmulOp) { + op->walk([](mlir::concretelang::HLFHELinalg::MatMulEintIntOp matmulOp) { matmulOp.getOperation()->removeAttr(kTransformMarker); }); } @@ -343,7 +343,7 @@ public: mlir::ArrayAttr tileAttr = mlir::Builder(&this->getContext()).getI64ArrayAttr(tileSizes); - op->walk([&](mlir::zamalang::HLFHELinalg::MatMulEintIntOp matmulOp) { + op->walk([&](mlir::concretelang::HLFHELinalg::MatMulEintIntOp matmulOp) { matmulOp.getOperation()->setAttr("tile-sizes", tileAttr); }); } @@ -361,5 +361,5 @@ std::unique_ptr> createHLFHELinalgTilingMarkerPass(llvm::ArrayRef tileSizes) { return std::make_unique(tileSizes); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Dialect/LowLFHE/IR/CMakeLists.txt b/compiler/lib/Dialect/LowLFHE/IR/CMakeLists.txt index eb0f063c1..43f028251 100644 --- a/compiler/lib/Dialect/LowLFHE/IR/CMakeLists.txt +++ b/compiler/lib/Dialect/LowLFHE/IR/CMakeLists.txt @@ -3,7 +3,7 @@ add_mlir_dialect_library(LowLFHEDialect LowLFHEOps.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/LowLFHE + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/LowLFHE DEPENDS MLIRLowLFHEOpsIncGen diff --git a/compiler/lib/Dialect/LowLFHE/IR/LowLFHEDialect.cpp b/compiler/lib/Dialect/LowLFHE/IR/LowLFHEDialect.cpp index b73b174ed..36f083e50 100644 --- a/compiler/lib/Dialect/LowLFHE/IR/LowLFHEDialect.cpp +++ b/compiler/lib/Dialect/LowLFHE/IR/LowLFHEDialect.cpp @@ -1,26 +1,26 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEOps.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHETypes.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEOps.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHETypes.h" #define GET_TYPEDEF_CLASSES -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEOpsTypes.cpp.inc" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEOpsTypes.cpp.inc" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEOpsDialect.cpp.inc" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEOpsDialect.cpp.inc" -using namespace mlir::zamalang::LowLFHE; +using namespace mlir::concretelang::LowLFHE; void LowLFHEDialect::initialize() { addOperations< #define GET_OP_LIST -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEOps.cpp.inc" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEOps.cpp.inc" >(); addTypes< #define GET_TYPEDEF_LIST -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEOpsTypes.cpp.inc" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEOpsTypes.cpp.inc" >(); } diff --git a/compiler/lib/Dialect/LowLFHE/IR/LowLFHEOps.cpp b/compiler/lib/Dialect/LowLFHE/IR/LowLFHEOps.cpp index 18e8079b9..653f6cdc4 100644 --- a/compiler/lib/Dialect/LowLFHE/IR/LowLFHEOps.cpp +++ b/compiler/lib/Dialect/LowLFHE/IR/LowLFHEOps.cpp @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEOps.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHETypes.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEOps.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHETypes.h" #define GET_OP_CLASSES -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEOps.cpp.inc" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEOps.cpp.inc" diff --git a/compiler/lib/Dialect/MidLFHE/IR/CMakeLists.txt b/compiler/lib/Dialect/MidLFHE/IR/CMakeLists.txt index 27d42197f..9791d34d2 100644 --- a/compiler/lib/Dialect/MidLFHE/IR/CMakeLists.txt +++ b/compiler/lib/Dialect/MidLFHE/IR/CMakeLists.txt @@ -3,7 +3,7 @@ add_mlir_dialect_library(MidLFHEDialect MidLFHEOps.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/MidLFHE + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/MidLFHE DEPENDS MLIRMidLFHEOpsIncGen diff --git a/compiler/lib/Dialect/MidLFHE/IR/MidLFHEDialect.cpp b/compiler/lib/Dialect/MidLFHE/IR/MidLFHEDialect.cpp index 5b237621a..e8c7222c3 100644 --- a/compiler/lib/Dialect/MidLFHE/IR/MidLFHEDialect.cpp +++ b/compiler/lib/Dialect/MidLFHE/IR/MidLFHEDialect.cpp @@ -1,26 +1,26 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEOps.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHETypes.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEOps.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHETypes.h" #define GET_TYPEDEF_CLASSES -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEOpsTypes.cpp.inc" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEOpsTypes.cpp.inc" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEOpsDialect.cpp.inc" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEOpsDialect.cpp.inc" -using namespace mlir::zamalang::MidLFHE; +using namespace mlir::concretelang::MidLFHE; void MidLFHEDialect::initialize() { addOperations< #define GET_OP_LIST -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEOps.cpp.inc" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEOps.cpp.inc" >(); addTypes< #define GET_TYPEDEF_LIST -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEOpsTypes.cpp.inc" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEOpsTypes.cpp.inc" >(); } @@ -33,8 +33,8 @@ void MidLFHEDialect::initialize() { void MidLFHEDialect::printType(::mlir::Type type, ::mlir::DialectAsmPrinter &printer) const { - mlir::zamalang::MidLFHE::GLWECipherTextType glwe = - type.dyn_cast_or_null(); + mlir::concretelang::MidLFHE::GLWECipherTextType glwe = + type.dyn_cast_or_null(); if (glwe != nullptr) { glwe.print(printer); return; diff --git a/compiler/lib/Dialect/MidLFHE/IR/MidLFHEOps.cpp b/compiler/lib/Dialect/MidLFHE/IR/MidLFHEOps.cpp index 215daab16..9d7a7a7b4 100644 --- a/compiler/lib/Dialect/MidLFHE/IR/MidLFHEOps.cpp +++ b/compiler/lib/Dialect/MidLFHE/IR/MidLFHEOps.cpp @@ -3,12 +3,12 @@ #include "mlir/IR/Region.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEOps.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEOps.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHETypes.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEOps.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEOps.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHETypes.h" namespace mlir { -namespace zamalang { +namespace concretelang { namespace MidLFHE { void emitOpErrorForIncompatibleGLWEParameter(mlir::OpState &op, @@ -164,8 +164,8 @@ mlir::LogicalResult verifyApplyLookupTable(ApplyLookupTable &op) { } } // namespace MidLFHE -} // namespace zamalang +} // namespace concretelang } // namespace mlir #define GET_OP_CLASSES -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEOps.cpp.inc" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEOps.cpp.inc" diff --git a/compiler/lib/Dialect/RT/Analysis/BufferizeDataflowTaskOps.cpp b/compiler/lib/Dialect/RT/Analysis/BufferizeDataflowTaskOps.cpp index 496038d4c..19ab5a451 100644 --- a/compiler/lib/Dialect/RT/Analysis/BufferizeDataflowTaskOps.cpp +++ b/compiler/lib/Dialect/RT/Analysis/BufferizeDataflowTaskOps.cpp @@ -3,10 +3,10 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -14,13 +14,13 @@ #include #include #include -#include +#include #define GEN_PASS_CLASSES -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { namespace { class BufferizeDataflowYieldOp @@ -118,5 +118,5 @@ protected: std::unique_ptr createBufferizeDataflowTaskOpsPass(bool debug) { return std::make_unique(debug); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Dialect/RT/Analysis/BuildDataflowTaskGraph.cpp b/compiler/lib/Dialect/RT/Analysis/BuildDataflowTaskGraph.cpp index cfbb7c9b3..3228bbabe 100644 --- a/compiler/lib/Dialect/RT/Analysis/BuildDataflowTaskGraph.cpp +++ b/compiler/lib/Dialect/RT/Analysis/BuildDataflowTaskGraph.cpp @@ -4,16 +4,16 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -31,10 +31,10 @@ #include #define GEN_PASS_CLASSES -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { namespace { @@ -200,7 +200,7 @@ class FixDataflowTaskOpInputsPattern public: FixDataflowTaskOpInputsPattern(mlir::MLIRContext *context) : mlir::OpRewritePattern( - context, ::mlir::zamalang::DEFAULT_PATTERN_BENEFIT) {} + context, ::mlir::concretelang::DEFAULT_PATTERN_BENEFIT) {} LogicalResult matchAndRewrite(RT::DataflowTaskOp op, @@ -265,5 +265,5 @@ std::unique_ptr createFixupDataflowTaskOpsPass(bool debug) { return std::make_unique(debug); } -} // end namespace zamalang +} // end namespace concretelang } // end namespace mlir diff --git a/compiler/lib/Dialect/RT/Analysis/CMakeLists.txt b/compiler/lib/Dialect/RT/Analysis/CMakeLists.txt index 4ee50e1ad..dc0f4886f 100644 --- a/compiler/lib/Dialect/RT/Analysis/CMakeLists.txt +++ b/compiler/lib/Dialect/RT/Analysis/CMakeLists.txt @@ -5,7 +5,7 @@ add_mlir_library(RTDialectAnalysis LowerRTToLLVMDFRCallsConversionPatterns.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/RT + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/RT DEPENDS RTDialect diff --git a/compiler/lib/Dialect/RT/Analysis/LowerDataflowTasksToRT.cpp b/compiler/lib/Dialect/RT/Analysis/LowerDataflowTasksToRT.cpp index e95c320b2..5d3def8a7 100644 --- a/compiler/lib/Dialect/RT/Analysis/LowerDataflowTasksToRT.cpp +++ b/compiler/lib/Dialect/RT/Analysis/LowerDataflowTasksToRT.cpp @@ -4,17 +4,17 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -40,13 +40,13 @@ #include #include #include -#include +#include #define GEN_PASS_CLASSES -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { namespace { @@ -162,13 +162,13 @@ static mlir::Value getSizeInBytes(Value val, Location loc, OpBuilder builder) { // FHE types are converted to pointers, so we take their size as 8 // bytes until we can get the actual size of the actual types. - if (type.isa() || - type.isa() || - type.isa() || - type.isa() || - type.isa() || - type.isa() || - type.isa()) + if (type.isa() || + type.isa() || + type.isa() || + type.isa() || + type.isa() || + type.isa() || + type.isa()) return builder.create(loc, builder.getI64IntegerAttr(8)); // For all other types, get type size. @@ -336,5 +336,5 @@ std::unique_ptr createLowerDataflowTasksPass(bool debug) { return std::make_unique(debug); } -} // end namespace zamalang +} // end namespace concretelang } // end namespace mlir diff --git a/compiler/lib/Dialect/RT/Analysis/LowerRTToLLVMDFRCallsConversionPatterns.cpp b/compiler/lib/Dialect/RT/Analysis/LowerRTToLLVMDFRCallsConversionPatterns.cpp index 75539e5a4..f37c22dca 100644 --- a/compiler/lib/Dialect/RT/Analysis/LowerRTToLLVMDFRCallsConversionPatterns.cpp +++ b/compiler/lib/Dialect/RT/Analysis/LowerRTToLLVMDFRCallsConversionPatterns.cpp @@ -4,17 +4,17 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -41,13 +41,13 @@ #include #include #include -#include +#include #define GEN_PASS_CLASSES -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { namespace { @@ -293,10 +293,10 @@ struct WorkFunctionReturnOpInterfaceLowering } }; } // end anonymous namespace -} // namespace zamalang +} // namespace concretelang } // namespace mlir -void mlir::zamalang::populateRTToLLVMConversionPatterns( +void mlir::concretelang::populateRTToLLVMConversionPatterns( LLVMTypeConverter &converter, RewritePatternSet &patterns) { // clang-format off patterns.add< diff --git a/compiler/lib/Dialect/RT/IR/CMakeLists.txt b/compiler/lib/Dialect/RT/IR/CMakeLists.txt index 41bf8fb46..e42298fb8 100644 --- a/compiler/lib/Dialect/RT/IR/CMakeLists.txt +++ b/compiler/lib/Dialect/RT/IR/CMakeLists.txt @@ -3,7 +3,7 @@ add_mlir_dialect_library(RTDialect RTOps.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Dialect/RT + ${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/RT DEPENDS MLIRRTOpsIncGen diff --git a/compiler/lib/Dialect/RT/IR/RTDialect.cpp b/compiler/lib/Dialect/RT/IR/RTDialect.cpp index 73a7631ca..7f264d877 100644 --- a/compiler/lib/Dialect/RT/IR/RTDialect.cpp +++ b/compiler/lib/Dialect/RT/IR/RTDialect.cpp @@ -14,26 +14,26 @@ #include "mlir/IR/PatternMatch.h" #include "mlir/IR/TypeUtilities.h" -#include "zamalang/Dialect/RT/IR/RTDialect.h" -#include "zamalang/Dialect/RT/IR/RTOps.h" -#include "zamalang/Dialect/RT/IR/RTTypes.h" +#include "concretelang/Dialect/RT/IR/RTDialect.h" +#include "concretelang/Dialect/RT/IR/RTOps.h" +#include "concretelang/Dialect/RT/IR/RTTypes.h" #define GET_TYPEDEF_CLASSES -#include "zamalang/Dialect/RT/IR/RTOpsTypes.cpp.inc" +#include "concretelang/Dialect/RT/IR/RTOpsTypes.cpp.inc" -#include "zamalang/Dialect/RT/IR/RTOpsDialect.cpp.inc" +#include "concretelang/Dialect/RT/IR/RTOpsDialect.cpp.inc" -using namespace mlir::zamalang::RT; +using namespace mlir::concretelang::RT; void RTDialect::initialize() { addOperations< #define GET_OP_LIST -#include "zamalang/Dialect/RT/IR/RTOps.cpp.inc" +#include "concretelang/Dialect/RT/IR/RTOps.cpp.inc" >(); addTypes< #define GET_TYPEDEF_LIST -#include "zamalang/Dialect/RT/IR/RTOpsTypes.cpp.inc" +#include "concretelang/Dialect/RT/IR/RTOpsTypes.cpp.inc" >(); } diff --git a/compiler/lib/Dialect/RT/IR/RTOps.cpp b/compiler/lib/Dialect/RT/IR/RTOps.cpp index ff4c789bb..c3dd813c6 100644 --- a/compiler/lib/Dialect/RT/IR/RTOps.cpp +++ b/compiler/lib/Dialect/RT/IR/RTOps.cpp @@ -8,13 +8,13 @@ #include "mlir/IR/Region.h" #include "mlir/IR/TypeUtilities.h" -#include "zamalang/Dialect/RT/IR/RTOps.h" -#include "zamalang/Dialect/RT/IR/RTTypes.h" +#include "concretelang/Dialect/RT/IR/RTOps.h" +#include "concretelang/Dialect/RT/IR/RTTypes.h" #define GET_OP_CLASSES -#include "zamalang/Dialect/RT/IR/RTOps.cpp.inc" +#include "concretelang/Dialect/RT/IR/RTOps.cpp.inc" -using namespace mlir::zamalang::RT; +using namespace mlir::concretelang::RT; void DataflowTaskOp::build( ::mlir::OpBuilder &builder, ::mlir::OperationState &result, diff --git a/compiler/lib/Runtime/CMakeLists.txt b/compiler/lib/Runtime/CMakeLists.txt index 9022735f1..eec3c240f 100644 --- a/compiler/lib/Runtime/CMakeLists.txt +++ b/compiler/lib/Runtime/CMakeLists.txt @@ -1,14 +1,14 @@ -add_library(ZamalangRuntime SHARED +add_library(ConcretelangRuntime SHARED context.c wrappers.c ) -target_link_libraries(ZamalangRuntime Concrete pthread m dl) +target_link_libraries(ConcretelangRuntime Concrete pthread m dl) -install(TARGETS ZamalangRuntime EXPORT ZamalangRuntime) -install(EXPORT ZamalangRuntime DESTINATION "./") +install(TARGETS ConcretelangRuntime EXPORT ConcretelangRuntime) +install(EXPORT ConcretelangRuntime DESTINATION "./") -if(ZAMALANG_PARALLEL_EXECUTION_ENABLED) +if(CONCRETELANG_PARALLEL_EXECUTION_ENABLED) add_library(DFRuntime SHARED DFRuntime.cpp) target_link_libraries(DFRuntime PUBLIC pthread m dl HPX::hpx HPX::iostreams_component -rdynamic) diff --git a/compiler/lib/Runtime/DFRuntime.cpp b/compiler/lib/Runtime/DFRuntime.cpp index 2128ed608..20e71e606 100644 --- a/compiler/lib/Runtime/DFRuntime.cpp +++ b/compiler/lib/Runtime/DFRuntime.cpp @@ -14,9 +14,9 @@ #include #include -#include "zamalang/Runtime/DFRuntime.hpp" -#include "zamalang/Runtime/distributed_generic_task_server.hpp" -#include "zamalang/Runtime/runtime_api.h" +#include "concretelang/Runtime/DFRuntime.hpp" +#include "concretelang/Runtime/distributed_generic_task_server.hpp" +#include "concretelang/Runtime/runtime_api.h" std::vector gcc; void *dl_handle; diff --git a/compiler/lib/Runtime/context.c b/compiler/lib/Runtime/context.c index 407b0da29..6ffac1c4f 100644 --- a/compiler/lib/Runtime/context.c +++ b/compiler/lib/Runtime/context.c @@ -1,5 +1,5 @@ #include "concrete-ffi.h" -#include "zamalang/Runtime/context.h" +#include "concretelang/Runtime/context.h" #include LweKeyswitchKey_u64 *get_keyswitch_key(RuntimeContext *context) { diff --git a/compiler/lib/Runtime/wrappers.c b/compiler/lib/Runtime/wrappers.c index 1a75bcde7..5ba888a9c 100644 --- a/compiler/lib/Runtime/wrappers.c +++ b/compiler/lib/Runtime/wrappers.c @@ -1,4 +1,4 @@ -#include "zamalang/Runtime/wrappers.h" +#include "concretelang/Runtime/wrappers.h" #include ForeignPlaintextList_u64 * diff --git a/compiler/lib/Support/CMakeLists.txt b/compiler/lib/Support/CMakeLists.txt index 220689785..4493557a6 100644 --- a/compiler/lib/Support/CMakeLists.txt +++ b/compiler/lib/Support/CMakeLists.txt @@ -1,4 +1,4 @@ -add_mlir_library(ZamalangSupport +add_mlir_library(ConcretelangSupport Error.cpp Pipeline.cpp Jit.cpp @@ -15,7 +15,7 @@ add_mlir_library(ZamalangSupport LLVMEmitFile.cpp ADDITIONAL_HEADER_DIRS - ${PROJECT_SOURCE_DIR}/include/zamalang/Support + ${PROJECT_SOURCE_DIR}/include/concretelang/Support DEPENDS MLIRConversionPassIncGen @@ -33,5 +33,5 @@ add_mlir_library(ZamalangSupport MLIRExecutionEngine ${LLVM_PTHREAD_LIB} - ZamalangRuntime + ConcretelangRuntime ) diff --git a/compiler/lib/Support/ClientParameters.cpp b/compiler/lib/Support/ClientParameters.cpp index 0daa2ea90..c9930eea4 100644 --- a/compiler/lib/Support/ClientParameters.cpp +++ b/compiler/lib/Support/ClientParameters.cpp @@ -6,12 +6,12 @@ #include -#include "zamalang/Dialect/LowLFHE/IR/LowLFHETypes.h" -#include "zamalang/Support/ClientParameters.h" -#include "zamalang/Support/V0Curves.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHETypes.h" +#include "concretelang/Support/ClientParameters.h" +#include "concretelang/Support/V0Curves.h" namespace mlir { -namespace zamalang { +namespace concretelang { const auto securityLevel = SECURITY_LEVEL_128; const auto keyFormat = KEY_FORMAT_BINARY; @@ -40,7 +40,7 @@ llvm::Expected gateFromMLIRType(std::string secretKeyID, }, }; } - if (type.isa()) { + if (type.isa()) { // TODO - Get the width from the LWECiphertextType instead of global // precision (could be possible after merge lowlfhe-ciphertext-parameter) return CircuitGate{ @@ -129,7 +129,7 @@ createClientParametersForV0(V0FHEContext fheContext, llvm::StringRef name, // Create input and output circuit gate parameters auto funcType = (*funcOp).getType(); bool hasContext = - funcType.getInputs().back().isa(); + funcType.getInputs().back().isa(); for (auto inType = funcType.getInputs().begin(); inType < funcType.getInputs().end() - hasContext; inType++) { auto gate = gateFromMLIRType("big", precision, encryptionVariance, *inType); @@ -159,33 +159,33 @@ static inline void hash(std::size_t &seed, const T &v, Rest... rest) { hash(seed, rest...); } -void LweSecretKeyParam::hash(size_t &seed) { mlir::zamalang::hash(seed, size); } +void LweSecretKeyParam::hash(size_t &seed) { mlir::concretelang::hash(seed, size); } void BootstrapKeyParam::hash(size_t &seed) { - mlir::zamalang::hash(seed, inputSecretKeyID, outputSecretKeyID, level, + mlir::concretelang::hash(seed, inputSecretKeyID, outputSecretKeyID, level, baseLog, glweDimension, variance); } void KeyswitchKeyParam::hash(size_t &seed) { - mlir::zamalang::hash(seed, inputSecretKeyID, outputSecretKeyID, level, + mlir::concretelang::hash(seed, inputSecretKeyID, outputSecretKeyID, level, baseLog, variance); } std::size_t ClientParameters::hash() { std::size_t currentHash = 1; for (auto secretKeyParam : secretKeys) { - mlir::zamalang::hash(currentHash, secretKeyParam.first); + mlir::concretelang::hash(currentHash, secretKeyParam.first); secretKeyParam.second.hash(currentHash); } for (auto bootstrapKeyParam : bootstrapKeys) { - mlir::zamalang::hash(currentHash, bootstrapKeyParam.first); + mlir::concretelang::hash(currentHash, bootstrapKeyParam.first); bootstrapKeyParam.second.hash(currentHash); } for (auto keyswitchParam : keyswitchKeys) { - mlir::zamalang::hash(currentHash, keyswitchParam.first); + mlir::concretelang::hash(currentHash, keyswitchParam.first); keyswitchParam.second.hash(currentHash); } return currentHash; } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Support/CompilerEngine.cpp b/compiler/lib/Support/CompilerEngine.cpp index 283ceda80..c9805442f 100644 --- a/compiler/lib/Support/CompilerEngine.cpp +++ b/compiler/lib/Support/CompilerEngine.cpp @@ -13,19 +13,19 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { // Creates a new compilation context that can be shared across // compilation engines and results @@ -47,14 +47,14 @@ mlir::MLIRContext *CompilationContext::getMLIRContext() { if (this->mlirContext == nullptr) { this->mlirContext = new mlir::MLIRContext(); - this->mlirContext->getOrLoadDialect(); - this->mlirContext->getOrLoadDialect(); + this->mlirContext->getOrLoadDialect(); + this->mlirContext->getOrLoadDialect(); this->mlirContext - ->getOrLoadDialect(); + ->getOrLoadDialect(); this->mlirContext - ->getOrLoadDialect(); + ->getOrLoadDialect(); this->mlirContext - ->getOrLoadDialect(); + ->getOrLoadDialect(); this->mlirContext->getOrLoadDialect(); this->mlirContext->getOrLoadDialect(); this->mlirContext->getOrLoadDialect(); @@ -78,7 +78,7 @@ llvm::LLVMContext *CompilationContext::getLLVMContext() { // automatically detected configuration and prevents the autodetection // pass from running. void CompilerEngine::setFHEConstraints( - const mlir::zamalang::V0FHEConstraint &c) { + const mlir::concretelang::V0FHEConstraint &c) { this->overrideMaxEintPrecision = c.p; this->overrideMaxMANP = c.norm2; } @@ -113,22 +113,22 @@ void CompilerEngine::setEnablePass( } // Returns the overwritten V0FHEConstraint or try to compute them from HLFHE -llvm::Expected> +llvm::Expected> CompilerEngine::getV0FHEConstraint(CompilationResult &res) { mlir::MLIRContext &mlirContext = *this->compilationContext->getMLIRContext(); mlir::ModuleOp module = res.mlirModuleRef->get(); - llvm::Optional fheConstraints; + llvm::Optional fheConstraints; // If the values has been overwritten returns if (this->overrideMaxEintPrecision.hasValue() && this->overrideMaxMANP.hasValue()) { - return mlir::zamalang::V0FHEConstraint{ + return mlir::concretelang::V0FHEConstraint{ this->overrideMaxMANP.getValue(), this->overrideMaxEintPrecision.getValue()}; } // Else compute constraint from HLFHE - llvm::Expected> + llvm::Expected> fheConstraintsOrErr = - mlir::zamalang::pipeline::getFHEConstraintsFromHLFHE( + mlir::concretelang::pipeline::getFHEConstraintsFromHLFHE( mlirContext, module, enablePass); if (auto err = fheConstraintsOrErr.takeError()) @@ -145,7 +145,7 @@ llvm::Error CompilerEngine::determineFHEParameters(CompilationResult &res) { if (!fheConstraintOrErr.get().hasValue()) { return llvm::Error::success(); } - const mlir::zamalang::V0Parameter *fheParams = + const mlir::concretelang::V0Parameter *fheParams = getV0Parameter(fheConstraintOrErr.get().getValue()); if (!fheParams) { @@ -154,7 +154,7 @@ llvm::Error CompilerEngine::determineFHEParameters(CompilationResult &res) { << (*fheConstraintOrErr)->norm2 << " and p of " << (*fheConstraintOrErr)->p; } - res.fheContext.emplace(mlir::zamalang::V0FHEContext{ + res.fheContext.emplace(mlir::concretelang::V0FHEContext{ (*fheConstraintOrErr).getValue(), *fheParams}); return llvm::Error::success(); @@ -208,13 +208,13 @@ CompilerEngine::compile(llvm::SourceMgr &sm, Target target, OptionalLib lib) { // HLFHELinalg tiling if (this->hlfhelinalgTileSizes) { - if (mlir::zamalang::pipeline::markHLFHELinalgForTiling( + if (mlir::concretelang::pipeline::markHLFHELinalgForTiling( mlirContext, module, *this->hlfhelinalgTileSizes, enablePass) .failed()) return errorDiag("Marking of HLFHELinalg operations for tiling failed"); } - if (mlir::zamalang::pipeline::tileMarkedHLFHELinalg(mlirContext, module, + if (mlir::concretelang::pipeline::tileMarkedHLFHELinalg(mlirContext, module, enablePass) .failed()) { return errorDiag("Tiling of HLFHELinalg operations failed"); @@ -222,7 +222,7 @@ CompilerEngine::compile(llvm::SourceMgr &sm, Target target, OptionalLib lib) { // Auto parallelization if (this->autoParallelize && - mlir::zamalang::pipeline::autopar(mlirContext, module, enablePass) + mlir::concretelang::pipeline::autopar(mlirContext, module, enablePass) .failed()) { return StreamStringError("Auto parallelization failed"); } @@ -231,7 +231,7 @@ CompilerEngine::compile(llvm::SourceMgr &sm, Target target, OptionalLib lib) { return std::move(res); // HLFHE -> MidLFHE - if (mlir::zamalang::pipeline::lowerHLFHEToMidLFHE(mlirContext, module, + if (mlir::concretelang::pipeline::lowerHLFHEToMidLFHE(mlirContext, module, enablePass) .failed()) { return errorDiag("Lowering from HLFHE to MidLFHE failed"); @@ -240,7 +240,7 @@ CompilerEngine::compile(llvm::SourceMgr &sm, Target target, OptionalLib lib) { return std::move(res); // MidLFHE -> LowLFHE - if (mlir::zamalang::pipeline::lowerMidLFHEToLowLFHE( + if (mlir::concretelang::pipeline::lowerMidLFHEToLowLFHE( mlirContext, module, res.fheContext, this->enablePass) .failed()) { return errorDiag("Lowering from MidLFHE to LowLFHE failed"); @@ -249,7 +249,7 @@ CompilerEngine::compile(llvm::SourceMgr &sm, Target target, OptionalLib lib) { return std::move(res); // LowLFHE -> Canonical dialects - if (mlir::zamalang::pipeline::lowerLowLFHEToStd(mlirContext, module, + if (mlir::concretelang::pipeline::lowerLowLFHEToStd(mlirContext, module, enablePass) .failed()) { return errorDiag("Lowering from LowLFHE to canonical MLIR dialects failed"); @@ -269,8 +269,8 @@ CompilerEngine::compile(llvm::SourceMgr &sm, Target target, OptionalLib lib) { "Cannot generate client parameters, the fhe context is empty"); } - llvm::Expected clientParametersOrErr = - mlir::zamalang::createClientParametersForV0( + llvm::Expected clientParametersOrErr = + mlir::concretelang::createClientParametersForV0( *res.fheContext, *this->clientParametersFuncName, module); if (llvm::Error err = clientParametersOrErr.takeError()) @@ -280,7 +280,7 @@ CompilerEngine::compile(llvm::SourceMgr &sm, Target target, OptionalLib lib) { } // MLIR canonical dialects -> LLVM Dialect - if (mlir::zamalang::pipeline::lowerStdToLLVMDialect(mlirContext, module, + if (mlir::concretelang::pipeline::lowerStdToLLVMDialect(mlirContext, module, enablePass) .failed()) { return errorDiag("Failed to lower to LLVM dialect"); @@ -292,7 +292,7 @@ CompilerEngine::compile(llvm::SourceMgr &sm, Target target, OptionalLib lib) { // Lowering to actual LLVM IR (i.e., not the LLVM dialect) llvm::LLVMContext &llvmContext = *this->compilationContext->getLLVMContext(); - res.llvmModule = mlir::zamalang::pipeline::lowerLLVMDialectToLLVMIR( + res.llvmModule = mlir::concretelang::pipeline::lowerLLVMDialectToLLVMIR( mlirContext, llvmContext, module); if (!res.llvmModule) @@ -301,7 +301,7 @@ CompilerEngine::compile(llvm::SourceMgr &sm, Target target, OptionalLib lib) { if (target == Target::LLVM_IR) return std::move(res); - if (mlir::zamalang::pipeline::optimizeLLVMModule(llvmContext, *res.llvmModule) + if (mlir::concretelang::pipeline::optimizeLLVMModule(llvmContext, *res.llvmModule) .failed()) { return errorDiag("Failed to optimize LLVM IR"); } @@ -355,7 +355,7 @@ CompilerEngine::compile(std::unique_ptr buffer, template llvm::Expected CompilerEngine::compile(std::vector inputs, std::string libraryPath) { - using Library = mlir::zamalang::CompilerEngine::Library; + using Library = mlir::concretelang::CompilerEngine::Library; auto outputLib = std::make_shared(libraryPath); auto target = CompilerEngine::Target::LIBRARY; @@ -401,7 +401,7 @@ CompilerEngine::Library::addCompilation(CompilationResult &compilation) { std::to_string(objectsPath.size()) + ".mlir"; } auto objectPath = sourceName + OBJECT_EXT; - auto error = mlir::zamalang::emitObject(*module, objectPath); + auto error = mlir::concretelang::emitObject(*module, objectPath); if (error) { return std::move(error); @@ -430,7 +430,7 @@ std::string ensureLibDotExt(std::string path, std::string dotExt) { llvm::Expected CompilerEngine::Library::emit(std::string dotExt, std::string linker) { auto pathDotExt = ensureLibDotExt(libraryPath, dotExt); - auto error = mlir::zamalang::emitLibrary(objectsPath, pathDotExt, linker); + auto error = mlir::concretelang::emitLibrary(objectsPath, pathDotExt, linker); if (error) { return std::move(error); } else { @@ -462,5 +462,5 @@ CompilerEngine::Library::~Library() { } } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Support/Error.cpp b/compiler/lib/Support/Error.cpp index c7e4f3eae..17b4d402c 100644 --- a/compiler/lib/Support/Error.cpp +++ b/compiler/lib/Support/Error.cpp @@ -1,15 +1,15 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { // Specialized `operator<<` for `llvm::Error` that marks the error // as checked through `std::move` and `llvm::toString` StreamStringError &operator<<(StreamStringError &se, llvm::Error &err) { se << llvm::toString(std::move(err)); return se; } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Support/Jit.cpp b/compiler/lib/Support/Jit.cpp index 5ee8cb916..0ccd01497 100644 --- a/compiler/lib/Support/Jit.cpp +++ b/compiler/lib/Support/Jit.cpp @@ -10,12 +10,12 @@ #include #include -#include -#include -#include +#include +#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { llvm::Expected> JITLambda::create(llvm::StringRef name, mlir::ModuleOp &module, @@ -471,5 +471,5 @@ llvm::Error JITLambda::Argument::getResult(size_t pos, void *res, return llvm::Error::success(); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Support/JitCompilerEngine.cpp b/compiler/lib/Support/JitCompilerEngine.cpp index 484a30db3..67b909035 100644 --- a/compiler/lib/Support/JitCompilerEngine.cpp +++ b/compiler/lib/Support/JitCompilerEngine.cpp @@ -6,10 +6,10 @@ #include #include #include -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { JitCompilerEngine::JitCompilerEngine( std::shared_ptr compilationContext, @@ -98,7 +98,7 @@ JitCompilerEngine::buildLambda(llvm::SourceMgr &sm, llvm::StringRef funcName, auto optPipeline = mlir::makeOptimizingTransformer(3, 0, nullptr); llvm::Expected> lambdaOrErr = - mlir::zamalang::JITLambda::create(funcName, module, optPipeline, + mlir::concretelang::JITLambda::create(funcName, module, optPipeline, runtimeLibPath); if (!lambdaOrErr) { @@ -115,7 +115,7 @@ JitCompilerEngine::buildLambda(llvm::SourceMgr &sm, llvm::StringRef funcName, "parameters has not been computed"); } - llvm::Expected> keySetOrErr = + llvm::Expected> keySetOrErr = (cache.hasValue()) ? cache->tryLoadOrGenerateSave(*compRes.clientParameters, 0, 0) : KeySet::generate(*compRes.clientParameters, 0, 0); @@ -129,5 +129,5 @@ JitCompilerEngine::buildLambda(llvm::SourceMgr &sm, llvm::StringRef funcName, return Lambda{this->compilationContext, std::move(lambda), std::move(keySet)}; } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Support/KeySet.cpp b/compiler/lib/Support/KeySet.cpp index d622742dc..23f5b6276 100644 --- a/compiler/lib/Support/KeySet.cpp +++ b/compiler/lib/Support/KeySet.cpp @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#include "zamalang/Support/KeySet.h" -#include "zamalang/Support/Error.h" +#include "concretelang/Support/KeySet.h" +#include "concretelang/Support/Error.h" #define CAPI_ERR_TO_LLVM_ERROR(s, msg) \ { \ @@ -15,7 +15,7 @@ } namespace mlir { -namespace zamalang { +namespace concretelang { KeySet::~KeySet() { int err; @@ -366,5 +366,5 @@ KeySet::getKeyswitchKeys() { return keyswitchKeys; } -} // namespace zamalang +} // namespace concretelang } // namespace mlir \ No newline at end of file diff --git a/compiler/lib/Support/KeySetCache.cpp b/compiler/lib/Support/KeySetCache.cpp index 92018462b..2cab49bfd 100644 --- a/compiler/lib/Support/KeySetCache.cpp +++ b/compiler/lib/Support/KeySetCache.cpp @@ -1,8 +1,8 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#include "zamalang/Support/KeySetCache.h" -#include "zamalang/Support/Error.h" +#include "concretelang/Support/KeySetCache.h" +#include "concretelang/Support/Error.h" #include "llvm/ADT/ScopeExit.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" @@ -16,7 +16,7 @@ extern "C" { } namespace mlir { -namespace zamalang { +namespace concretelang { static std::string readFile(llvm::SmallString<0> &path) { std::ifstream in((std::string)path, std::ofstream::binary); @@ -226,5 +226,5 @@ KeySetCache::tryLoadOrGenerateSave(ClientParameters ¶ms, uint64_t seed_msb, return key_set; } -} // namespace zamalang +} // namespace concretelang } // namespace mlir \ No newline at end of file diff --git a/compiler/lib/Support/LLVMEmitFile.cpp b/compiler/lib/Support/LLVMEmitFile.cpp index 82a20d5b2..d71ed22fa 100644 --- a/compiler/lib/Support/LLVMEmitFile.cpp +++ b/compiler/lib/Support/LLVMEmitFile.cpp @@ -10,10 +10,10 @@ #include -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { using std::string; using std::vector; @@ -108,5 +108,5 @@ llvm::Error emitLibrary(vector objectsPath, string libraryPath, return callCmd(cmd); } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Support/LambdaArgument.cpp b/compiler/lib/Support/LambdaArgument.cpp index ef1fc697f..bd1b0e4f5 100644 --- a/compiler/lib/Support/LambdaArgument.cpp +++ b/compiler/lib/Support/LambdaArgument.cpp @@ -1,10 +1,10 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { char LambdaArgument::ID = 0; -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Support/Pipeline.cpp b/compiler/lib/Support/Pipeline.cpp index 8a8f84d72..22bbfe12e 100644 --- a/compiler/lib/Support/Pipeline.cpp +++ b/compiler/lib/Support/Pipeline.cpp @@ -15,22 +15,22 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { namespace pipeline { static void pipelinePrinting(llvm::StringRef name, mlir::PassManager &pm, mlir::MLIRContext &ctx) { - if (mlir::zamalang::isVerbose()) { - mlir::zamalang::log_verbose() + if (mlir::concretelang::isVerbose()) { + mlir::concretelang::log_verbose() << "##################################################\n" << "### " << name << " pipeline\n"; auto isModule = [](mlir::Pass *, mlir::Operation *op) { @@ -58,7 +58,7 @@ addPotentiallyNestedPass(mlir::PassManager &pm, std::unique_ptr pass, } } -llvm::Expected> +llvm::Expected> getFHEConstraintsFromHLFHE(mlir::MLIRContext &context, mlir::ModuleOp &module, std::function enablePass) { llvm::Optional oMax2norm; @@ -67,10 +67,10 @@ getFHEConstraintsFromHLFHE(mlir::MLIRContext &context, mlir::ModuleOp &module, mlir::PassManager pm(&context); pipelinePrinting("ComputeFHEConstraintOnHLFHE", pm, context); - addPotentiallyNestedPass(pm, mlir::zamalang::createMANPPass(), enablePass); + addPotentiallyNestedPass(pm, mlir::concretelang::createMANPPass(), enablePass); addPotentiallyNestedPass( pm, - mlir::zamalang::createMaxMANPPass([&](const llvm::APInt &currMaxMANP, + mlir::concretelang::createMaxMANPPass([&](const llvm::APInt &currMaxMANP, unsigned currMaxWidth) { assert((uint64_t)currMaxWidth < std::numeric_limits::max() && "Maximum width does not fit into size_t"); @@ -95,10 +95,10 @@ getFHEConstraintsFromHLFHE(mlir::MLIRContext &context, mlir::ModuleOp &module, "required precision", llvm::inconvertibleErrorCode()); } - llvm::Optional ret; + llvm::Optional ret; if (oMax2norm.hasValue() && oMaxWidth.hasValue()) { - ret = llvm::Optional( + ret = llvm::Optional( {/*.norm2 = */ ceilLog2(oMax2norm.getValue()), /*.p = */ oMaxWidth.getValue()}); } @@ -112,7 +112,7 @@ mlir::LogicalResult autopar(mlir::MLIRContext &context, mlir::ModuleOp &module, pipelinePrinting("AutoPar", pm, context); addPotentiallyNestedPass( - pm, mlir::zamalang::createBuildDataflowTaskGraphPass(), enablePass); + pm, mlir::concretelang::createBuildDataflowTaskGraphPass(), enablePass); return pm.run(module.getOperation()); } @@ -122,7 +122,7 @@ tileMarkedHLFHELinalg(mlir::MLIRContext &context, mlir::ModuleOp &module, std::function enablePass) { mlir::PassManager pm(&context); pipelinePrinting("TileMarkedHLFHELinalg", pm, context); - addPotentiallyNestedPass(pm, mlir::zamalang::createHLFHELinalgTilingPass(), + addPotentiallyNestedPass(pm, mlir::concretelang::createHLFHELinalgTilingPass(), enablePass); return pm.run(module.getOperation()); @@ -147,9 +147,9 @@ lowerHLFHEToMidLFHE(mlir::MLIRContext &context, mlir::ModuleOp &module, pipelinePrinting("HLFHEToMidLFHE", pm, context); addPotentiallyNestedPass( - pm, mlir::zamalang::createConvertHLFHETensorOpsToLinalg(), enablePass); + pm, mlir::concretelang::createConvertHLFHETensorOpsToLinalg(), enablePass); addPotentiallyNestedPass( - pm, mlir::zamalang::createConvertHLFHEToMidLFHEPass(), enablePass); + pm, mlir::concretelang::createConvertHLFHEToMidLFHEPass(), enablePass); return pm.run(module.getOperation()); } @@ -164,13 +164,13 @@ lowerMidLFHEToLowLFHE(mlir::MLIRContext &context, mlir::ModuleOp &module, if (fheContext.hasValue()) { addPotentiallyNestedPass( pm, - mlir::zamalang::createConvertMidLFHEGlobalParametrizationPass( + mlir::concretelang::createConvertMidLFHEGlobalParametrizationPass( fheContext.getValue()), enablePass); } addPotentiallyNestedPass( - pm, mlir::zamalang::createConvertMidLFHEToLowLFHEPass(), enablePass); + pm, mlir::concretelang::createConvertMidLFHEToLowLFHEPass(), enablePass); return pm.run(module.getOperation()); } @@ -181,7 +181,7 @@ lowerLowLFHEToStd(mlir::MLIRContext &context, mlir::ModuleOp &module, mlir::PassManager pm(&context); pipelinePrinting("LowLFHEToStd", pm, context); addPotentiallyNestedPass( - pm, mlir::zamalang::createConvertLowLFHEToConcreteCAPIPass(), enablePass); + pm, mlir::concretelang::createConvertLowLFHEToConcreteCAPIPass(), enablePass); return pm.run(module.getOperation()); } @@ -193,7 +193,7 @@ lowerStdToLLVMDialect(mlir::MLIRContext &context, mlir::ModuleOp &module, // Unparametrize LowLFHE addPotentiallyNestedPass( - pm, mlir::zamalang::createConvertLowLFHEUnparametrizePass(), enablePass); + pm, mlir::concretelang::createConvertLowLFHEUnparametrizePass(), enablePass); // Bufferize addPotentiallyNestedPass(pm, mlir::createTensorConstantBufferizePass(), @@ -206,14 +206,14 @@ lowerStdToLLVMDialect(mlir::MLIRContext &context, mlir::ModuleOp &module, addPotentiallyNestedPass(pm, mlir::createSCFBufferizePass(), enablePass); addPotentiallyNestedPass(pm, mlir::createFuncBufferizePass(), enablePass); addPotentiallyNestedPass( - pm, mlir::zamalang::createBufferizeDataflowTaskOpsPass(), enablePass); + pm, mlir::concretelang::createBufferizeDataflowTaskOpsPass(), enablePass); addPotentiallyNestedPass(pm, mlir::createFinalizingBufferizePass(), enablePass); // Lower Dataflow tasks to DRF - addPotentiallyNestedPass(pm, mlir::zamalang::createFixupDataflowTaskOpsPass(), + addPotentiallyNestedPass(pm, mlir::concretelang::createFixupDataflowTaskOpsPass(), enablePass); - addPotentiallyNestedPass(pm, mlir::zamalang::createLowerDataflowTasksPass(), + addPotentiallyNestedPass(pm, mlir::concretelang::createLowerDataflowTasksPass(), enablePass); addPotentiallyNestedPass(pm, mlir::createConvertLinalgToLoopsPass(), enablePass); @@ -221,7 +221,7 @@ lowerStdToLLVMDialect(mlir::MLIRContext &context, mlir::ModuleOp &module, // Convert to MLIR LLVM Dialect addPotentiallyNestedPass( - pm, mlir::zamalang::createConvertMLIRLowerableDialectsToLLVMPass(), + pm, mlir::concretelang::createConvertMLIRLowerableDialectsToLLVMPass(), enablePass); return pm.run(module); @@ -250,5 +250,5 @@ mlir::LogicalResult optimizeLLVMModule(llvm::LLVMContext &llvmContext, } } // namespace pipeline -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Support/V0Curves.cpp b/compiler/lib/Support/V0Curves.cpp index 6decaf382..0cde6d5c7 100644 --- a/compiler/lib/Support/V0Curves.cpp +++ b/compiler/lib/Support/V0Curves.cpp @@ -3,10 +3,10 @@ #include -#include "zamalang/Support/V0Curves.h" +#include "concretelang/Support/V0Curves.h" namespace mlir { -namespace zamalang { +namespace concretelang { V0Curves curves[SECURITY_LEVEL_MAX][KEY_FORMAT_MAX] = { {V0Curves(SECURITY_LEVEL_80, -0.04047677865612648, 1.1433465085639063, 160, @@ -24,5 +24,5 @@ V0Curves *getV0Curves(int securityLevel, int keyFormat) { } return &curves[securityLevel][keyFormat]; } -} // namespace zamalang +} // namespace concretelang } // namespace mlir \ No newline at end of file diff --git a/compiler/lib/Support/V0Parameters.cpp b/compiler/lib/Support/V0Parameters.cpp index fedc991c7..0c326d48d 100644 --- a/compiler/lib/Support/V0Parameters.cpp +++ b/compiler/lib/Support/V0Parameters.cpp @@ -6,10 +6,10 @@ /// We should include this in our build system, but for moment it is just a cc /// from the optimizer output. -#include "zamalang/Support/V0Parameters.h" +#include "concretelang/Support/V0Parameters.h" namespace mlir { -namespace zamalang { +namespace concretelang { using namespace std; const int NORM2_MAX = 31; @@ -157,5 +157,5 @@ const V0Parameter *getV0Parameter(V0FHEConstraint constraint) { return param; } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/lib/Support/logging.cpp b/compiler/lib/Support/logging.cpp index 79bbec4f6..5b2831f53 100644 --- a/compiler/lib/Support/logging.cpp +++ b/compiler/lib/Support/logging.cpp @@ -1,10 +1,10 @@ // Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. // See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information. -#include +#include namespace mlir { -namespace zamalang { +namespace concretelang { static bool verbose = false; static StreamWrap errWrap(&llvm::errs()); static StreamWrap nullWrap(&llvm::nulls()); @@ -20,7 +20,7 @@ StreamWrap &log_verbose(void) { // Sets up logging. If `verbose` is false, messages passed to // `log_verbose` will be discarded. -void setupLogging(bool verbose) { ::mlir::zamalang::verbose = verbose; } +void setupLogging(bool verbose) { ::mlir::concretelang::verbose = verbose; } bool isVerbose() { return verbose; } -} // namespace zamalang +} // namespace concretelang } // namespace mlir diff --git a/compiler/setup.py b/compiler/setup.py index a10e1b7b0..00ff59adc 100644 --- a/compiler/setup.py +++ b/compiler/setup.py @@ -14,7 +14,7 @@ def read(fname): def find_version(): return re.match( r"__version__ = \"(?P.+)\"", - read("lib/Bindings/Python/zamalang/version.py"), + read("lib/Bindings/Python/concretelang/version.py"), ).group("version") @@ -57,15 +57,15 @@ setuptools.setup( long_description_content_type="text/markdown", url="https://github.com/zama-ai/homomorphizer", packages=setuptools.find_packages( - where=build_dir() + "tools/zamalang/python_packages/zamalang_core", - include=["zamalang", "zamalang.*"], + where=build_dir() + "tools/concretelang/python_packages/concretelang_core", + include=["concretelang", "concretelang.*"], ) + setuptools.find_namespace_packages( - where=build_dir() + "tools/zamalang/python_packages/zamalang_core", + where=build_dir() + "tools/concretelang/python_packages/concretelang_core", include=["mlir", "mlir.*"], ), install_requires=["numpy", "PyYAML"], - package_dir={"": build_dir() + "tools/zamalang/python_packages/zamalang_core"}, + package_dir={"": build_dir() + "tools/concretelang/python_packages/concretelang_core"}, include_package_data=True, package_data={"": ["*.so", "*.dylib"]}, classifiers=[ diff --git a/compiler/src/CMakeLists.txt b/compiler/src/CMakeLists.txt index f40d6aaba..8e9919af6 100644 --- a/compiler/src/CMakeLists.txt +++ b/compiler/src/CMakeLists.txt @@ -1,12 +1,12 @@ -add_llvm_tool(zamacompiler main.cpp) -target_compile_options(zamacompiler PRIVATE -fexceptions) -llvm_update_compile_flags(zamacompiler) +add_llvm_tool(concretecompiler main.cpp) +target_compile_options(concretecompiler PRIVATE -fexceptions) +llvm_update_compile_flags(concretecompiler) get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) -if(ZAMALANG_PARALLEL_EXECUTION_ENABLED) - target_link_libraries(zamacompiler +if(CONCRETELANG_PARALLEL_EXECUTION_ENABLED) + target_link_libraries(concretecompiler PRIVATE ${dialect_libs} ${conversion_libs} @@ -21,7 +21,7 @@ if(ZAMALANG_PARALLEL_EXECUTION_ENABLED) MLIRLLVMToLLVMIRTranslation RTDialect - ZamalangSupport + ConcretelangSupport -Wl,-rpath,${CMAKE_BINARY_DIR}/lib/Runtime -Wl,-rpath,${HPX_DIR}/../../ @@ -29,7 +29,7 @@ if(ZAMALANG_PARALLEL_EXECUTION_ENABLED) DFRuntime ) else() - target_link_libraries(zamacompiler + target_link_libraries(concretecompiler PRIVATE ${dialect_libs} ${conversion_libs} @@ -43,8 +43,8 @@ else() MLIRLLVMIR MLIRLLVMToLLVMIRTranslation - ZamalangSupport + ConcretelangSupport ) endif() -mlir_check_all_link_libraries(zamacompiler) +mlir_check_all_link_libraries(concretecompiler) diff --git a/compiler/src/main.cpp b/compiler/src/main.cpp index c8a224814..cd18bda75 100644 --- a/compiler/src/main.cpp +++ b/compiler/src/main.cpp @@ -18,21 +18,21 @@ #include #include "mlir/IR/BuiltinOps.h" -#include "zamalang/Conversion/Passes.h" -#include "zamalang/Conversion/Utils/GlobalFHEContext.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHEDialect.h" -#include "zamalang/Dialect/HLFHE/IR/HLFHETypes.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHEDialect.h" -#include "zamalang/Dialect/LowLFHE/IR/LowLFHETypes.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHEDialect.h" -#include "zamalang/Dialect/MidLFHE/IR/MidLFHETypes.h" -#include "zamalang/Dialect/RT/IR/RTDialect.h" -#include "zamalang/Support/Error.h" -#include "zamalang/Support/JitCompilerEngine.h" -#include "zamalang/Support/KeySet.h" -#include "zamalang/Support/LLVMEmitFile.h" -#include "zamalang/Support/Pipeline.h" -#include "zamalang/Support/logging.h" +#include "concretelang/Conversion/Passes.h" +#include "concretelang/Conversion/Utils/GlobalFHEContext.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHEDialect.h" +#include "concretelang/Dialect/HLFHE/IR/HLFHETypes.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHEDialect.h" +#include "concretelang/Dialect/LowLFHE/IR/LowLFHETypes.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHEDialect.h" +#include "concretelang/Dialect/MidLFHE/IR/MidLFHETypes.h" +#include "concretelang/Dialect/RT/IR/RTDialect.h" +#include "concretelang/Support/Error.h" +#include "concretelang/Support/JitCompilerEngine.h" +#include "concretelang/Support/KeySet.h" +#include "concretelang/Support/LLVMEmitFile.h" +#include "concretelang/Support/Pipeline.h" +#include "concretelang/Support/logging.h" enum Action { ROUND_TRIP, @@ -162,33 +162,33 @@ llvm::cl::list hlfhelinalgTileSizes( llvm::cl::ZeroOrMore, llvm::cl::MiscFlags::CommaSeparated); } // namespace cmdline -llvm::Expected buildFHEContext( - llvm::Optional autoFHEConstraints, +llvm::Expected buildFHEContext( + llvm::Optional autoFHEConstraints, llvm::Optional overrideMaxEintPrecision, llvm::Optional overrideMaxMANP) { if (!autoFHEConstraints.hasValue() && (!overrideMaxMANP.hasValue() || !overrideMaxEintPrecision.hasValue())) { - return mlir::zamalang::StreamStringError( + return mlir::concretelang::StreamStringError( "Maximum encrypted integer precision and maximum for the Minimal" "Arithmetic Noise Passing are required, but were neither specified" "explicitly nor determined automatically"); } - mlir::zamalang::V0FHEConstraint fheConstraints{ + mlir::concretelang::V0FHEConstraint fheConstraints{ overrideMaxMANP.hasValue() ? overrideMaxMANP.getValue() : autoFHEConstraints.getValue().norm2, overrideMaxEintPrecision.hasValue() ? overrideMaxEintPrecision.getValue() : autoFHEConstraints.getValue().p}; - const mlir::zamalang::V0Parameter *parameter = getV0Parameter(fheConstraints); + const mlir::concretelang::V0Parameter *parameter = getV0Parameter(fheConstraints); if (!parameter) { - return mlir::zamalang::StreamStringError() + return mlir::concretelang::StreamStringError() << "Could not determine V0 parameters for 2-norm of " << fheConstraints.norm2 << " and p of " << fheConstraints.p; } - return mlir::zamalang::V0FHEContext{fheConstraints, *parameter}; + return mlir::concretelang::V0FHEContext{fheConstraints, *parameter}; } namespace llvm { @@ -242,13 +242,13 @@ mlir::LogicalResult processInputBuffer( llvm::Optional overrideMaxMANP, bool verifyDiagnostics, llvm::Optional> hlfhelinalgTileSizes, bool autoParallelize, - llvm::Optional keySetCache, + llvm::Optional keySetCache, llvm::raw_ostream &os, - std::shared_ptr outputLib) { - std::shared_ptr ccx = - mlir::zamalang::CompilationContext::createShared(); + std::shared_ptr outputLib) { + std::shared_ptr ccx = + mlir::concretelang::CompilationContext::createShared(); - mlir::zamalang::JitCompilerEngine ce{ccx}; + mlir::concretelang::JitCompilerEngine ce{ccx}; ce.setVerifyDiagnostics(verifyDiagnostics); ce.setAutoParallelize(autoParallelize); @@ -270,11 +270,11 @@ mlir::LogicalResult processInputBuffer( ce.setHLFHELinalgTileSizes(*hlfhelinalgTileSizes); if (action == Action::JIT_INVOKE) { - llvm::Expected lambdaOrErr = + llvm::Expected lambdaOrErr = ce.buildLambda(std::move(buffer), jitFuncName, keySetCache); if (!lambdaOrErr) { - mlir::zamalang::log_error() + mlir::concretelang::log_error() << "Failed to JIT-compile " << jitFuncName << ": " << llvm::toString(std::move(lambdaOrErr.takeError())); return mlir::failure(); @@ -283,7 +283,7 @@ mlir::LogicalResult processInputBuffer( llvm::Expected resOrErr = (*lambdaOrErr)(jitArgs); if (!resOrErr) { - mlir::zamalang::log_error() + mlir::concretelang::log_error() << "Failed to JIT-invoke " << jitFuncName << " with arguments " << jitArgs << ": " << llvm::toString(std::move(resOrErr.takeError())); return mlir::failure(); @@ -291,35 +291,35 @@ mlir::LogicalResult processInputBuffer( os << *resOrErr << "\n"; } else { - enum mlir::zamalang::CompilerEngine::Target target; + enum mlir::concretelang::CompilerEngine::Target target; switch (action) { case Action::ROUND_TRIP: - target = mlir::zamalang::CompilerEngine::Target::ROUND_TRIP; + target = mlir::concretelang::CompilerEngine::Target::ROUND_TRIP; break; case Action::DUMP_HLFHE: - target = mlir::zamalang::CompilerEngine::Target::HLFHE; + target = mlir::concretelang::CompilerEngine::Target::HLFHE; break; case Action::DUMP_MIDLFHE: - target = mlir::zamalang::CompilerEngine::Target::MIDLFHE; + target = mlir::concretelang::CompilerEngine::Target::MIDLFHE; break; case Action::DUMP_LOWLFHE: - target = mlir::zamalang::CompilerEngine::Target::LOWLFHE; + target = mlir::concretelang::CompilerEngine::Target::LOWLFHE; break; case Action::DUMP_STD: - target = mlir::zamalang::CompilerEngine::Target::STD; + target = mlir::concretelang::CompilerEngine::Target::STD; break; case Action::DUMP_LLVM_DIALECT: - target = mlir::zamalang::CompilerEngine::Target::LLVM; + target = mlir::concretelang::CompilerEngine::Target::LLVM; break; case Action::DUMP_LLVM_IR: - target = mlir::zamalang::CompilerEngine::Target::LLVM_IR; + target = mlir::concretelang::CompilerEngine::Target::LLVM_IR; break; case Action::DUMP_OPTIMIZED_LLVM_IR: - target = mlir::zamalang::CompilerEngine::Target::OPTIMIZED_LLVM_IR; + target = mlir::concretelang::CompilerEngine::Target::OPTIMIZED_LLVM_IR; break; case Action::COMPILE: - target = mlir::zamalang::CompilerEngine::Target::LIBRARY; + target = mlir::concretelang::CompilerEngine::Target::LIBRARY; break; case JIT_INVOKE: // Case just here to satisfy the compiler; already handled above @@ -328,7 +328,7 @@ mlir::LogicalResult processInputBuffer( auto retOrErr = ce.compile(std::move(buffer), target, outputLib); if (!retOrErr) { - mlir::zamalang::log_error() + mlir::concretelang::log_error() << llvm::toString(std::move(retOrErr.takeError())) << "\n"; return mlir::failure(); @@ -357,7 +357,7 @@ mlir::LogicalResult compilerMain(int argc, char **argv) { // Parse command line arguments llvm::cl::ParseCommandLineOptions(argc, argv); - mlir::zamalang::setupLogging(cmdline::verbose); + mlir::concretelang::setupLogging(cmdline::verbose); // String for error messages std::string errorMessage; @@ -385,9 +385,9 @@ mlir::LogicalResult compilerMain(int argc, char **argv) { if (!cmdline::hlfhelinalgTileSizes.empty()) hlfhelinalgTileSizes.emplace(cmdline::hlfhelinalgTileSizes); - llvm::Optional jitKeySetCache; + llvm::Optional jitKeySetCache; if (!cmdline::jitKeySetCachePath.empty()) { - jitKeySetCache = mlir::zamalang::KeySetCache(cmdline::jitKeySetCachePath); + jitKeySetCache = mlir::concretelang::KeySetCache(cmdline::jitKeySetCachePath); } // In case of compilation to library, the real output is the library. @@ -397,7 +397,7 @@ mlir::LogicalResult compilerMain(int argc, char **argv) { std::unique_ptr output = mlir::openOutputFile(outputPath, &errorMessage); - using Library = mlir::zamalang::CompilerEngine::Library; + using Library = mlir::concretelang::CompilerEngine::Library; auto outputLib = std::make_shared(cmdline::output); if (!output) { diff --git a/compiler/test_python.py b/compiler/test_python.py index 021357216..7ad642c5f 100755 --- a/compiler/test_python.py +++ b/compiler/test_python.py @@ -1,5 +1,5 @@ -import zamalang -import zamalang.dialects.hlfhe as hlfhe +import concretelang +import concretelang.dialects.hlfhe as hlfhe import mlir.dialects.builtin as builtin import mlir.dialects.std as std from mlir.ir import * @@ -7,8 +7,8 @@ from mlir.ir import * def main(): with Context() as ctx, Location.unknown(): - # register zamalang's dialects - zamalang.register_dialects(ctx) + # register concretelang's dialects + concretelang.register_dialects(ctx) module = Module.create() eint6 = hlfhe.EncryptedIntegerType.get(ctx, 6) @@ -26,11 +26,11 @@ def main(): return %1: !HLFHE.eint<2> }""" ## Working when HFLFHE and MLIR aren't linked - zamalang.compiler.round_trip("module{}") - zamalang.compiler.round_trip(str(module)) + concretelang.compiler.round_trip("module{}") + concretelang.compiler.round_trip(str(module)) ## END OF WORKING ## Doesn't work yet for both modules - engine = zamalang.CompilerEngine() + engine = concretelang.CompilerEngine() engine.compile_fhe(m) # engine.compile_fhe(str(module)) print(engine.run(2)) diff --git a/compiler/tests/CMakeLists.txt b/compiler/tests/CMakeLists.txt index be6027493..32ddb74cd 100644 --- a/compiler/tests/CMakeLists.txt +++ b/compiler/tests/CMakeLists.txt @@ -1,3 +1,3 @@ -if (ZAMALANG_UNIT_TESTS) +if (CONCRETELANG_UNIT_TESTS) add_subdirectory(unittest) endif() diff --git a/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_lookup_table.mlir b/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_lookup_table.mlir index d090bda0e..288120d03 100644 --- a/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_lookup_table.mlir +++ b/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_lookup_table.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --action=dump-midlfhe --passes hlfhe-tensor-ops-to-linalg 2>&1 | FileCheck %s +// RUN: concretecompiler %s --action=dump-midlfhe --passes hlfhe-tensor-ops-to-linalg 2>&1 | FileCheck %s // CHECK: #map = affine_map<(d0, d1, d2) -> (d0, d1, d2)> // CHECK-NEXT: module { diff --git a/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg.mlir b/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg.mlir index 42cc60e6e..99b712933 100644 --- a/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg.mlir +++ b/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --action=dump-midlfhe 2>&1 | FileCheck %s +// RUN: concretecompiler %s --action=dump-midlfhe 2>&1 | FileCheck %s //CHECK-LABEL: #map0 = affine_map<(d0, d1) -> (d0, d1)> //CHECK-NEXT: #map1 = affine_map<(d0, d1) -> (d0, d1, 0)> diff --git a/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg_broadcast.mlir b/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg_broadcast.mlir index 590d52be8..7f52b68f7 100644 --- a/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg_broadcast.mlir +++ b/compiler/tests/Conversion/HLFHELinalgToLinalg/apply_multi_lut_to_linalg_broadcast.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --action=dump-midlfhe 2>&1 | FileCheck %s +// RUN: concretecompiler %s --action=dump-midlfhe 2>&1 | FileCheck %s //CHECK-LABEL: #map0 = affine_map<(d0, d1) -> (d0, d1)> //CHECK-NEXT: #map1 = affine_map<(d0, d1) -> (d1, 0)> diff --git a/compiler/tests/Conversion/HLFHELinalgToLinalg/matmul_eint_int.mlir b/compiler/tests/Conversion/HLFHELinalgToLinalg/matmul_eint_int.mlir index c8bed2cbb..b24c647bd 100644 --- a/compiler/tests/Conversion/HLFHELinalgToLinalg/matmul_eint_int.mlir +++ b/compiler/tests/Conversion/HLFHELinalgToLinalg/matmul_eint_int.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --action=dump-midlfhe --passes hlfhe-tensor-ops-to-linalg 2>&1 | FileCheck %s +// RUN: concretecompiler %s --action=dump-midlfhe --passes hlfhe-tensor-ops-to-linalg 2>&1 | FileCheck %s // CHECK: #map0 = affine_map<(d0, d1, d2) -> (d0, d2)> // CHECK-NEXT: #map1 = affine_map<(d0, d1, d2) -> (d2, d1)> diff --git a/compiler/tests/Conversion/HLFHELinalgToLinalg/neg_eint.mlir b/compiler/tests/Conversion/HLFHELinalgToLinalg/neg_eint.mlir index 58037ebee..aec38462a 100644 --- a/compiler/tests/Conversion/HLFHELinalgToLinalg/neg_eint.mlir +++ b/compiler/tests/Conversion/HLFHELinalgToLinalg/neg_eint.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --action=dump-midlfhe --passes hlfhe-tensor-ops-to-linalg 2>&1 | FileCheck %s +// RUN: concretecompiler %s --action=dump-midlfhe --passes hlfhe-tensor-ops-to-linalg 2>&1 | FileCheck %s // CHECK: #map = affine_map<(d0, d1, d2) -> (d0, d1, d2)> // CHECK-NEXT: module { diff --git a/compiler/tests/Conversion/HLFHELinalgToLinalg/zero.mlir b/compiler/tests/Conversion/HLFHELinalgToLinalg/zero.mlir index 642785d6d..f00f5b25f 100644 --- a/compiler/tests/Conversion/HLFHELinalgToLinalg/zero.mlir +++ b/compiler/tests/Conversion/HLFHELinalgToLinalg/zero.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --action=dump-midlfhe --passes hlfhe-tensor-ops-to-linalg 2>&1 | FileCheck %s +// RUN: concretecompiler %s --action=dump-midlfhe --passes hlfhe-tensor-ops-to-linalg 2>&1 | FileCheck %s // CHECK: func @zero(%arg0: !HLFHE.eint<2>) -> tensor<3x2x!HLFHE.eint<2>> { // CHECK-NEXT: %[[v0:.*]] = tensor.generate { diff --git a/compiler/tests/Conversion/HLFHEToMidLFHE/add_eint.mlir b/compiler/tests/Conversion/HLFHEToMidLFHE/add_eint.mlir index 233f641b8..4da435a3c 100644 --- a/compiler/tests/Conversion/HLFHEToMidLFHE/add_eint.mlir +++ b/compiler/tests/Conversion/HLFHEToMidLFHE/add_eint.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s +// RUN: concretecompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s // CHECK-LABEL: func @add_eint(%arg0: !MidLFHE.glwe<{_,_,_}{7}>, %arg1: !MidLFHE.glwe<{_,_,_}{7}>) -> !MidLFHE.glwe<{_,_,_}{7}> func @add_eint(%arg0: !HLFHE.eint<7>, %arg1: !HLFHE.eint<7>) -> !HLFHE.eint<7> { diff --git a/compiler/tests/Conversion/HLFHEToMidLFHE/add_eint_int.mlir b/compiler/tests/Conversion/HLFHEToMidLFHE/add_eint_int.mlir index 7ec7e8409..3bb974fa8 100644 --- a/compiler/tests/Conversion/HLFHEToMidLFHE/add_eint_int.mlir +++ b/compiler/tests/Conversion/HLFHEToMidLFHE/add_eint_int.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s +// RUN: concretecompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s // CHECK-LABEL: func @add_eint_int(%arg0: !MidLFHE.glwe<{_,_,_}{7}>) -> !MidLFHE.glwe<{_,_,_}{7}> func @add_eint_int(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> { diff --git a/compiler/tests/Conversion/HLFHEToMidLFHE/apply_univariate.mlir b/compiler/tests/Conversion/HLFHEToMidLFHE/apply_univariate.mlir index 1006555f6..4fa98e937 100644 --- a/compiler/tests/Conversion/HLFHEToMidLFHE/apply_univariate.mlir +++ b/compiler/tests/Conversion/HLFHEToMidLFHE/apply_univariate.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s +// RUN: concretecompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s // CHECK-LABEL: func @apply_lookup_table(%arg0: !MidLFHE.glwe<{_,_,_}{2}>, %arg1: tensor<4xi64>) -> !MidLFHE.glwe<{_,_,_}{2}> func @apply_lookup_table(%arg0: !HLFHE.eint<2>, %arg1: tensor<4xi64>) -> !HLFHE.eint<2> { diff --git a/compiler/tests/Conversion/HLFHEToMidLFHE/apply_univariate_cst.mlir b/compiler/tests/Conversion/HLFHEToMidLFHE/apply_univariate_cst.mlir index 236c66b42..7bacf2c53 100644 --- a/compiler/tests/Conversion/HLFHEToMidLFHE/apply_univariate_cst.mlir +++ b/compiler/tests/Conversion/HLFHEToMidLFHE/apply_univariate_cst.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s +// RUN: concretecompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s // CHECK-LABEL: func @apply_lookup_table_cst(%arg0: !MidLFHE.glwe<{_,_,_}{7}>) -> !MidLFHE.glwe<{_,_,_}{7}> func @apply_lookup_table_cst(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> { diff --git a/compiler/tests/Conversion/HLFHEToMidLFHE/linalg_generic.mlir b/compiler/tests/Conversion/HLFHEToMidLFHE/linalg_generic.mlir index 714fc3a52..72ebeecf7 100644 --- a/compiler/tests/Conversion/HLFHEToMidLFHE/linalg_generic.mlir +++ b/compiler/tests/Conversion/HLFHEToMidLFHE/linalg_generic.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s +// RUN: concretecompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s // CHECK: #map0 = affine_map<(d0) -> (d0)> // CHECK-NEXT: #map1 = affine_map<(d0) -> (0)> diff --git a/compiler/tests/Conversion/HLFHEToMidLFHE/mul_eint_int.mlir b/compiler/tests/Conversion/HLFHEToMidLFHE/mul_eint_int.mlir index a8fa5fc59..fb337e685 100644 --- a/compiler/tests/Conversion/HLFHEToMidLFHE/mul_eint_int.mlir +++ b/compiler/tests/Conversion/HLFHEToMidLFHE/mul_eint_int.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s +// RUN: concretecompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s // CHECK-LABEL: func @mul_eint_int(%arg0: !MidLFHE.glwe<{_,_,_}{7}>) -> !MidLFHE.glwe<{_,_,_}{7}> func @mul_eint_int(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> { diff --git a/compiler/tests/Conversion/HLFHEToMidLFHE/neg_eint.mlir b/compiler/tests/Conversion/HLFHEToMidLFHE/neg_eint.mlir index 134d3fd8f..1124ad293 100644 --- a/compiler/tests/Conversion/HLFHEToMidLFHE/neg_eint.mlir +++ b/compiler/tests/Conversion/HLFHEToMidLFHE/neg_eint.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s +// RUN: concretecompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s // CHECK-LABEL: func @neg_eint(%arg0: !MidLFHE.glwe<{_,_,_}{7}>) -> !MidLFHE.glwe<{_,_,_}{7}> func @neg_eint(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> { diff --git a/compiler/tests/Conversion/HLFHEToMidLFHE/sub_int_eint.mlir b/compiler/tests/Conversion/HLFHEToMidLFHE/sub_int_eint.mlir index 2fdacfdc6..e1ded8af4 100644 --- a/compiler/tests/Conversion/HLFHEToMidLFHE/sub_int_eint.mlir +++ b/compiler/tests/Conversion/HLFHEToMidLFHE/sub_int_eint.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s +// RUN: concretecompiler %s --passes hlfhe-to-midlfhe --action=dump-midlfhe 2>&1| FileCheck %s // CHECK-LABEL: func @sub_int_eint(%arg0: !MidLFHE.glwe<{_,_,_}{7}>) -> !MidLFHE.glwe<{_,_,_}{7}> func @sub_int_eint(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> { diff --git a/compiler/tests/Conversion/LowLFHEToConcreteCAPI/bootstrap.mlir b/compiler/tests/Conversion/LowLFHEToConcreteCAPI/bootstrap.mlir index 32f40a155..144ecce08 100644 --- a/compiler/tests/Conversion/LowLFHEToConcreteCAPI/bootstrap.mlir +++ b/compiler/tests/Conversion/LowLFHEToConcreteCAPI/bootstrap.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes lowlfhe-to-concrete-c-api --action=dump-std %s 2>&1| FileCheck %s +// RUN: concretecompiler --passes lowlfhe-to-concrete-c-api --action=dump-std %s 2>&1| FileCheck %s // CHECK-LABEL: module // CHECK: func private @keyswitch_lwe_u64(index, !LowLFHE.lwe_key_switch_key, !LowLFHE.lwe_ciphertext<_,_>, !LowLFHE.lwe_ciphertext<_,_>) diff --git a/compiler/tests/Conversion/LowLFHEToConcreteCAPI/glwe_from_table.mlir b/compiler/tests/Conversion/LowLFHEToConcreteCAPI/glwe_from_table.mlir index d5473a5cf..72f638114 100644 --- a/compiler/tests/Conversion/LowLFHEToConcreteCAPI/glwe_from_table.mlir +++ b/compiler/tests/Conversion/LowLFHEToConcreteCAPI/glwe_from_table.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes lowlfhe-to-concrete-c-api --action=dump-std %s 2>&1| FileCheck %s +// RUN: concretecompiler --passes lowlfhe-to-concrete-c-api --action=dump-std %s 2>&1| FileCheck %s // CHECK-LABEL: module // CHECK: func private @runtime_foreign_plaintext_list_u64(index, tensor<16xi64>, i64, i32) -> !LowLFHE.foreign_plaintext_list diff --git a/compiler/tests/Conversion/LowLFHEToConcreteCAPI/keyswitch_lwe.mlir b/compiler/tests/Conversion/LowLFHEToConcreteCAPI/keyswitch_lwe.mlir index f692ea546..0d4e4f333 100644 --- a/compiler/tests/Conversion/LowLFHEToConcreteCAPI/keyswitch_lwe.mlir +++ b/compiler/tests/Conversion/LowLFHEToConcreteCAPI/keyswitch_lwe.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes lowlfhe-to-concrete-c-api --action=dump-std %s 2>&1| FileCheck %s +// RUN: concretecompiler --passes lowlfhe-to-concrete-c-api --action=dump-std %s 2>&1| FileCheck %s // CHECK-LABEL: module // CHECK: func private @keyswitch_lwe_u64(index, !LowLFHE.lwe_key_switch_key, !LowLFHE.lwe_ciphertext<_,_>, !LowLFHE.lwe_ciphertext<_,_>) diff --git a/compiler/tests/Conversion/LowLFHEUnparametrize/func.mlir b/compiler/tests/Conversion/LowLFHEUnparametrize/func.mlir index 8374ce81e..7158beaad 100644 --- a/compiler/tests/Conversion/LowLFHEUnparametrize/func.mlir +++ b/compiler/tests/Conversion/LowLFHEUnparametrize/func.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes lowlfhe-unparametrize --action=dump-llvm-dialect %s 2>&1| FileCheck %s +// RUN: concretecompiler --passes lowlfhe-unparametrize --action=dump-llvm-dialect %s 2>&1| FileCheck %s // CHECK-LABEL: func @main(%arg0: !LowLFHE.lwe_ciphertext<_,_>) -> !LowLFHE.lwe_ciphertext<_,_> func @main(%arg0: !LowLFHE.lwe_ciphertext<1024,4>) -> !LowLFHE.lwe_ciphertext<1024,4> { diff --git a/compiler/tests/Conversion/LowLFHEUnparametrize/unrealized_conversion_cast.mlir b/compiler/tests/Conversion/LowLFHEUnparametrize/unrealized_conversion_cast.mlir index f44a8404f..5c2813985 100644 --- a/compiler/tests/Conversion/LowLFHEUnparametrize/unrealized_conversion_cast.mlir +++ b/compiler/tests/Conversion/LowLFHEUnparametrize/unrealized_conversion_cast.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes lowlfhe-unparametrize --action=dump-llvm-dialect %s 2>&1| FileCheck %s +// RUN: concretecompiler --passes lowlfhe-unparametrize --action=dump-llvm-dialect %s 2>&1| FileCheck %s // CHECK-LABEL: func @main(%arg0: !LowLFHE.lwe_ciphertext<_,_>) -> !LowLFHE.lwe_ciphertext<_,_> func @main(%arg0: !LowLFHE.lwe_ciphertext<1024,4>) -> !LowLFHE.lwe_ciphertext<_,_> { diff --git a/compiler/tests/Conversion/MidLFHEToLowLFHE/add_glwe.mlir b/compiler/tests/Conversion/MidLFHEToLowLFHE/add_glwe.mlir index e70ce888e..8192199ee 100644 --- a/compiler/tests/Conversion/MidLFHEToLowLFHE/add_glwe.mlir +++ b/compiler/tests/Conversion/MidLFHEToLowLFHE/add_glwe.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s +// RUN: concretecompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s // CHECK-LABEL: func @add_glwe(%arg0: !LowLFHE.lwe_ciphertext<2048,7>, %arg1: !LowLFHE.lwe_ciphertext<2048,7>) -> !LowLFHE.lwe_ciphertext<2048,7> func @add_glwe(%arg0: !MidLFHE.glwe<{2048,1,64}{7}>, %arg1: !MidLFHE.glwe<{2048,1,64}{7}>) -> !MidLFHE.glwe<{2048,1,64}{7}> { diff --git a/compiler/tests/Conversion/MidLFHEToLowLFHE/add_glwe_int.mlir b/compiler/tests/Conversion/MidLFHEToLowLFHE/add_glwe_int.mlir index e7a554bd2..7ab9e554a 100644 --- a/compiler/tests/Conversion/MidLFHEToLowLFHE/add_glwe_int.mlir +++ b/compiler/tests/Conversion/MidLFHEToLowLFHE/add_glwe_int.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s +// RUN: concretecompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s // CHECK-LABEL: func @add_glwe_const_int(%arg0: !LowLFHE.lwe_ciphertext<1024,7>) -> !LowLFHE.lwe_ciphertext<1024,7> func @add_glwe_const_int(%arg0: !MidLFHE.glwe<{1024,1,64}{7}>) -> !MidLFHE.glwe<{1024,1,64}{7}> { diff --git a/compiler/tests/Conversion/MidLFHEToLowLFHE/apply_lookup_table.mlir b/compiler/tests/Conversion/MidLFHEToLowLFHE/apply_lookup_table.mlir index f933434f8..6e91e8b8e 100644 --- a/compiler/tests/Conversion/MidLFHEToLowLFHE/apply_lookup_table.mlir +++ b/compiler/tests/Conversion/MidLFHEToLowLFHE/apply_lookup_table.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s +// RUN: concretecompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s // CHECK-LABEL: func @apply_lookup_table(%arg0: !LowLFHE.lwe_ciphertext<1024,4>, %arg1: tensor<16xi64>) -> !LowLFHE.lwe_ciphertext<1024,4> func @apply_lookup_table(%arg0: !MidLFHE.glwe<{1024,1,64}{4}>, %arg1: tensor<16xi64>) -> !MidLFHE.glwe<{1024,1,64}{4}> { diff --git a/compiler/tests/Conversion/MidLFHEToLowLFHE/apply_lookup_table_cst.mlir b/compiler/tests/Conversion/MidLFHEToLowLFHE/apply_lookup_table_cst.mlir index 25b785ac7..ecde7dcc3 100644 --- a/compiler/tests/Conversion/MidLFHEToLowLFHE/apply_lookup_table_cst.mlir +++ b/compiler/tests/Conversion/MidLFHEToLowLFHE/apply_lookup_table_cst.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s +// RUN: concretecompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s // CHECK-LABEL: func @apply_lookup_table_cst(%arg0: !LowLFHE.lwe_ciphertext<2048,4>) -> !LowLFHE.lwe_ciphertext<2048,4> func @apply_lookup_table_cst(%arg0: !MidLFHE.glwe<{2048,1,64}{4}>) -> !MidLFHE.glwe<{2048,1,64}{4}> { diff --git a/compiler/tests/Conversion/MidLFHEToLowLFHE/mul_glwe_int.mlir b/compiler/tests/Conversion/MidLFHEToLowLFHE/mul_glwe_int.mlir index e7c5f9155..9f90590fd 100644 --- a/compiler/tests/Conversion/MidLFHEToLowLFHE/mul_glwe_int.mlir +++ b/compiler/tests/Conversion/MidLFHEToLowLFHE/mul_glwe_int.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s +// RUN: concretecompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s // CHECK-LABEL: func @mul_glwe_const_int(%arg0: !LowLFHE.lwe_ciphertext<1024,7>) -> !LowLFHE.lwe_ciphertext<1024,7> func @mul_glwe_const_int(%arg0: !MidLFHE.glwe<{1024,1,64}{7}>) -> !MidLFHE.glwe<{1024,1,64}{7}> { diff --git a/compiler/tests/Conversion/MidLFHEToLowLFHE/neg_glwe.mlir b/compiler/tests/Conversion/MidLFHEToLowLFHE/neg_glwe.mlir index 76e3dfb3b..e0bffe3a4 100644 --- a/compiler/tests/Conversion/MidLFHEToLowLFHE/neg_glwe.mlir +++ b/compiler/tests/Conversion/MidLFHEToLowLFHE/neg_glwe.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s +// RUN: concretecompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s // CHECK-LABEL: func @neg_glwe(%arg0: !LowLFHE.lwe_ciphertext<1024,4>) -> !LowLFHE.lwe_ciphertext<1024,4> func @neg_glwe(%arg0: !MidLFHE.glwe<{1024,1,64}{4}>) -> !MidLFHE.glwe<{1024,1,64}{4}> { diff --git a/compiler/tests/Conversion/MidLFHEToLowLFHE/sub_int_glwe.mlir b/compiler/tests/Conversion/MidLFHEToLowLFHE/sub_int_glwe.mlir index 51b755acf..1f638da33 100644 --- a/compiler/tests/Conversion/MidLFHEToLowLFHE/sub_int_glwe.mlir +++ b/compiler/tests/Conversion/MidLFHEToLowLFHE/sub_int_glwe.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s +// RUN: concretecompiler --passes midlfhe-to-lowlfhe --action=dump-lowlfhe %s 2>&1| FileCheck %s // CHECK-LABEL: func @sub_const_int_glwe(%arg0: !LowLFHE.lwe_ciphertext<1024,7>) -> !LowLFHE.lwe_ciphertext<1024,7> func @sub_const_int_glwe(%arg0: !MidLFHE.glwe<{1024,1,64}{7}>) -> !MidLFHE.glwe<{1024,1,64}{7}> { diff --git a/compiler/tests/Dialect/HLFHE/Analysis/MANP.mlir b/compiler/tests/Dialect/HLFHE/Analysis/MANP.mlir index 75a1bebf8..d7d1ad050 100644 --- a/compiler/tests/Dialect/HLFHE/Analysis/MANP.mlir +++ b/compiler/tests/Dialect/HLFHE/Analysis/MANP.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes MANP --action=dump-hlfhe --split-input-file %s 2>&1 | FileCheck %s +// RUN: concretecompiler --passes MANP --action=dump-hlfhe --split-input-file %s 2>&1 | FileCheck %s func @single_zero() -> !HLFHE.eint<2> { diff --git a/compiler/tests/Dialect/HLFHE/Analysis/MANP_linalg.mlir b/compiler/tests/Dialect/HLFHE/Analysis/MANP_linalg.mlir index 27ac6801f..6cd6ab428 100644 --- a/compiler/tests/Dialect/HLFHE/Analysis/MANP_linalg.mlir +++ b/compiler/tests/Dialect/HLFHE/Analysis/MANP_linalg.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes MANP --action=dump-hlfhe --split-input-file %s 2>&1 | FileCheck %s +// RUN: concretecompiler --passes MANP --action=dump-hlfhe --split-input-file %s 2>&1 | FileCheck %s func @single_cst_add_eint_int(%t: tensor<8x!HLFHE.eint<2>>) -> tensor<8x!HLFHE.eint<2>> { diff --git a/compiler/tests/Dialect/HLFHE/Analysis/MANP_tensor.mlir b/compiler/tests/Dialect/HLFHE/Analysis/MANP_tensor.mlir index fdcb6bc87..98d51daba 100644 --- a/compiler/tests/Dialect/HLFHE/Analysis/MANP_tensor.mlir +++ b/compiler/tests/Dialect/HLFHE/Analysis/MANP_tensor.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --passes MANP --action=dump-hlfhe --split-input-file %s 2>&1 | FileCheck %s +// RUN: concretecompiler --passes MANP --action=dump-hlfhe --split-input-file %s 2>&1 | FileCheck %s func @tensor_from_elements_1(%a: !HLFHE.eint<2>, %b: !HLFHE.eint<2>, %c: !HLFHE.eint<2>, %d: !HLFHE.eint<2>) -> tensor<4x!HLFHE.eint<2>> { diff --git a/compiler/tests/Dialect/HLFHE/eint_error_p_too_big.mlir b/compiler/tests/Dialect/HLFHE/eint_error_p_too_big.mlir index 800e8df69..16a2ff815 100644 --- a/compiler/tests/Dialect/HLFHE/eint_error_p_too_big.mlir +++ b/compiler/tests/Dialect/HLFHE/eint_error_p_too_big.mlir @@ -1,4 +1,4 @@ -// RUN: not zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: eint support only precision in ]0;7] func @test(%arg0: !HLFHE.eint<8>) { diff --git a/compiler/tests/Dialect/HLFHE/eint_error_p_too_small.mlir b/compiler/tests/Dialect/HLFHE/eint_error_p_too_small.mlir index 7e543efaa..08dca3235 100644 --- a/compiler/tests/Dialect/HLFHE/eint_error_p_too_small.mlir +++ b/compiler/tests/Dialect/HLFHE/eint_error_p_too_small.mlir @@ -1,4 +1,4 @@ -// RUN: not zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: eint support only precision in ]0;7] func @test(%arg0: !HLFHE.eint<0>) { diff --git a/compiler/tests/Dialect/HLFHE/op_add_eint_err_inputs.mlir b/compiler/tests/Dialect/HLFHE/op_add_eint_err_inputs.mlir index 39b97ed31..3cf0a89f0 100644 --- a/compiler/tests/Dialect/HLFHE/op_add_eint_err_inputs.mlir +++ b/compiler/tests/Dialect/HLFHE/op_add_eint_err_inputs.mlir @@ -1,4 +1,4 @@ -// RUN: not zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: error: 'HLFHE.add_eint' op should have the width of encrypted inputs equals func @add_eint(%arg0: !HLFHE.eint<2>, %arg1: !HLFHE.eint<3>) -> !HLFHE.eint<2> { diff --git a/compiler/tests/Dialect/HLFHE/op_add_eint_err_result.mlir b/compiler/tests/Dialect/HLFHE/op_add_eint_err_result.mlir index 5608ffdd0..fb7f6bc6e 100644 --- a/compiler/tests/Dialect/HLFHE/op_add_eint_err_result.mlir +++ b/compiler/tests/Dialect/HLFHE/op_add_eint_err_result.mlir @@ -1,4 +1,4 @@ -// RUN: not zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: error: 'HLFHE.add_eint' op should have the width of encrypted inputs and result equals func @add_eint(%arg0: !HLFHE.eint<2>, %arg1: !HLFHE.eint<2>) -> !HLFHE.eint<3> { diff --git a/compiler/tests/Dialect/HLFHE/op_add_eint_int_err_inputs.mlir b/compiler/tests/Dialect/HLFHE/op_add_eint_int_err_inputs.mlir index 2e7fec8d1..989730cde 100644 --- a/compiler/tests/Dialect/HLFHE/op_add_eint_int_err_inputs.mlir +++ b/compiler/tests/Dialect/HLFHE/op_add_eint_int_err_inputs.mlir @@ -1,4 +1,4 @@ -// RUN: not zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: error: 'HLFHE.add_eint_int' op should have the width of plain input equals to width of encrypted input + 1 func @add_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2> { diff --git a/compiler/tests/Dialect/HLFHE/op_add_eint_int_err_result.mlir b/compiler/tests/Dialect/HLFHE/op_add_eint_int_err_result.mlir index ba82ab61a..720b81fdd 100644 --- a/compiler/tests/Dialect/HLFHE/op_add_eint_int_err_result.mlir +++ b/compiler/tests/Dialect/HLFHE/op_add_eint_int_err_result.mlir @@ -1,4 +1,4 @@ -// RUN: not zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: error: 'HLFHE.add_eint_int' op should have the width of encrypted inputs and result equals func @add_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<3> { diff --git a/compiler/tests/Dialect/HLFHE/op_apply_lookup_table_bad_dimension.mlir b/compiler/tests/Dialect/HLFHE/op_apply_lookup_table_bad_dimension.mlir index caf8806ff..c7699de08 100644 --- a/compiler/tests/Dialect/HLFHE/op_apply_lookup_table_bad_dimension.mlir +++ b/compiler/tests/Dialect/HLFHE/op_apply_lookup_table_bad_dimension.mlir @@ -1,4 +1,4 @@ -// RUN: not zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: error: 'HLFHE.apply_lookup_table' op : `l_cst` (operand #2) inner dimension should have size 4(=2^2) to match `ct` (operand #1) elements bitwidth (2) func @apply_lookup_table(%arg0: !HLFHE.eint<2>, %arg1: tensor<8xi3>) -> !HLFHE.eint<2> { diff --git a/compiler/tests/Dialect/HLFHE/op_mul_eint_int_err_inputs.mlir b/compiler/tests/Dialect/HLFHE/op_mul_eint_int_err_inputs.mlir index b18b2cb31..24cd43707 100644 --- a/compiler/tests/Dialect/HLFHE/op_mul_eint_int_err_inputs.mlir +++ b/compiler/tests/Dialect/HLFHE/op_mul_eint_int_err_inputs.mlir @@ -1,4 +1,4 @@ -// RUN: not zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: error: 'HLFHE.mul_eint_int' op should have the width of plain input equals to width of encrypted input + 1 func @mul_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2> { diff --git a/compiler/tests/Dialect/HLFHE/op_mul_eint_int_err_result.mlir b/compiler/tests/Dialect/HLFHE/op_mul_eint_int_err_result.mlir index 647bfb9b4..6da320f91 100644 --- a/compiler/tests/Dialect/HLFHE/op_mul_eint_int_err_result.mlir +++ b/compiler/tests/Dialect/HLFHE/op_mul_eint_int_err_result.mlir @@ -1,4 +1,4 @@ -// RUN: not zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: error: 'HLFHE.mul_eint_int' op should have the width of encrypted inputs and result equals func @mul_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<3> { diff --git a/compiler/tests/Dialect/HLFHE/op_neg_eint_err_result.mlir b/compiler/tests/Dialect/HLFHE/op_neg_eint_err_result.mlir index 84af2b155..06fab3d11 100644 --- a/compiler/tests/Dialect/HLFHE/op_neg_eint_err_result.mlir +++ b/compiler/tests/Dialect/HLFHE/op_neg_eint_err_result.mlir @@ -1,4 +1,4 @@ -// RUN: not zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: error: 'HLFHE.neg_eint' op should have the width of encrypted inputs and result equals func @sub_int_eint(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<3> { diff --git a/compiler/tests/Dialect/HLFHE/op_sub_int_eint_err_inputs.mlir b/compiler/tests/Dialect/HLFHE/op_sub_int_eint_err_inputs.mlir index a66569ce5..e59caa810 100644 --- a/compiler/tests/Dialect/HLFHE/op_sub_int_eint_err_inputs.mlir +++ b/compiler/tests/Dialect/HLFHE/op_sub_int_eint_err_inputs.mlir @@ -1,4 +1,4 @@ -// RUN: not zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: error: 'HLFHE.sub_int_eint' op should have the width of plain input equals to width of encrypted input + 1 func @sub_int_eint(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2> { diff --git a/compiler/tests/Dialect/HLFHE/op_sub_int_eint_err_result.mlir b/compiler/tests/Dialect/HLFHE/op_sub_int_eint_err_result.mlir index df74e684d..db82ee008 100644 --- a/compiler/tests/Dialect/HLFHE/op_sub_int_eint_err_result.mlir +++ b/compiler/tests/Dialect/HLFHE/op_sub_int_eint_err_result.mlir @@ -1,4 +1,4 @@ -// RUN: not zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: not concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: error: 'HLFHE.sub_int_eint' op should have the width of encrypted inputs and result equals func @sub_int_eint(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<3> { diff --git a/compiler/tests/Dialect/HLFHE/ops.mlir b/compiler/tests/Dialect/HLFHE/ops.mlir index a8c45b600..a960d87ac 100644 --- a/compiler/tests/Dialect/HLFHE/ops.mlir +++ b/compiler/tests/Dialect/HLFHE/ops.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: func @zero() -> !HLFHE.eint<2> func @zero() -> !HLFHE.eint<2> { diff --git a/compiler/tests/Dialect/HLFHE/types.mlir b/compiler/tests/Dialect/HLFHE/types.mlir index 2a9ad463c..3a992013e 100644 --- a/compiler/tests/Dialect/HLFHE/types.mlir +++ b/compiler/tests/Dialect/HLFHE/types.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: func @memref_arg(%arg0: memref<2x!HLFHE.eint<7>> func @memref_arg(%arg0: memref<2x!HLFHE.eint<7>>) { diff --git a/compiler/tests/Dialect/HLFHELinalg/apply_mapped_lut_to_linalg.mlir b/compiler/tests/Dialect/HLFHELinalg/apply_mapped_lut_to_linalg.mlir index e1593b37d..dfc3a4912 100644 --- a/compiler/tests/Dialect/HLFHELinalg/apply_mapped_lut_to_linalg.mlir +++ b/compiler/tests/Dialect/HLFHELinalg/apply_mapped_lut_to_linalg.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --action=dump-midlfhe 2>&1 | FileCheck %s +// RUN: concretecompiler %s --action=dump-midlfhe 2>&1 | FileCheck %s //CHECK-LABEL: #map = affine_map<(d0, d1) -> (d0, d1)> diff --git a/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg.mlir b/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg.mlir index 42cc60e6e..99b712933 100644 --- a/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg.mlir +++ b/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --action=dump-midlfhe 2>&1 | FileCheck %s +// RUN: concretecompiler %s --action=dump-midlfhe 2>&1 | FileCheck %s //CHECK-LABEL: #map0 = affine_map<(d0, d1) -> (d0, d1)> //CHECK-NEXT: #map1 = affine_map<(d0, d1) -> (d0, d1, 0)> diff --git a/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg_broadcast.mlir b/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg_broadcast.mlir index 590d52be8..7f52b68f7 100644 --- a/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg_broadcast.mlir +++ b/compiler/tests/Dialect/HLFHELinalg/apply_multi_lut_to_linalg_broadcast.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --action=dump-midlfhe 2>&1 | FileCheck %s +// RUN: concretecompiler %s --action=dump-midlfhe 2>&1 | FileCheck %s //CHECK-LABEL: #map0 = affine_map<(d0, d1) -> (d0, d1)> //CHECK-NEXT: #map1 = affine_map<(d0, d1) -> (d1, 0)> diff --git a/compiler/tests/Dialect/HLFHELinalg/dot.invalid.mlir b/compiler/tests/Dialect/HLFHELinalg/dot.invalid.mlir index 98a06857d..083cff379 100644 --- a/compiler/tests/Dialect/HLFHELinalg/dot.invalid.mlir +++ b/compiler/tests/Dialect/HLFHELinalg/dot.invalid.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --split-input-file --verify-diagnostics --action=roundtrip %s +// RUN: concretecompiler --split-input-file --verify-diagnostics --action=roundtrip %s // Incompatible shapes func @dot_incompatible_shapes( diff --git a/compiler/tests/Dialect/HLFHELinalg/ops.invalid.mlir b/compiler/tests/Dialect/HLFHELinalg/ops.invalid.mlir index fb34a92b9..ab31ec55b 100644 --- a/compiler/tests/Dialect/HLFHELinalg/ops.invalid.mlir +++ b/compiler/tests/Dialect/HLFHELinalg/ops.invalid.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --split-input-file --verify-diagnostics --action=roundtrip %s +// RUN: concretecompiler --split-input-file --verify-diagnostics --action=roundtrip %s ///////////////////////////////////////////////// // HLFHELinalg.add_eint_int diff --git a/compiler/tests/Dialect/HLFHELinalg/ops.mlir b/compiler/tests/Dialect/HLFHELinalg/ops.mlir index 8a3883118..aa199fd61 100644 --- a/compiler/tests/Dialect/HLFHELinalg/ops.mlir +++ b/compiler/tests/Dialect/HLFHELinalg/ops.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s ///////////////////////////////////////////////// // HLFHELinalg.add_eint_int diff --git a/compiler/tests/Dialect/HLFHELinalg/tensor-ops-to-linalg.mlir b/compiler/tests/Dialect/HLFHELinalg/tensor-ops-to-linalg.mlir index ce5902599..cea2ee9b5 100644 --- a/compiler/tests/Dialect/HLFHELinalg/tensor-ops-to-linalg.mlir +++ b/compiler/tests/Dialect/HLFHELinalg/tensor-ops-to-linalg.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --action=dump-midlfhe 2>&1 | FileCheck %s +// RUN: concretecompiler %s --action=dump-midlfhe 2>&1 | FileCheck %s //CHECK: #map0 = affine_map<(d0) -> (d0)> //CHECK-NEXT: #map1 = affine_map<(d0) -> (0)> diff --git a/compiler/tests/Dialect/HLFHELinalg/tiling.mlir b/compiler/tests/Dialect/HLFHELinalg/tiling.mlir index 61affb0b0..2e6a4347a 100644 --- a/compiler/tests/Dialect/HLFHELinalg/tiling.mlir +++ b/compiler/tests/Dialect/HLFHELinalg/tiling.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --action=dump-hlfhe %s 2>&1 --split-input-file | FileCheck %s +// RUN: concretecompiler --action=dump-hlfhe %s 2>&1 --split-input-file | FileCheck %s // CHECK: func @tiled_2x2(%[[Varg0:.*]]: tensor<8x4x!HLFHE.eint<6>>, %[[Varg1:.*]]: tensor<4x2xi7>) -> tensor<8x2x!HLFHE.eint<6>> { // CHECK-NEXT: %[[Vc2:.*]] = arith.constant 2 : index diff --git a/compiler/tests/Dialect/LowLFHE/ops.mlir b/compiler/tests/Dialect/LowLFHE/ops.mlir index fede02a86..647a4648b 100644 --- a/compiler/tests/Dialect/LowLFHE/ops.mlir +++ b/compiler/tests/Dialect/LowLFHE/ops.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: func @add_lwe_ciphertexts(%arg0: !LowLFHE.lwe_ciphertext<2048,7>, %arg1: !LowLFHE.lwe_ciphertext<2048,7>) -> !LowLFHE.lwe_ciphertext<2048,7> func @add_lwe_ciphertexts(%arg0: !LowLFHE.lwe_ciphertext<2048,7>, %arg1: !LowLFHE.lwe_ciphertext<2048,7>) -> !LowLFHE.lwe_ciphertext<2048,7> { diff --git a/compiler/tests/Dialect/LowLFHE/types.mlir b/compiler/tests/Dialect/LowLFHE/types.mlir index 088e0ac15..6fbd07320 100644 --- a/compiler/tests/Dialect/LowLFHE/types.mlir +++ b/compiler/tests/Dialect/LowLFHE/types.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: func @type_plaintext(%arg0: !LowLFHE.plaintext<7>) -> !LowLFHE.plaintext<7> diff --git a/compiler/tests/Dialect/MidLFHE/op_add_glwe.invalid.mlir b/compiler/tests/Dialect/MidLFHE/op_add_glwe.invalid.mlir index 46318b97a..8fcf6c926 100644 --- a/compiler/tests/Dialect/MidLFHE/op_add_glwe.invalid.mlir +++ b/compiler/tests/Dialect/MidLFHE/op_add_glwe.invalid.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --split-input-file --verify-diagnostics --action=roundtrip %s +// RUN: concretecompiler --split-input-file --verify-diagnostics --action=roundtrip %s // GLWE p parameter result func @add_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>, %arg1: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{6}> { diff --git a/compiler/tests/Dialect/MidLFHE/op_add_glwe.mlir b/compiler/tests/Dialect/MidLFHE/op_add_glwe.mlir index 970c22942..5613adeb7 100644 --- a/compiler/tests/Dialect/MidLFHE/op_add_glwe.mlir +++ b/compiler/tests/Dialect/MidLFHE/op_add_glwe.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: func @add_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>, %arg1: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> func @add_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>, %arg1: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> { diff --git a/compiler/tests/Dialect/MidLFHE/op_add_glwe_int.invalid.mlir b/compiler/tests/Dialect/MidLFHE/op_add_glwe_int.invalid.mlir index c74f98364..9af0e7d4c 100644 --- a/compiler/tests/Dialect/MidLFHE/op_add_glwe_int.invalid.mlir +++ b/compiler/tests/Dialect/MidLFHE/op_add_glwe_int.invalid.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --split-input-file --verify-diagnostics --action=roundtrip %s +// RUN: concretecompiler --split-input-file --verify-diagnostics --action=roundtrip %s // GLWE p parameter func @add_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{6}> { diff --git a/compiler/tests/Dialect/MidLFHE/op_add_glwe_int.mlir b/compiler/tests/Dialect/MidLFHE/op_add_glwe_int.mlir index dc2f9be2b..a94087b16 100644 --- a/compiler/tests/Dialect/MidLFHE/op_add_glwe_int.mlir +++ b/compiler/tests/Dialect/MidLFHE/op_add_glwe_int.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: func @add_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> func @add_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> { diff --git a/compiler/tests/Dialect/MidLFHE/op_apply_lookup_table.invalid.mlir b/compiler/tests/Dialect/MidLFHE/op_apply_lookup_table.invalid.mlir index 56f5a0d34..cccfaa849 100644 --- a/compiler/tests/Dialect/MidLFHE/op_apply_lookup_table.invalid.mlir +++ b/compiler/tests/Dialect/MidLFHE/op_apply_lookup_table.invalid.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --split-input-file --verify-diagnostics --action=roundtrip %s +// RUN: concretecompiler --split-input-file --verify-diagnostics --action=roundtrip %s // Bad dimension of the lookup table func @apply_lookup_table(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>, %arg1: tensor<4xi2>) -> !MidLFHE.glwe<{512,10,64}{2}> { diff --git a/compiler/tests/Dialect/MidLFHE/op_apply_lookup_table.mlir b/compiler/tests/Dialect/MidLFHE/op_apply_lookup_table.mlir index 26ea8e04a..5fb888a52 100644 --- a/compiler/tests/Dialect/MidLFHE/op_apply_lookup_table.mlir +++ b/compiler/tests/Dialect/MidLFHE/op_apply_lookup_table.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: func @apply_lookup_table(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>, %arg1: tensor<128xi64>) -> !MidLFHE.glwe<{512,10,64}{2}> func @apply_lookup_table(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>, %arg1: tensor<128xi64>) -> !MidLFHE.glwe<{512,10,64}{2}> { diff --git a/compiler/tests/Dialect/MidLFHE/op_mul_glwe_int.invalid.mlir b/compiler/tests/Dialect/MidLFHE/op_mul_glwe_int.invalid.mlir index a258c6ba2..aacf4e35e 100644 --- a/compiler/tests/Dialect/MidLFHE/op_mul_glwe_int.invalid.mlir +++ b/compiler/tests/Dialect/MidLFHE/op_mul_glwe_int.invalid.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --split-input-file --verify-diagnostics --action=roundtrip %s +// RUN: concretecompiler --split-input-file --verify-diagnostics --action=roundtrip %s // GLWE p parameter func @mul_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{6}> { diff --git a/compiler/tests/Dialect/MidLFHE/op_mul_glwe_int.mlir b/compiler/tests/Dialect/MidLFHE/op_mul_glwe_int.mlir index 727877cd0..78b7494e1 100644 --- a/compiler/tests/Dialect/MidLFHE/op_mul_glwe_int.mlir +++ b/compiler/tests/Dialect/MidLFHE/op_mul_glwe_int.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: func @mul_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> func @mul_glwe_int(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> { diff --git a/compiler/tests/Dialect/MidLFHE/op_neg_glwe.invalid.mlir b/compiler/tests/Dialect/MidLFHE/op_neg_glwe.invalid.mlir index 00fd720c4..e9339ada2 100644 --- a/compiler/tests/Dialect/MidLFHE/op_neg_glwe.invalid.mlir +++ b/compiler/tests/Dialect/MidLFHE/op_neg_glwe.invalid.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --split-input-file --verify-diagnostics --action=roundtrip %s +// RUN: concretecompiler --split-input-file --verify-diagnostics --action=roundtrip %s // GLWE p parameter func @neg_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{6}> { diff --git a/compiler/tests/Dialect/MidLFHE/op_neg_glwe.mlir b/compiler/tests/Dialect/MidLFHE/op_neg_glwe.mlir index a47313c62..f8b5c0f86 100644 --- a/compiler/tests/Dialect/MidLFHE/op_neg_glwe.mlir +++ b/compiler/tests/Dialect/MidLFHE/op_neg_glwe.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: func @neg_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> func @neg_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> { diff --git a/compiler/tests/Dialect/MidLFHE/op_sub_int_glwe.invalid.mlir b/compiler/tests/Dialect/MidLFHE/op_sub_int_glwe.invalid.mlir index 37f05e4d6..003f3dfcd 100644 --- a/compiler/tests/Dialect/MidLFHE/op_sub_int_glwe.invalid.mlir +++ b/compiler/tests/Dialect/MidLFHE/op_sub_int_glwe.invalid.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --split-input-file --verify-diagnostics --action=roundtrip %s +// RUN: concretecompiler --split-input-file --verify-diagnostics --action=roundtrip %s // GLWE p parameter func @sub_int_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{6}> { diff --git a/compiler/tests/Dialect/MidLFHE/op_sub_int_glwe.mlir b/compiler/tests/Dialect/MidLFHE/op_sub_int_glwe.mlir index 3d7e2d070..068da9c23 100644 --- a/compiler/tests/Dialect/MidLFHE/op_sub_int_glwe.mlir +++ b/compiler/tests/Dialect/MidLFHE/op_sub_int_glwe.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler --action=roundtrip %s 2>&1| FileCheck %s +// RUN: concretecompiler --action=roundtrip %s 2>&1| FileCheck %s // CHECK-LABEL: func @sub_int_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> func @sub_int_glwe(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> { diff --git a/compiler/tests/Dialect/MidLFHE/types_glwe.mlir b/compiler/tests/Dialect/MidLFHE/types_glwe.mlir index 974fb3cc6..5d64f23e7 100644 --- a/compiler/tests/Dialect/MidLFHE/types_glwe.mlir +++ b/compiler/tests/Dialect/MidLFHE/types_glwe.mlir @@ -1,4 +1,4 @@ -// RUN: zamacompiler %s --action=roundtrip 2>&1| FileCheck %s +// RUN: concretecompiler %s --action=roundtrip 2>&1| FileCheck %s // CHECK-LABEL: func @glwe_0(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> func @glwe_0(%arg0: !MidLFHE.glwe<{1024,12,64}{7}>) -> !MidLFHE.glwe<{1024,12,64}{7}> { diff --git a/compiler/tests/lit.cfg.py b/compiler/tests/lit.cfg.py index cda6186b0..dab927507 100644 --- a/compiler/tests/lit.cfg.py +++ b/compiler/tests/lit.cfg.py @@ -1,7 +1,7 @@ import lit.formats # Lit configuration -config.name = "zamalang" +config.name = "concretelang" config.test_format = lit.formats.ShTest("0") config.suffixes = {".mlir"} config.target_triple = "" diff --git a/compiler/tests/python/test_compiler_engine.py b/compiler/tests/python/test_compiler_engine.py index b720ca94d..6473f514a 100644 --- a/compiler/tests/python/test_compiler_engine.py +++ b/compiler/tests/python/test_compiler_engine.py @@ -3,7 +3,7 @@ import tempfile import pytest import numpy as np -from zamalang import CompilerEngine, library +from concretelang import CompilerEngine, library KEY_SET_CACHE_PATH = os.path.join(tempfile.gettempdir(), 'KeySetCache') diff --git a/compiler/tests/python/test_compiler_file_output/test_compiler_file_output.py b/compiler/tests/python/test_compiler_file_output/test_compiler_file_output.py index c9b93bff6..c0d55868e 100644 --- a/compiler/tests/python/test_compiler_file_output/test_compiler_file_output.py +++ b/compiler/tests/python/test_compiler_file_output/test_compiler_file_output.py @@ -8,7 +8,7 @@ from test_compiler_file_output.utils import assert_exists, content, remove, run TEST_PATH = os.path.dirname(__file__) CCOMPILER = 'cc' -ZAMACOMPILER = 'zamacompiler' +CONCRETECOMPILER = 'concretecompiler' SOURCE_1 = f'{TEST_PATH}/return_13.ir' SOURCE_2 = f'{TEST_PATH}/return_0.ir' @@ -25,7 +25,7 @@ assert_exists(SOURCE_1, SOURCE_2, SOURCE_C_1, SOURCE_C_2) def test_roundtrip(): remove(OUTPUT) - run(ZAMACOMPILER, SOURCE_1, '--action=roundtrip', '-o', OUTPUT) + run(CONCRETECOMPILER, SOURCE_1, '--action=roundtrip', '-o', OUTPUT) assert_exists(OUTPUT) assert content(SOURCE_1) == content(OUTPUT) @@ -36,7 +36,7 @@ def test_roundtrip(): def test_roundtrip_many(): remove(OUTPUT) - run(ZAMACOMPILER, SOURCE_1, SOURCE_2, '--action=roundtrip', '-o', OUTPUT) + run(CONCRETECOMPILER, SOURCE_1, SOURCE_2, '--action=roundtrip', '-o', OUTPUT) assert_exists(OUTPUT) assert f"{content(SOURCE_1)}{content(SOURCE_2)}" == content(OUTPUT) @@ -47,7 +47,7 @@ def test_roundtrip_many(): def test_compile_library(): remove(LIBS) - run(ZAMACOMPILER, SOURCE_1, '--action=compile', '-o', LIB) + run(CONCRETECOMPILER, SOURCE_1, '--action=compile', '-o', LIB) assert_exists(LIBS) @@ -69,7 +69,7 @@ def test_compile_library(): def test_compile_many_library(): remove(LIBS) - run(ZAMACOMPILER, SOURCE_1, SOURCE_2, '--action=compile', '-o', LIB) + run(CONCRETECOMPILER, SOURCE_1, SOURCE_2, '--action=compile', '-o', LIB) assert_exists(LIBS) diff --git a/compiler/tests/python/test_hlfhe_dialect.py b/compiler/tests/python/test_hlfhe_dialect.py index 7c7d57c78..e5e24880a 100644 --- a/compiler/tests/python/test_hlfhe_dialect.py +++ b/compiler/tests/python/test_hlfhe_dialect.py @@ -1,7 +1,7 @@ import pytest from mlir.ir import Context, RankedTensorType, Location -from zamalang import register_dialects -from zamalang.dialects import hlfhe +from concretelang import register_dialects +from concretelang.dialects import hlfhe @pytest.mark.parametrize("width", list(range(1, 8))) diff --git a/compiler/tests/python/test_round_trip.py b/compiler/tests/python/test_round_trip.py index 09605eb85..4fd1cbc59 100644 --- a/compiler/tests/python/test_round_trip.py +++ b/compiler/tests/python/test_round_trip.py @@ -1,5 +1,5 @@ import pytest -from zamalang import compiler +from concretelang import compiler VALID_INPUTS = [ diff --git a/compiler/tests/stress_tests/README.md b/compiler/tests/stress_tests/README.md index ca6f6d05d..42d61a5ed 100644 --- a/compiler/tests/stress_tests/README.md +++ b/compiler/tests/stress_tests/README.md @@ -27,7 +27,7 @@ Files are in json format but can easily be grepped (multi-lines). ```json { # Command line to relauch an experiment replication by end - "cmd": "zamacompiler /tmp/stresstests/basic_001_002_1.mlir --action=jit-invoke --jit-funcname=main --jit-args=1 --jit-args=1", + "cmd": "concretecompiler /tmp/stresstests/basic_001_002_1.mlir --action=jit-invoke --jit-funcname=main --jit-args=1 --jit-args=1", # General information about the experiment "conditions": { "bitwidth": 1, # precision in bits @@ -36,7 +36,7 @@ Files are in json format but can easily be grepped (multi-lines). 1, 1 ], - "log_manp_max": 3, # value comuted by zamacompiler + "log_manp_max": 3, # value comuted by concretecompiler "overflow": true, # does the exact computation overflow the precision "details": [ "OVERFLOW" diff --git a/compiler/tests/stress_tests/read_mlir.py b/compiler/tests/stress_tests/read_mlir.py index a0a8aed13..c29bafa64 100644 --- a/compiler/tests/stress_tests/read_mlir.py +++ b/compiler/tests/stress_tests/read_mlir.py @@ -1,7 +1,7 @@ from dataclasses import dataclass import re -from stress_tests.utils import ZAMACOMPILER, log2, ceil_log2, run +from stress_tests.utils import CONCRETECOMPILER, log2, ceil_log2, run DUMP_HLFHE = '--action=dump-hlfhe' @@ -15,7 +15,7 @@ def read_max_mlir_attribute(name, content): ) def log_manp_max(path): - hlfhe = run(ZAMACOMPILER, path, DUMP_HLFHE) + hlfhe = run(CONCRETECOMPILER, path, DUMP_HLFHE) return ceil_log2(read_max_mlir_attribute('MANP', hlfhe)) @dataclass @@ -24,7 +24,7 @@ class FHEParams: glwe_dim: int def v0_param(path): - lowlfhe = run(ZAMACOMPILER, path, DUMP_LOWLFHE) + lowlfhe = run(CONCRETECOMPILER, path, DUMP_LOWLFHE) return FHEParams( log_poly_size=log2(read_max_mlir_attribute('polynomialSize', lowlfhe)), glwe_dim=read_max_mlir_attribute('glweDimension', lowlfhe), diff --git a/compiler/tests/stress_tests/test_stress.py b/compiler/tests/stress_tests/test_stress.py index d3aeacbbe..f99478135 100644 --- a/compiler/tests/stress_tests/test_stress.py +++ b/compiler/tests/stress_tests/test_stress.py @@ -11,7 +11,7 @@ from stress_tests.experiment import ( ExperimentConditions, Experiment, Encoder, Replication ) from stress_tests import read_mlir -from stress_tests.utils import ZAMACOMPILER, run +from stress_tests.utils import CONCRETECOMPILER, run from stress_tests.v0_parameters import ( LOG2_MANP_MAX, P_MAX, v0_parameter @@ -141,7 +141,7 @@ def basic_setup(bitwidth, size, const, retry=10): if params.glwe_dim != expected_glwe_dim: msg(f'BAD_GLWEDIM ({params.glwe_dim} vs {expected_glwe_dim})', conditions_details) - cmd = (ZAMACOMPILER, path) + JIT_INVOKE_MAIN + jit_args(*args) + cmd = (CONCRETECOMPILER, path) + JIT_INVOKE_MAIN + jit_args(*args) compilers_calls = [executor.submit(run, *cmd) for _ in range(retry)] success = 0 diff --git a/compiler/tests/stress_tests/utils.py b/compiler/tests/stress_tests/utils.py index 94163edd2..ad42797df 100644 --- a/compiler/tests/stress_tests/utils.py +++ b/compiler/tests/stress_tests/utils.py @@ -1,6 +1,6 @@ import subprocess -ZAMACOMPILER = 'zamacompiler' +CONCRETECOMPILER = 'concretecompiler' def ceil_log2(v, exact=False): import math diff --git a/compiler/tests/unittest/CMakeLists.txt b/compiler/tests/unittest/CMakeLists.txt index 9d1d4df9b..7f884a030 100644 --- a/compiler/tests/unittest/CMakeLists.txt +++ b/compiler/tests/unittest/CMakeLists.txt @@ -2,9 +2,9 @@ enable_testing() include_directories(${PROJECT_SOURCE_DIR}/include) -if(ZAMALANG_PARALLEL_EXECUTION_ENABLED) +if(CONCRETELANG_PARALLEL_EXECUTION_ENABLED) add_compile_options( - -DZAMALANG_PARALLEL_TESTING_ENABLED + -DCONCRETELANG_PARALLEL_TESTING_ENABLED ) link_libraries( -Wl,-rpath,${CMAKE_BINARY_DIR}/lib/Runtime @@ -57,31 +57,31 @@ set_source_files_properties( target_link_libraries( end_to_end_jit_test gtest_main - ZamalangSupport + ConcretelangSupport ) target_link_libraries( end_to_end_jit_clear_tensor gtest_main - ZamalangSupport + ConcretelangSupport ) target_link_libraries( end_to_end_jit_encrypted_tensor gtest_main - ZamalangSupport + ConcretelangSupport ) target_link_libraries( end_to_end_jit_hlfhelinalg gtest_main - ZamalangSupport + ConcretelangSupport ) target_link_libraries( end_to_end_jit_lambda gtest_main - ZamalangSupport + ConcretelangSupport ) include(GoogleTest) @@ -91,7 +91,7 @@ gtest_discover_tests(end_to_end_jit_encrypted_tensor) gtest_discover_tests(end_to_end_jit_hlfhelinalg) gtest_discover_tests(end_to_end_jit_lambda) -if(ZAMALANG_PARALLEL_EXECUTION_ENABLED) +if(CONCRETELANG_PARALLEL_EXECUTION_ENABLED) add_executable( end_to_end_jit_dfr end_to_end_jit_dfr.cc @@ -110,7 +110,7 @@ if(ZAMALANG_PARALLEL_EXECUTION_ENABLED) target_link_libraries( end_to_end_jit_dfr gtest_main - ZamalangSupport + ConcretelangSupport -Wl,-rpath,${CMAKE_BINARY_DIR}/lib/Runtime -Wl,-rpath,${HPX_DIR}/../../ -Wl,--no-as-needed @@ -120,7 +120,7 @@ if(ZAMALANG_PARALLEL_EXECUTION_ENABLED) target_link_libraries( end_to_end_jit_auto_parallelization gtest_main - ZamalangSupport + ConcretelangSupport -Wl,-rpath,${CMAKE_BINARY_DIR}/lib/Runtime -Wl,-rpath,${HPX_DIR}/../../ -Wl,--no-as-needed diff --git a/compiler/tests/unittest/end_to_end_jit_auto_parallelization.cc b/compiler/tests/unittest/end_to_end_jit_auto_parallelization.cc index 3bea224d3..cb4b75e4f 100644 --- a/compiler/tests/unittest/end_to_end_jit_auto_parallelization.cc +++ b/compiler/tests/unittest/end_to_end_jit_auto_parallelization.cc @@ -10,7 +10,7 @@ /////////////////////////////////////////////////////////////////////////////// TEST(ParallelizeAndRunHLFHE, add_eint_tree) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%arg0: !HLFHE.eint<7>, %arg1: !HLFHE.eint<7>, %arg2: !HLFHE.eint<7>, %arg3: !HLFHE.eint<7>) -> !HLFHE.eint<7> { %1 = "HLFHE.add_eint"(%arg0, %arg1): (!HLFHE.eint<7>, !HLFHE.eint<7>) -> (!HLFHE.eint<7>) %2 = "HLFHE.add_eint"(%arg0, %arg2): (!HLFHE.eint<7>, !HLFHE.eint<7>) -> (!HLFHE.eint<7>) diff --git a/compiler/tests/unittest/end_to_end_jit_clear_tensor.cc b/compiler/tests/unittest/end_to_end_jit_clear_tensor.cc index 4babd79d0..2b569f0a7 100644 --- a/compiler/tests/unittest/end_to_end_jit_clear_tensor.cc +++ b/compiler/tests/unittest/end_to_end_jit_clear_tensor.cc @@ -5,7 +5,7 @@ /////////////////////////////////////////////////////////////////////////////// TEST(End2EndJit_ClearTensor_1D, identity) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit( R"XXX( func @main(%t: tensor<10xi64>) -> tensor<10xi64> { return %t : tensor<10xi64> @@ -37,7 +37,7 @@ func @main(%t: tensor<10xi64>) -> tensor<10xi64> { } TEST(End2EndJit_ClearTensor_1D, extract_64) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10xi64>, %i: index) -> i64{ %c = tensor.extract %t[%i] : tensor<10xi64> return %c : i64 @@ -62,7 +62,7 @@ func @main(%t: tensor<10xi64>, %i: index) -> i64{ } TEST(End2EndJit_ClearTensor_1D, extract_32) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10xi32>, %i: index) -> i32{ %c = tensor.extract %t[%i] : tensor<10xi32> return %c : i32 @@ -80,7 +80,7 @@ func @main(%t: tensor<10xi32>, %i: index) -> i32{ TEST(End2EndJit_ClearTensor_1D, extract_16) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10xi16>, %i: index) -> i16{ %c = tensor.extract %t[%i] : tensor<10xi16> return %c : i16 @@ -98,7 +98,7 @@ func @main(%t: tensor<10xi16>, %i: index) -> i16{ TEST(End2EndJit_ClearTensor_1D, extract_8) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10xi8>, %i: index) -> i8{ %c = tensor.extract %t[%i] : tensor<10xi8> return %c : i8 @@ -115,7 +115,7 @@ func @main(%t: tensor<10xi8>, %i: index) -> i8{ TEST(End2EndJit_ClearTensor_1D, extract_5) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10xi5>, %i: index) -> i5{ %c = tensor.extract %t[%i] : tensor<10xi5> return %c : i5 @@ -132,7 +132,7 @@ func @main(%t: tensor<10xi5>, %i: index) -> i5{ TEST(End2EndJit_ClearTensor_1D, extract_1) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10xi1>, %i: index) -> i1{ %c = tensor.extract %t[%i] : tensor<10xi1> return %c : i1 @@ -185,15 +185,15 @@ const llvm::ArrayRef shape2D(dims, numDim); TEST(End2EndJit_ClearTensor_2D, identity) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<2x10xi64>) -> tensor<2x10xi64> { return %t : tensor<2x10xi64> } )XXX", "main", true); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg(tensor2D, shape2D); llvm::Expected> res = @@ -210,7 +210,7 @@ func @main(%t: tensor<2x10xi64>) -> tensor<2x10xi64> { TEST(End2EndJit_ClearTensor_2D, extract) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<2x10xi64>, %i: index, %j: index) -> i64 { %c = tensor.extract %t[%i, %j] : tensor<2x10xi64> return %c : i64 @@ -218,14 +218,14 @@ func @main(%t: tensor<2x10xi64>, %i: index, %j: index) -> i64 { )XXX", "main", true); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg(tensor2D, shape2D); for (int64_t i = 0; i < dims[0]; i++) { for (int64_t j = 0; j < dims[1]; j++) { - mlir::zamalang::IntLambdaArgument argi(i); - mlir::zamalang::IntLambdaArgument argj(j); + mlir::concretelang::IntLambdaArgument argi(i); + mlir::concretelang::IntLambdaArgument argj(j); ASSERT_EXPECTED_VALUE(lambda({&arg, &argi, &argj}), TENSOR2D_GET(i, j)); } } @@ -233,7 +233,7 @@ func @main(%t: tensor<2x10xi64>, %i: index, %j: index) -> i64 { TEST(End2EndJit_ClearTensor_2D, extract_slice) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<2x10xi64>) -> tensor<1x5xi64> { %r = tensor.extract_slice %t[1, 5][1, 5][1, 1] : tensor<2x10xi64> to tensor<1x5xi64> return %r : tensor<1x5xi64> @@ -241,8 +241,8 @@ func @main(%t: tensor<2x10xi64>) -> tensor<1x5xi64> { )XXX", "main", true); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg(tensor2D, shape2D); llvm::Expected> res = @@ -261,7 +261,7 @@ func @main(%t: tensor<2x10xi64>) -> tensor<1x5xi64> { TEST(End2EndJit_ClearTensor_2D, extract_slice_stride) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<2x10xi64>) -> tensor<1x5xi64> { %r = tensor.extract_slice %t[1, 0][1, 5][1, 2] : tensor<2x10xi64> to tensor<1x5xi64> return %r : tensor<1x5xi64> @@ -269,8 +269,8 @@ func @main(%t: tensor<2x10xi64>) -> tensor<1x5xi64> { )XXX", "main", true); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg(tensor2D, shape2D); llvm::Expected> res = @@ -289,7 +289,7 @@ func @main(%t: tensor<2x10xi64>) -> tensor<1x5xi64> { TEST(End2EndJit_ClearTensor_2D, insert_slice) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t0: tensor<2x10xi64>, %t1: tensor<2x2xi64>) -> tensor<2x10xi64> { %r = tensor.insert_slice %t1 into %t0[0, 5][2, 2][1, 1] : tensor<2x2xi64> into tensor<2x10xi64> return %r : tensor<2x10xi64> @@ -297,13 +297,13 @@ func @main(%t0: tensor<2x10xi64>, %t1: tensor<2x2xi64>) -> tensor<2x10xi64> { )XXX", "main", true); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> t0(tensor2D, shape2D); int64_t t1Shape[] = {2, 2}; uint64_t t1Buffer[]{6, 9, 4, 0}; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> t1(t1Buffer, t1Shape); llvm::Expected> res = @@ -332,17 +332,17 @@ func @main(%t0: tensor<2x10xi64>, %t1: tensor<2x2xi64>) -> tensor<2x10xi64> { template void checkResultTensor( bool &status, - llvm::Expected> &res) { + llvm::Expected> &res) { status = false; ASSERT_TRUE((*res) - ->isa>>()); + ->isa>>()); - mlir::zamalang::TensorLambdaArgument> + mlir::concretelang::TensorLambdaArgument> &resp = (*res) - ->cast>>(); + ->cast>>(); ASSERT_EQ(resp.getDimensions().size(), (size_t)3); ASSERT_EQ(resp.getDimensions().at(0), 5); @@ -370,11 +370,11 @@ TEST_P(ReturnTensorWithPrecision, return_tensor) { << " return %res : tensor<5x3x2xi" << precision << ">\n" << "}"; - mlir::zamalang::JitCompilerEngine::Lambda lambda = + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(mlirProgram.str(), "main", true); - llvm::Expected> res = - lambda.operator()>({}); + llvm::Expected> res = + lambda.operator()>({}); ASSERT_EXPECTED_SUCCESS(res); bool status; diff --git a/compiler/tests/unittest/end_to_end_jit_dfr.cc b/compiler/tests/unittest/end_to_end_jit_dfr.cc index 6cc3af452..4ec1965c9 100644 --- a/compiler/tests/unittest/end_to_end_jit_dfr.cc +++ b/compiler/tests/unittest/end_to_end_jit_dfr.cc @@ -5,10 +5,10 @@ #include "end_to_end_jit_test.h" -const mlir::zamalang::V0FHEConstraint defaultV0Constraints{10, 7}; +const mlir::concretelang::V0FHEConstraint defaultV0Constraints{10, 7}; TEST(CompileAndRunDFR, start_stop) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func private @_dfr_stop() func private @_dfr_start() func @main() -> i64{ @@ -22,7 +22,7 @@ func @main() -> i64{ } TEST(CompileAndRunDFR, 0in1out_task) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( llvm.func @_dfr_await_future(!llvm.ptr) -> !llvm.ptr> attributes {sym_visibility = "private"} llvm.func @_dfr_create_async_task(...) attributes {sym_visibility = "private"} llvm.func @_dfr_stop() @@ -57,7 +57,7 @@ TEST(CompileAndRunDFR, 0in1out_task) { } TEST(CompileAndRunDFR, 1in1out_task) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( llvm.func @_dfr_await_future(!llvm.ptr) -> !llvm.ptr> attributes {sym_visibility = "private"} llvm.func @_dfr_create_async_task(...) attributes {sym_visibility = "private"} llvm.func @malloc(i64) -> !llvm.ptr @@ -102,7 +102,7 @@ TEST(CompileAndRunDFR, 1in1out_task) { } TEST(CompileAndRunDFR, 2in1out_task) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( llvm.func @_dfr_await_future(!llvm.ptr) -> !llvm.ptr> attributes {sym_visibility = "private"} llvm.func @_dfr_create_async_task(...) attributes {sym_visibility = "private"} llvm.func @malloc(i64) -> !llvm.ptr @@ -158,7 +158,7 @@ TEST(CompileAndRunDFR, 2in1out_task) { TEST(CompileAndRunDFR, taskgraph) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( llvm.func @_dfr_await_future(!llvm.ptr) -> !llvm.ptr> attributes {sym_visibility = "private"} llvm.func @_dfr_create_async_task(...) attributes {sym_visibility = "private"} llvm.func @malloc(i64) -> !llvm.ptr diff --git a/compiler/tests/unittest/end_to_end_jit_encrypted_tensor.cc b/compiler/tests/unittest/end_to_end_jit_encrypted_tensor.cc index 2c7c90b24..631a14199 100644 --- a/compiler/tests/unittest/end_to_end_jit_encrypted_tensor.cc +++ b/compiler/tests/unittest/end_to_end_jit_encrypted_tensor.cc @@ -17,15 +17,15 @@ const llvm::ArrayRef shape2D(dims, numDim); #define TENSOR2D_GET(i, j) GET_2D(tensor2D, i, j) TEST(End2EndJit_EncryptedTensor_2D, identity) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<2x10x!HLFHE.eint<6>>) -> tensor<2x10x!HLFHE.eint<6>> { return %t : tensor<2x10x!HLFHE.eint<6>> } )XXX"); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg(tensor2D, shape2D); llvm::Expected> res = @@ -41,7 +41,7 @@ func @main(%t: tensor<2x10x!HLFHE.eint<6>>) -> tensor<2x10x!HLFHE.eint<6>> { } TEST(End2EndJit_EncryptedTensor_2D, extract) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<2x10x!HLFHE.eint<6>>, %i: index, %j: index) -> !HLFHE.eint<6> { %c = tensor.extract %t[%i, %j] : tensor<2x10x!HLFHE.eint<6>> @@ -49,29 +49,29 @@ func @main(%t: tensor<2x10x!HLFHE.eint<6>>, %i: index, %j: index) -> } )XXX"); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg(tensor2D, shape2D); for (int64_t i = 0; i < dims[0]; i++) { for (int64_t j = 0; j < dims[1]; j++) { - mlir::zamalang::IntLambdaArgument argi(i); - mlir::zamalang::IntLambdaArgument argj(j); + mlir::concretelang::IntLambdaArgument argi(i); + mlir::concretelang::IntLambdaArgument argj(j); ASSERT_EXPECTED_VALUE(lambda({&arg, &argi, &argj}), TENSOR2D_GET(i, j)); } } } TEST(End2EndJit_EncryptedTensor_2D, extract_slice) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<2x10x!HLFHE.eint<6>>) -> tensor<1x5x!HLFHE.eint<6>> { %r = tensor.extract_slice %t[1, 5][1, 5][1, 1] : tensor<2x10x!HLFHE.eint<6>> to tensor<1x5x!HLFHE.eint<6>> return %r : tensor<1x5x!HLFHE.eint<6>> } )XXX"); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg(tensor2D, shape2D); llvm::Expected> res = @@ -89,7 +89,7 @@ func @main(%t: tensor<2x10x!HLFHE.eint<6>>) -> tensor<1x5x!HLFHE.eint<6>> { } TEST(End2EndJit_EncryptedTensor_2D, extract_slice_parametric_2x2) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<8x4x!HLFHE.eint<6>>, %y: index, %x: index) -> tensor<2x2x!HLFHE.eint<6>> { %r = tensor.extract_slice %t[%y, %x][2, 2][1, 1] : tensor<8x4x!HLFHE.eint<6>> to tensor<2x2x!HLFHE.eint<6>> return %r : tensor<2x2x!HLFHE.eint<6>> @@ -102,15 +102,15 @@ func @main(%t: tensor<8x4x!HLFHE.eint<6>>, %y: index, %x: index) -> tensor<2x2x! {3, 4, 5, 6}, {7, 8, 9, 0}, {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 0, 1, 2}}; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> argT(llvm::ArrayRef((const uint8_t *)A, rows * cols), {rows, cols}); for (uint64_t y = 0; y <= rows - tileSize; y += tileSize) { for (uint64_t x = 0; x <= cols - tileSize; x += tileSize) { - mlir::zamalang::IntLambdaArgument argY(y); - mlir::zamalang::IntLambdaArgument argX(x); + mlir::concretelang::IntLambdaArgument argY(y); + mlir::concretelang::IntLambdaArgument argX(x); llvm::Expected> res = lambda.operator()>({&argT, &argY, &argX}); @@ -129,7 +129,7 @@ func @main(%t: tensor<8x4x!HLFHE.eint<6>>, %y: index, %x: index) -> tensor<2x2x! TEST(End2EndJit_EncryptedTensor_4D, extract_slice_parametric_2x2x2x2) { constexpr int64_t dimSizes[4] = {8, 4, 5, 3}; - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<8x4x5x3x!HLFHE.eint<6>>, %d0: index, %d1: index, %d2: index, %d3: index) -> tensor<2x2x2x2x!HLFHE.eint<6>> { %r = tensor.extract_slice %t[%d0, %d1, %d2, %d3][2, 2, 2, 2][1, 1, 1, 1] : tensor<8x4x5x3x!HLFHE.eint<6>> to tensor<2x2x2x2x!HLFHE.eint<6>> return %r : tensor<2x2x2x2x!HLFHE.eint<6>> @@ -152,8 +152,8 @@ func @main(%t: tensor<8x4x5x3x!HLFHE.eint<6>>, %d0: index, %d1: index, %d2: inde const size_t coords[ncoords][4] = { {0, 0, 0, 0}, {1, 1, 1, 1}, {6, 2, 0, 1}, {3, 1, 2, 0}, {3, 1, 2, 1}}; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> argT(llvm::ArrayRef((const uint8_t *)A, dimSizes[0] * dimSizes[1] * dimSizes[2] * dimSizes[3]), @@ -165,10 +165,10 @@ func @main(%t: tensor<8x4x5x3x!HLFHE.eint<6>>, %d0: index, %d1: index, %d2: inde size_t d2 = coords[i][2]; size_t d3 = coords[i][3]; - mlir::zamalang::IntLambdaArgument argD0(d0); - mlir::zamalang::IntLambdaArgument argD1(d1); - mlir::zamalang::IntLambdaArgument argD2(d2); - mlir::zamalang::IntLambdaArgument argD3(d3); + mlir::concretelang::IntLambdaArgument argD0(d0); + mlir::concretelang::IntLambdaArgument argD1(d1); + mlir::concretelang::IntLambdaArgument argD2(d2); + mlir::concretelang::IntLambdaArgument argD3(d3); llvm::Expected> res = lambda.operator()>( @@ -191,7 +191,7 @@ func @main(%t: tensor<8x4x5x3x!HLFHE.eint<6>>, %d0: index, %d1: index, %d2: inde } TEST(End2EndJit_EncryptedTensor_2D, extract_slice_stride) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<2x10x!HLFHE.eint<6>>) -> tensor<1x5x!HLFHE.eint<6>> { %r = tensor.extract_slice %t[1, 0][1, 5][1, 2] : tensor<2x10x!HLFHE.eint<6>> to tensor<1x5x!HLFHE.eint<6>> @@ -199,8 +199,8 @@ func @main(%t: tensor<2x10x!HLFHE.eint<6>>) -> tensor<1x5x!HLFHE.eint<6>> { } )XXX"); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg(tensor2D, shape2D); llvm::Expected> res = @@ -218,7 +218,7 @@ func @main(%t: tensor<2x10x!HLFHE.eint<6>>) -> tensor<1x5x!HLFHE.eint<6>> { } TEST(End2EndJit_EncryptedTensor_2D, insert_slice) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t0: tensor<2x10x!HLFHE.eint<6>>, %t1: tensor<2x2x!HLFHE.eint<6>>) -> tensor<2x10x!HLFHE.eint<6>> { @@ -227,13 +227,13 @@ func @main(%t0: tensor<2x10x!HLFHE.eint<6>>, %t1: tensor<2x2x!HLFHE.eint<6>>) } )XXX"); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> t0(tensor2D, shape2D); int64_t t1Shape[] = {2, 2}; uint8_t t1Buffer[]{6, 9, 4, 0}; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> t1(t1Buffer, t1Shape); llvm::Expected> res = diff --git a/compiler/tests/unittest/end_to_end_jit_hlfhelinalg.cc b/compiler/tests/unittest/end_to_end_jit_hlfhelinalg.cc index 15088472f..5096b61f1 100644 --- a/compiler/tests/unittest/end_to_end_jit_hlfhelinalg.cc +++ b/compiler/tests/unittest/end_to_end_jit_hlfhelinalg.cc @@ -1,6 +1,6 @@ #include "end_to_end_jit_test.h" -namespace Z = mlir::zamalang; +namespace Z = mlir::concretelang; template using tensorArgTy = Z::TensorLambdaArgument>; @@ -13,7 +13,7 @@ using tensorArgTy = Z::TensorLambdaArgument>; TEST(End2EndJit_HLFHELinalg, add_eint_int_term_to_term) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the term to term addition of `%a0` with `%a1` func @main(%a0: tensor<4x!HLFHE.eint<6>>, %a1: tensor<4xi7>) -> tensor<4x!HLFHE.eint<6>> { %res = "HLFHELinalg.add_eint_int"(%a0, %a1) : (tensor<4x!HLFHE.eint<6>>, tensor<4xi7>) -> tensor<4x!HLFHE.eint<6>> @@ -23,11 +23,11 @@ TEST(End2EndJit_HLFHELinalg, add_eint_int_term_to_term) { std::vector a0{31, 6, 12, 9}; std::vector a1{32, 9, 2, 3}; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(a0); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(a1); llvm::Expected> res = @@ -45,7 +45,7 @@ TEST(End2EndJit_HLFHELinalg, add_eint_int_term_to_term) { // Same as add_eint_int_term_to_term test above, but returning a lambda argument TEST(End2EndJit_HLFHELinalg, add_eint_int_term_to_term_ret_lambda_argument) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the term to term addition of `%a0` with `%a1` func @main(%a0: tensor<4x!HLFHE.eint<6>>, %a1: tensor<4xi7>) -> tensor<4x!HLFHE.eint<6>> { %res = "HLFHELinalg.add_eint_int"(%a0, %a1) : (tensor<4x!HLFHE.eint<6>>, tensor<4xi7>) -> tensor<4x!HLFHE.eint<6>> @@ -55,23 +55,23 @@ TEST(End2EndJit_HLFHELinalg, add_eint_int_term_to_term_ret_lambda_argument) { std::vector a0{31, 6, 12, 9}; std::vector a1{32, 9, 2, 3}; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(a0); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(a1); - llvm::Expected> res = - lambda.operator()>( + llvm::Expected> res = + lambda.operator()>( {&arg0, &arg1}); ASSERT_EXPECTED_SUCCESS(res); - mlir::zamalang::TensorLambdaArgument> + mlir::concretelang::TensorLambdaArgument> &resp = (*res) - ->cast>>(); + ->cast>>(); ASSERT_EQ(resp.getDimensions().size(), (size_t)1); ASSERT_EQ(resp.getDimensions().at(0), 4); @@ -87,7 +87,7 @@ TEST(End2EndJit_HLFHELinalg, add_eint_int_term_to_term_ret_lambda_argument) { TEST(End2EndJit_HLFHELinalg, add_eint_int_term_to_term_ret_lambda_argument_multi_dim) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the term to term addition of `%a0` with `%a1` func @main(%a0: tensor<4x2x3x!HLFHE.eint<6>>, %a1: tensor<4x2x3xi7>) -> tensor<4x2x3x!HLFHE.eint<6>> { %res = "HLFHELinalg.add_eint_int"(%a0, %a1) : (tensor<4x2x3x!HLFHE.eint<6>>, tensor<4x2x3xi7>) -> tensor<4x2x3x!HLFHE.eint<6>> @@ -99,23 +99,23 @@ TEST(End2EndJit_HLFHELinalg, std::vector a1{32, 9, 2, 3, 6, 6, 2, 1, 1, 6, 9, 7, 3, 5, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(a0, {4, 2, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(a1, {4, 2, 3}); - llvm::Expected> res = - lambda.operator()>( + llvm::Expected> res = + lambda.operator()>( {&arg0, &arg1}); ASSERT_EXPECTED_SUCCESS(res); - mlir::zamalang::TensorLambdaArgument> + mlir::concretelang::TensorLambdaArgument> &resp = (*res) - ->cast>>(); + ->cast>>(); ASSERT_EQ(resp.getDimensions().size(), (size_t)3); ASSERT_EQ(resp.getDimensions().at(0), 4); @@ -130,7 +130,7 @@ TEST(End2EndJit_HLFHELinalg, TEST(End2EndJit_HLFHELinalg, add_eint_int_term_to_term_broadcast) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the term to term addition of `%a0` with `%a1` func @main(%a0: tensor<4x1x4x!HLFHE.eint<5>>, %a1: tensor<1x4x4xi6>) -> tensor<4x4x4x!HLFHE.eint<5>> { %res = "HLFHELinalg.add_eint_int"(%a0, %a1) : (tensor<4x1x4x!HLFHE.eint<5>>, tensor<1x4x4xi6>) -> tensor<4x4x4x!HLFHE.eint<5>> @@ -152,11 +152,11 @@ TEST(End2EndJit_HLFHELinalg, add_eint_int_term_to_term_broadcast) { }, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::MutableArrayRef((uint8_t *)a0, 4 * 1 * 4), {4, 1, 4}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::MutableArrayRef((uint8_t *)a1, 1 * 4 * 4), {1, 4, 4}); llvm::Expected> res = @@ -179,7 +179,7 @@ TEST(End2EndJit_HLFHELinalg, add_eint_int_term_to_term_broadcast) { TEST(End2EndJit_HLFHELinalg, add_eint_int_matrix_column) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the addition of a 3x3 matrix of encrypted integers and a 3x1 matrix (a column) of encrypted integers. // // [1,2,3] [1] [2,3,4] @@ -203,11 +203,11 @@ TEST(End2EndJit_HLFHELinalg, add_eint_int_matrix_column) { {3}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::MutableArrayRef((uint8_t *)a0, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::MutableArrayRef((uint8_t *)a0, 3 * 1), {3, 1}); llvm::Expected> res = @@ -225,7 +225,7 @@ TEST(End2EndJit_HLFHELinalg, add_eint_int_matrix_column) { } TEST(End2EndJit_HLFHELinalg, add_eint_int_matrix_line) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the addition of a 3x3 matrix of encrypted integers and a 1x3 matrix (a line) of encrypted integers. // // [1,2,3] [2,4,6] @@ -247,11 +247,11 @@ TEST(End2EndJit_HLFHELinalg, add_eint_int_matrix_line) { {1, 2, 3}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a0, 3 * 1), {1, 3}); llvm::Expected> res = @@ -269,7 +269,7 @@ TEST(End2EndJit_HLFHELinalg, add_eint_int_matrix_line) { } TEST(End2EndJit_HLFHELinalg, add_eint_int_matrix_line_missing_dim) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Same behavior than the previous one, but as the dimension #2 of operand #2 is missing. func @main(%a0: tensor<3x3x!HLFHE.eint<4>>, %a1: tensor<3xi5>) -> tensor<3x3x!HLFHE.eint<4>> { %res = "HLFHELinalg.add_eint_int"(%a0, %a1) : (tensor<3x3x!HLFHE.eint<4>>, tensor<3xi5>) -> tensor<3x3x!HLFHE.eint<4>> @@ -285,11 +285,11 @@ TEST(End2EndJit_HLFHELinalg, add_eint_int_matrix_line_missing_dim) { {1, 2, 3}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a0, 3 * 1), {3}); llvm::Expected> res = @@ -312,7 +312,7 @@ TEST(End2EndJit_HLFHELinalg, add_eint_int_matrix_line_missing_dim) { TEST(End2EndJit_HLFHELinalg, add_eint_term_to_term) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the term to term addition of `%a0` with `%a1` func @main(%a0: tensor<4x!HLFHE.eint<6>>, %a1: tensor<4x!HLFHE.eint<6>>) -> tensor<4x!HLFHE.eint<6>> { %res = "HLFHELinalg.add_eint"(%a0, %a1) : (tensor<4x!HLFHE.eint<6>>, tensor<4x!HLFHE.eint<6>>) -> tensor<4x!HLFHE.eint<6>> @@ -323,11 +323,11 @@ TEST(End2EndJit_HLFHELinalg, add_eint_term_to_term) { std::vector a0{31, 6, 12, 9}; std::vector a1{32, 9, 2, 3}; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(a0); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(a1); llvm::Expected> res = @@ -346,7 +346,7 @@ TEST(End2EndJit_HLFHELinalg, add_eint_term_to_term) { TEST(End2EndJit_HLFHELinalg, add_eint_term_to_term_broadcast) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the term to term addition of `%a0` with `%a1` func @main(%a0: tensor<4x1x4x!HLFHE.eint<5>>, %a1: tensor<1x4x4x!HLFHE.eint<5>>) -> tensor<4x4x4x!HLFHE.eint<5>> { @@ -370,11 +370,11 @@ TEST(End2EndJit_HLFHELinalg, add_eint_term_to_term_broadcast) { }, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::MutableArrayRef((uint8_t *)a0, 4 * 1 * 4), {4, 1, 4}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::MutableArrayRef((uint8_t *)a1, 1 * 4 * 4), {1, 4, 4}); llvm::Expected> res = @@ -397,7 +397,7 @@ TEST(End2EndJit_HLFHELinalg, add_eint_term_to_term_broadcast) { TEST(End2EndJit_HLFHELinalg, add_eint_matrix_column) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the addition of a 3x3 matrix of encrypted integers and a 3x1 matrix (a column) of encrypted integers. // // [1,2,3] [1] [2,3,4] @@ -422,11 +422,11 @@ TEST(End2EndJit_HLFHELinalg, add_eint_matrix_column) { {3}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a0, 3 * 1), {3, 1}); llvm::Expected> res = @@ -445,7 +445,7 @@ TEST(End2EndJit_HLFHELinalg, add_eint_matrix_column) { TEST(End2EndJit_HLFHELinalg, add_eint_matrix_line) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the addition of a 3x3 matrix of encrypted integers and a 1x3 matrix (a line) of encrypted integers. // // [1,2,3] [2,4,6] @@ -469,11 +469,11 @@ TEST(End2EndJit_HLFHELinalg, add_eint_matrix_line) { {1, 2, 3}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a0, 3 * 1), {1, 3}); llvm::Expected> res = @@ -492,7 +492,7 @@ TEST(End2EndJit_HLFHELinalg, add_eint_matrix_line) { TEST(End2EndJit_HLFHELinalg, add_eint_matrix_line_missing_dim) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Same behavior than the previous one, but as the dimension #2 of operand #2 is missing. func @main(%a0: tensor<3x3x!HLFHE.eint<4>>, %a1: tensor<3x!HLFHE.eint<4>>) -> tensor<3x3x!HLFHE.eint<4>> { %res = "HLFHELinalg.add_eint"(%a0, %a1) : (tensor<3x3x!HLFHE.eint<4>>, tensor<3x!HLFHE.eint<4>>) -> tensor<3x3x!HLFHE.eint<4>> @@ -508,11 +508,11 @@ TEST(End2EndJit_HLFHELinalg, add_eint_matrix_line_missing_dim) { {1, 2, 3}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a0, 3 * 1), {3}); llvm::Expected> res = @@ -531,7 +531,7 @@ TEST(End2EndJit_HLFHELinalg, add_eint_matrix_line_missing_dim) { TEST(End2EndJit_HLFHELinalg, add_eint_tensor_dim_equals_1) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Broadcasting shouldn't happen when some dimensions are equals to 1 func @main(%arg0: tensor<3x1x2x!HLFHE.eint<5>>, %arg1: tensor<3x1x2x!HLFHE.eint<5>>) -> tensor<3x1x2x!HLFHE.eint<5>> { %1 = "HLFHELinalg.add_eint"(%arg0, %arg1) : (tensor<3x1x2x!HLFHE.eint<5>>, tensor<3x1x2x!HLFHE.eint<5>>) -> tensor<3x1x2x!HLFHE.eint<5>> @@ -549,11 +549,11 @@ TEST(End2EndJit_HLFHELinalg, add_eint_tensor_dim_equals_1) { {{16, 18}}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 3 * 2), {3, 1, 2}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a1, 3 * 2), {3, 1, 2}); llvm::Expected> res = @@ -578,7 +578,7 @@ TEST(End2EndJit_HLFHELinalg, add_eint_tensor_dim_equals_1) { TEST(End2EndJit_HLFHELinalg, sub_int_eint_term_to_term) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the term to term substraction of `%a0` with `%a1` func @main(%a0: tensor<4xi5>, %a1: tensor<4x!HLFHE.eint<4>>) -> tensor<4x!HLFHE.eint<4>> { %res = "HLFHELinalg.sub_int_eint"(%a0, %a1) : (tensor<4xi5>, tensor<4x!HLFHE.eint<4>>) -> tensor<4x!HLFHE.eint<4>> @@ -588,11 +588,11 @@ TEST(End2EndJit_HLFHELinalg, sub_int_eint_term_to_term) { std::vector a0{32, 9, 12, 9}; std::vector a1{31, 6, 2, 3}; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(a0); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(a1); llvm::Expected> res = @@ -609,7 +609,7 @@ TEST(End2EndJit_HLFHELinalg, sub_int_eint_term_to_term) { TEST(End2EndJit_HLFHELinalg, sub_int_eint_term_to_term_broadcast) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the term to term substraction of `%a0` with `%a1`, where dimensions equals to one are stretched. func @main(%a0: tensor<4x1x4xi8>, %a1: tensor<1x4x4x!HLFHE.eint<7>>) -> tensor<4x4x4x!HLFHE.eint<7>> { %res = "HLFHELinalg.sub_int_eint"(%a0, %a1) : (tensor<4x1x4xi8>, tensor<1x4x4x!HLFHE.eint<7>>) -> tensor<4x4x4x!HLFHE.eint<7>> @@ -630,11 +630,11 @@ TEST(End2EndJit_HLFHELinalg, sub_int_eint_term_to_term_broadcast) { {13, 14, 15, 16}, }, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 4 * 1 * 4), {4, 1, 4}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a1, 1 * 4 * 4), {1, 4, 4}); llvm::Expected> res = @@ -656,7 +656,7 @@ TEST(End2EndJit_HLFHELinalg, sub_int_eint_term_to_term_broadcast) { TEST(End2EndJit_HLFHELinalg, sub_int_eint_matrix_column) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the substraction of a 3x3 matrix of integers and a 3x1 matrix (a column) of encrypted integers. // // [1,2,3] [1] [0,2,3] @@ -682,11 +682,11 @@ TEST(End2EndJit_HLFHELinalg, sub_int_eint_matrix_column) { {3}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a0, 3 * 1), {3, 1}); llvm::Expected> res = @@ -705,7 +705,7 @@ TEST(End2EndJit_HLFHELinalg, sub_int_eint_matrix_column) { TEST(End2EndJit_HLFHELinalg, sub_int_eint_matrix_line) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the substraction of a 3x3 matrix of integers and a 1x3 matrix (a line) of encrypted integers. // // [1,2,3] [0,0,0] @@ -729,11 +729,11 @@ TEST(End2EndJit_HLFHELinalg, sub_int_eint_matrix_line) { {1, 2, 3}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a0, 3 * 1), {1, 3}); llvm::Expected> res = @@ -752,7 +752,7 @@ TEST(End2EndJit_HLFHELinalg, sub_int_eint_matrix_line) { TEST(End2EndJit_HLFHELinalg, sub_int_eint_matrix_line_missing_dim) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Same behavior than the previous one, but as the dimension #2 of operand #2 is missing. func @main(%a0: tensor<3x3xi5>, %a1: tensor<3x!HLFHE.eint<4>>) -> tensor<3x3x!HLFHE.eint<4>> { %res = "HLFHELinalg.sub_int_eint"(%a0, %a1) : (tensor<3x3xi5>, tensor<3x!HLFHE.eint<4>>) -> tensor<3x3x!HLFHE.eint<4>> @@ -768,11 +768,11 @@ TEST(End2EndJit_HLFHELinalg, sub_int_eint_matrix_line_missing_dim) { {1, 2, 3}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a0, 3 * 1), {3}); llvm::Expected> res = @@ -795,7 +795,7 @@ TEST(End2EndJit_HLFHELinalg, sub_int_eint_matrix_line_missing_dim) { TEST(End2EndJit_HLFHELinalg, mul_eint_int_term_to_term) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the term to term multiplication of `%a0` with `%a1` func @main(%a0: tensor<4x!HLFHE.eint<6>>, %a1: tensor<4xi7>) -> tensor<4x!HLFHE.eint<6>> { %res = "HLFHELinalg.mul_eint_int"(%a0, %a1) : (tensor<4x!HLFHE.eint<6>>, tensor<4xi7>) -> tensor<4x!HLFHE.eint<6>> @@ -805,11 +805,11 @@ TEST(End2EndJit_HLFHELinalg, mul_eint_int_term_to_term) { std::vector a0{31, 6, 12, 9}; std::vector a1{2, 3, 2, 3}; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(a0); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(a1); llvm::Expected> res = @@ -826,7 +826,7 @@ TEST(End2EndJit_HLFHELinalg, mul_eint_int_term_to_term) { TEST(End2EndJit_HLFHELinalg, mul_eint_int_term_to_term_broadcast) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the term to term multiplication of `%a0` with `%a1`, where dimensions equals to one are stretched. func @main(%a0: tensor<4x1x4x!HLFHE.eint<6>>, %a1: tensor<1x4x4xi7>) -> tensor<4x4x4x!HLFHE.eint<6>> { %res = "HLFHELinalg.mul_eint_int"(%a0, %a1) : (tensor<4x1x4x!HLFHE.eint<6>>, tensor<1x4x4xi7>) -> tensor<4x4x4x!HLFHE.eint<6>> @@ -848,11 +848,11 @@ TEST(End2EndJit_HLFHELinalg, mul_eint_int_term_to_term_broadcast) { }, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 4 * 1 * 4), {4, 1, 4}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a1, 1 * 4 * 4), {1, 4, 4}); llvm::Expected> res = @@ -874,7 +874,7 @@ TEST(End2EndJit_HLFHELinalg, mul_eint_int_term_to_term_broadcast) { TEST(End2EndJit_HLFHELinalg, mul_eint_int_matrix_column) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the multiplication of a 3x3 matrix of encrypted integers and a 3x1 matrix (a column) of integers. // // [1,2,3] [1] [1,2,3] @@ -898,11 +898,11 @@ TEST(End2EndJit_HLFHELinalg, mul_eint_int_matrix_column) { {3}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a0, 3 * 1), {3, 1}); llvm::Expected> res = @@ -921,7 +921,7 @@ TEST(End2EndJit_HLFHELinalg, mul_eint_int_matrix_column) { TEST(End2EndJit_HLFHELinalg, mul_eint_int_matrix_line) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the multiplication of a 3x3 matrix of encrypted integers and a 1x3 matrix (a line) of integers. // // [1,2,3] [2,4,6] @@ -943,11 +943,11 @@ TEST(End2EndJit_HLFHELinalg, mul_eint_int_matrix_line) { {1, 2, 3}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a0, 3 * 1), {1, 3}); llvm::Expected> res = @@ -966,7 +966,7 @@ TEST(End2EndJit_HLFHELinalg, mul_eint_int_matrix_line) { TEST(End2EndJit_HLFHELinalg, mul_eint_int_matrix_line_missing_dim) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Same behavior than the previous one, but as the dimension #2 of operand #2 is missing. func @main(%a0: tensor<3x3x!HLFHE.eint<4>>, %a1: tensor<3xi5>) -> tensor<3x3x!HLFHE.eint<4>> { %res = "HLFHELinalg.mul_eint_int"(%a0, %a1) : (tensor<3x3x!HLFHE.eint<4>>, tensor<3xi5>) -> tensor<3x3x!HLFHE.eint<4>> @@ -982,11 +982,11 @@ TEST(End2EndJit_HLFHELinalg, mul_eint_int_matrix_line_missing_dim) { {1, 2, 3}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg0(llvm::ArrayRef((const uint8_t *)a0, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> arg1(llvm::ArrayRef((const uint8_t *)a0, 3 * 1), {3}); llvm::Expected> res = @@ -1009,7 +1009,7 @@ TEST(End2EndJit_HLFHELinalg, mul_eint_int_matrix_line_missing_dim) { TEST(End2EndJit_HLFHELinalg, apply_lookup_table) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the lookup of 3x3 matrix of encrypted indices of with 2 on a table of size 4=2² of clear integers. // // [0,1,2] [1,3,5] @@ -1032,8 +1032,8 @@ TEST(End2EndJit_HLFHELinalg, apply_lookup_table) { {5, 7, 1}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> tArg(llvm::ArrayRef((const uint8_t *)t, 3 * 3), {3, 3}); llvm::Expected> res = @@ -1058,7 +1058,7 @@ TEST(End2EndJit_HLFHELinalg, apply_lookup_table) { TEST(End2EndJit_HLFHELinalg, apply_multi_lookup_table) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the lookup of 3x3 matrix of encrypted indices of width 2 on a 3x3 matrix of tables of size 4=2² of clear integers. func @main(%arg0: tensor<3x3x!HLFHE.eint<2>>, %arg1: tensor<3x3x4xi64>) -> tensor<3x3x!HLFHE.eint<2>> { %1 = "HLFHELinalg.apply_multi_lookup_table"(%arg0, %arg1): (tensor<3x3x!HLFHE.eint<2>>, tensor<3x3x4xi64>) -> tensor<3x3x!HLFHE.eint<2>> @@ -1081,12 +1081,12 @@ TEST(End2EndJit_HLFHELinalg, apply_multi_lookup_table) { {0, 3, 6}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> tArg(llvm::MutableArrayRef((uint8_t *)t, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> lutsArg(llvm::MutableArrayRef((uint64_t *)luts, 3 * 3 * 4), {3, 3, 4}); @@ -1107,7 +1107,7 @@ TEST(End2EndJit_HLFHELinalg, apply_multi_lookup_table) { TEST(End2EndJit_HLFHELinalg, apply_multi_lookup_table_with_boradcast) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the lookup of 3x3 matrix of encrypted indices of width 2 on a vector of 3 tables of size 4=2² of clear integers. func @main(%arg0: tensor<3x3x!HLFHE.eint<2>>, %arg1: tensor<3x4xi64>) -> tensor<3x3x!HLFHE.eint<2>> { %1 = "HLFHELinalg.apply_multi_lookup_table"(%arg0, %arg1): (tensor<3x3x!HLFHE.eint<2>>, tensor<3x4xi64>) -> tensor<3x3x!HLFHE.eint<2>> @@ -1130,12 +1130,12 @@ TEST(End2EndJit_HLFHELinalg, apply_multi_lookup_table_with_boradcast) { {5, 3, 2}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> tArg(llvm::MutableArrayRef((uint8_t *)t, 3 * 3), {3, 3}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> lutsArg(llvm::MutableArrayRef((uint64_t *)luts, 3 * 4), {3, 4}); llvm::Expected> res = @@ -1159,7 +1159,7 @@ TEST(End2EndJit_HLFHELinalg, apply_multi_lookup_table_with_boradcast) { TEST(End2EndJit_HLFHELinalg, apply_mapped_lookup_table_sequential) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the lookup of 3x3 matrix of encrypted indices of width 2 of a 3x3 matrix of tables of size 4=2² of clear integers. func @main(%t: tensor<3x3x!HLFHE.eint<2>>, %luts: tensor<9x4xi64>, %map: tensor<3x3xindex>) -> tensor<3x3x!HLFHE.eint<2>> { %1 = "HLFHELinalg.apply_mapped_lookup_table"(%t, %luts, %map) : @@ -1209,7 +1209,7 @@ TEST(End2EndJit_HLFHELinalg, apply_mapped_lookup_table_sequential) { TEST(End2EndJit_HLFHELinalg, apply_mapped_lookup_table_same_lut) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the lookup of 3x3 matrix of encrypted indices of width 2 of a 3x3 matrix of tables of size 4=2² of clear integers. func @main(%t: tensor<3x3x!HLFHE.eint<2>>, %luts: tensor<9x4xi64>, %map: tensor<3x3xindex>) -> tensor<3x3x!HLFHE.eint<2>> { %1 = "HLFHELinalg.apply_mapped_lookup_table"(%t, %luts, %map) : @@ -1262,7 +1262,7 @@ TEST(End2EndJit_HLFHELinalg, apply_mapped_lookup_table_same_lut) { /////////////////////////////////////////////////////////////////////////////// TEST(CompileAndRunTensorEncrypted, dot_eint_int_7) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%arg0: tensor<4x!HLFHE.eint<7>>, %arg1: tensor<4xi8>) -> !HLFHE.eint<7> { @@ -1286,7 +1286,7 @@ func @main(%arg0: tensor<4x!HLFHE.eint<7>>, TEST(End2EndJit_HLFHELinalg, neg_eint) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the negation of a 3x3 matrix of encrypted integers of width 2. // // ([0,1,2]) [0,7,6] @@ -1308,8 +1308,8 @@ TEST(End2EndJit_HLFHELinalg, neg_eint) { {2, 1, 0}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> tArg(llvm::ArrayRef((const uint8_t *)t, 3 * 3), {3, 3}); llvm::Expected> res = @@ -1333,7 +1333,7 @@ TEST(End2EndJit_HLFHELinalg, neg_eint) { TEST(End2EndJit_HLFHELinalg, matmul_eint_int) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the matrix multiplication of a 3x2 matrix of encrypted integers and a 2x3 matrix of integers. // [ 1, 2, 3] // [ 2, 3, 4] @@ -1361,11 +1361,11 @@ TEST(End2EndJit_HLFHELinalg, matmul_eint_int) { {17, 28, 39}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> aArg(llvm::ArrayRef((const uint8_t *)A, 3 * 2), {3, 2}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> bArg(llvm::ArrayRef((const uint8_t *)B, 2 * 3), {2, 3}); llvm::Expected> res = @@ -1389,7 +1389,7 @@ TEST(End2EndJit_HLFHELinalg, matmul_eint_int) { TEST(End2EndJit_HLFHELinalg, matmul_int_eint) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( // Returns the matrix multiplication of a 3x2 matrix of encrypted integers and a 2x3 matrix of integers. // [ 1, 2, 3] // [ 2, 3, 4] @@ -1417,11 +1417,11 @@ TEST(End2EndJit_HLFHELinalg, matmul_int_eint) { {17, 28, 39}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> aArg(llvm::ArrayRef((const uint8_t *)A, 3 * 2), {3, 2}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> bArg(llvm::ArrayRef((const uint8_t *)B, 2 * 3), {2, 3}); llvm::Expected> res = @@ -1445,7 +1445,7 @@ TEST(End2EndJit_HLFHELinalg, matmul_int_eint) { TEST(End2EndJit_Linalg, tensor_collapse_shape) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%a: tensor<2x2x4x!HLFHE.eint<6>>) -> tensor<2x8x!HLFHE.eint<6>> { %0 = linalg.tensor_collapse_shape %a [[0],[1,2]] : tensor<2x2x4x!HLFHE.eint<6>> into tensor<2x8x!HLFHE.eint<6>> return %0 : tensor<2x8x!HLFHE.eint<6>> @@ -1460,20 +1460,20 @@ func @main(%a: tensor<2x2x4x!HLFHE.eint<6>>) -> tensor<2x8x!HLFHE.eint<6>> { {10, 11, 12, 13, 14, 15, 16, 17}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> aArg(llvm::MutableArrayRef((uint8_t *)A, 2 * 2 * 4), {2, 2, 4}); - llvm::Expected> res = - lambda.operator()>( + llvm::Expected> res = + lambda.operator()>( {&aArg}); ASSERT_EXPECTED_SUCCESS(res); - mlir::zamalang::TensorLambdaArgument> + mlir::concretelang::TensorLambdaArgument> &resp = (*res) - ->cast>>(); + ->cast>>(); ASSERT_EQ(resp.getDimensions().size(), (size_t)2); ASSERT_EQ(resp.getDimensions().at(0), 2); @@ -1494,7 +1494,7 @@ func @main(%a: tensor<2x2x4x!HLFHE.eint<6>>) -> tensor<2x8x!HLFHE.eint<6>> { TEST(End2EndJit_Linalg, tensor_expand_shape) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%a: tensor<2x8x!HLFHE.eint<6>>) -> tensor<2x2x4x!HLFHE.eint<6>> { %0 = linalg.tensor_expand_shape %a [[0],[1,2]] : tensor<2x8x!HLFHE.eint<6>> into tensor<2x2x4x!HLFHE.eint<6>> return %0 : tensor<2x2x4x!HLFHE.eint<6>> @@ -1510,20 +1510,20 @@ func @main(%a: tensor<2x8x!HLFHE.eint<6>>) -> tensor<2x2x4x!HLFHE.eint<6>> { {{10, 11, 12, 13}, {14, 15, 16, 17}}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> aArg(llvm::MutableArrayRef((uint8_t *)A, 2 * 8), {2, 8}); - llvm::Expected> res = - lambda.operator()>( + llvm::Expected> res = + lambda.operator()>( {&aArg}); ASSERT_EXPECTED_SUCCESS(res); - mlir::zamalang::TensorLambdaArgument> + mlir::concretelang::TensorLambdaArgument> &resp = (*res) - ->cast>>(); + ->cast>>(); ASSERT_EQ(resp.getDimensions().size(), (size_t)3); ASSERT_EQ(resp.getDimensions().at(0), 2); @@ -1546,22 +1546,22 @@ func @main(%a: tensor<2x8x!HLFHE.eint<6>>) -> tensor<2x2x4x!HLFHE.eint<6>> { /////////////////////////////////////////////////////////////////////////////// TEST(End2EndJit_Linalg, zero) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main() -> tensor<2x2x4x!HLFHE.eint<6>> { %0 = "HLFHELinalg.zero"() : () -> tensor<2x2x4x!HLFHE.eint<6>> return %0 : tensor<2x2x4x!HLFHE.eint<6>> } )XXX"); - llvm::Expected> res = - lambda.operator()>(); + llvm::Expected> res = + lambda.operator()>(); ASSERT_EXPECTED_SUCCESS(res); - mlir::zamalang::TensorLambdaArgument> + mlir::concretelang::TensorLambdaArgument> &resp = (*res) - ->cast>>(); + ->cast>>(); ASSERT_EQ(resp.getDimensions().size(), (size_t)3); ASSERT_EQ(resp.getDimensions().at(0), 2); @@ -1597,7 +1597,7 @@ TEST_P(TiledMatMulParametric, tiled_matmul_eint_int) { << " return %0 : tensor<8x2x!HLFHE.eint<6>>\n" << " }"; - mlir::zamalang::JitCompilerEngine::Lambda lambda = + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(mlirProgram.str()); const size_t rowsA = 8; @@ -1617,12 +1617,12 @@ TEST_P(TiledMatMulParametric, tiled_matmul_eint_int) { {58, 55}, {16, 21}, {44, 57}, {12, 23}, }; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> aArg(llvm::ArrayRef((const uint8_t *)A, rowsA * colsA), {rowsA, colsA}); - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> bArg(llvm::ArrayRef((const uint8_t *)B, rowsB * colsB), {rowsB, colsB}); diff --git a/compiler/tests/unittest/end_to_end_jit_lambda.cc b/compiler/tests/unittest/end_to_end_jit_lambda.cc index 023e9ce5d..981e18f47 100644 --- a/compiler/tests/unittest/end_to_end_jit_lambda.cc +++ b/compiler/tests/unittest/end_to_end_jit_lambda.cc @@ -2,9 +2,9 @@ #include "end_to_end_jit_test.h" -const mlir::zamalang::V0FHEConstraint defaultV0Constraints{10, 7}; +const mlir::concretelang::V0FHEConstraint defaultV0Constraints{10, 7}; -using Lambda = mlir::zamalang::JitCompilerEngine::Lambda; +using Lambda = mlir::concretelang::JitCompilerEngine::Lambda; TEST(Lambda_check_param, int_to_void_missing_param) { diff --git a/compiler/tests/unittest/end_to_end_jit_test.cc b/compiler/tests/unittest/end_to_end_jit_test.cc index b8e6036cb..d4ab54bc6 100644 --- a/compiler/tests/unittest/end_to_end_jit_test.cc +++ b/compiler/tests/unittest/end_to_end_jit_test.cc @@ -6,7 +6,7 @@ #include "end_to_end_jit_test.h" TEST(CompileAndRunHLFHE, add_eint) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%arg0: !HLFHE.eint<7>, %arg1: !HLFHE.eint<7>) -> !HLFHE.eint<7> { %1 = "HLFHE.add_eint"(%arg0, %arg1): (!HLFHE.eint<7>, !HLFHE.eint<7>) -> (!HLFHE.eint<7>) return %1: !HLFHE.eint<7> @@ -21,17 +21,17 @@ func @main(%arg0: !HLFHE.eint<7>, %arg1: !HLFHE.eint<7>) -> !HLFHE.eint<7> { // Same as CompileAndRunHLFHE::add_eint above, but using // `LambdaArgument` instances as arguments TEST(CompileAndRunHLFHE, add_eint_lambda_argument) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%arg0: !HLFHE.eint<7>, %arg1: !HLFHE.eint<7>) -> !HLFHE.eint<7> { %1 = "HLFHE.add_eint"(%arg0, %arg1): (!HLFHE.eint<7>, !HLFHE.eint<7>) -> (!HLFHE.eint<7>) return %1: !HLFHE.eint<7> } )XXX"); - mlir::zamalang::IntLambdaArgument<> ila1(1); - mlir::zamalang::IntLambdaArgument<> ila2(2); - mlir::zamalang::IntLambdaArgument<> ila7(7); - mlir::zamalang::IntLambdaArgument<> ila9(9); + mlir::concretelang::IntLambdaArgument<> ila1(1); + mlir::concretelang::IntLambdaArgument<> ila2(2); + mlir::concretelang::IntLambdaArgument<> ila7(7); + mlir::concretelang::IntLambdaArgument<> ila9(9); ASSERT_EXPECTED_VALUE(lambda({&ila1, &ila2}), 3); ASSERT_EXPECTED_VALUE(lambda({&ila7, &ila9}), 16); @@ -43,28 +43,28 @@ func @main(%arg0: !HLFHE.eint<7>, %arg1: !HLFHE.eint<7>) -> !HLFHE.eint<7> { // Same as CompileAndRunHLFHE::add_eint above, but using // `LambdaArgument` instances as arguments and as a result type TEST(CompileAndRunHLFHE, add_eint_lambda_argument_res) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%arg0: !HLFHE.eint<7>, %arg1: !HLFHE.eint<7>) -> !HLFHE.eint<7> { %1 = "HLFHE.add_eint"(%arg0, %arg1): (!HLFHE.eint<7>, !HLFHE.eint<7>) -> (!HLFHE.eint<7>) return %1: !HLFHE.eint<7> } )XXX"); - mlir::zamalang::IntLambdaArgument<> ila1(1); - mlir::zamalang::IntLambdaArgument<> ila2(2); - mlir::zamalang::IntLambdaArgument<> ila7(7); - mlir::zamalang::IntLambdaArgument<> ila9(9); + mlir::concretelang::IntLambdaArgument<> ila1(1); + mlir::concretelang::IntLambdaArgument<> ila2(2); + mlir::concretelang::IntLambdaArgument<> ila7(7); + mlir::concretelang::IntLambdaArgument<> ila9(9); - auto eval = [&](mlir::zamalang::IntLambdaArgument<> &arg0, - mlir::zamalang::IntLambdaArgument<> &arg1, + auto eval = [&](mlir::concretelang::IntLambdaArgument<> &arg0, + mlir::concretelang::IntLambdaArgument<> &arg1, uint64_t expected) { - llvm::Expected> res0 = - lambda.operator()>( + llvm::Expected> res0 = + lambda.operator()>( {&arg0, &arg1}); ASSERT_EXPECTED_SUCCESS(res0); - ASSERT_TRUE((*res0)->isa>()); - ASSERT_EQ((*res0)->cast>().getValue(), + ASSERT_TRUE((*res0)->isa>()); + ASSERT_EQ((*res0)->cast>().getValue(), expected); }; @@ -76,7 +76,7 @@ func @main(%arg0: !HLFHE.eint<7>, %arg1: !HLFHE.eint<7>) -> !HLFHE.eint<7> { } TEST(CompileAndRunHLFHE, neg_eint) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> { %1 = "HLFHE.neg_eint"(%arg0): (!HLFHE.eint<7>) -> (!HLFHE.eint<7>) return %1: !HLFHE.eint<7> @@ -91,7 +91,7 @@ func @main(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> { // Same as CompileAndRunHLFHE::neg_eint above, but using 3 bits TEST(CompileAndRunHLFHE, neg_eint_3bits) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%arg0: !HLFHE.eint<3>) -> !HLFHE.eint<3> { %1 = "HLFHE.neg_eint"(%arg0): (!HLFHE.eint<3>) -> (!HLFHE.eint<3>) return %1: !HLFHE.eint<3> @@ -107,18 +107,18 @@ func @main(%arg0: !HLFHE.eint<3>) -> !HLFHE.eint<3> { // Same as CompileAndRunHLFHE::neg_eint above, but using // `LambdaArgument` instances as arguments TEST(CompileAndRunHLFHE, neg_eint_lambda_argument) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> { %1 = "HLFHE.neg_eint"(%arg0): (!HLFHE.eint<7>) -> (!HLFHE.eint<7>) return %1: !HLFHE.eint<7> } )XXX"); - mlir::zamalang::IntLambdaArgument<> ila0(0); - mlir::zamalang::IntLambdaArgument<> ila2(2); - mlir::zamalang::IntLambdaArgument<> ila7(7); - mlir::zamalang::IntLambdaArgument<> ila150(150); - mlir::zamalang::IntLambdaArgument<> ila249(249); + mlir::concretelang::IntLambdaArgument<> ila0(0); + mlir::concretelang::IntLambdaArgument<> ila2(2); + mlir::concretelang::IntLambdaArgument<> ila7(7); + mlir::concretelang::IntLambdaArgument<> ila150(150); + mlir::concretelang::IntLambdaArgument<> ila249(249); ASSERT_EXPECTED_VALUE(lambda({&ila0}), 0); ASSERT_EXPECTED_VALUE(lambda({&ila2}), 254); @@ -130,27 +130,27 @@ func @main(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> { // Same as CompileAndRunHLFHE::neg_eint above, but using // `LambdaArgument` instances as arguments and as a result type TEST(CompileAndRunHLFHE, neg_eint_lambda_argument_res) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> { %1 = "HLFHE.neg_eint"(%arg0): (!HLFHE.eint<7>) -> (!HLFHE.eint<7>) return %1: !HLFHE.eint<7> } )XXX"); - mlir::zamalang::IntLambdaArgument<> ila1(1); - mlir::zamalang::IntLambdaArgument<> ila2(2); - mlir::zamalang::IntLambdaArgument<> ila7(7); - mlir::zamalang::IntLambdaArgument<> ila9(9); + mlir::concretelang::IntLambdaArgument<> ila1(1); + mlir::concretelang::IntLambdaArgument<> ila2(2); + mlir::concretelang::IntLambdaArgument<> ila7(7); + mlir::concretelang::IntLambdaArgument<> ila9(9); - auto eval = [&](mlir::zamalang::IntLambdaArgument<> &arg0, + auto eval = [&](mlir::concretelang::IntLambdaArgument<> &arg0, uint64_t expected) { - llvm::Expected> res0 = - lambda.operator()>( + llvm::Expected> res0 = + lambda.operator()>( {&arg0}); ASSERT_EXPECTED_SUCCESS(res0); - ASSERT_TRUE((*res0)->isa>()); - ASSERT_EQ((*res0)->cast>().getValue(), + ASSERT_TRUE((*res0)->isa>()); + ASSERT_EQ((*res0)->cast>().getValue(), expected); }; @@ -161,7 +161,7 @@ func @main(%arg0: !HLFHE.eint<7>) -> !HLFHE.eint<7> { } TEST(CompileAndRunHLFHE, add_u64) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%arg0: i64, %arg1: i64) -> i64 { %1 = arith.addi %arg0, %arg1 : i64 return %1: i64 @@ -175,7 +175,7 @@ func @main(%arg0: i64, %arg1: i64) -> i64 { } TEST(CompileAndRunTensorStd, extract_64) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10xi64>, %i: index) -> i64{ %c = tensor.extract %t[%i] : tensor<10xi64> return %c : i64 @@ -199,7 +199,7 @@ func @main(%t: tensor<10xi64>, %i: index) -> i64{ } TEST(CompileAndRunTensorStd, extract_32) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10xi32>, %i: index) -> i32{ %c = tensor.extract %t[%i] : tensor<10xi32> return %c : i32 @@ -216,7 +216,7 @@ func @main(%t: tensor<10xi32>, %i: index) -> i32{ // Same as `CompileAndRunTensorStd::extract_32` above, but using // `LambdaArgument` instances as arguments TEST(CompileAndRunTensorStd, extract_32_lambda_argument) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10xi32>, %i: index) -> i32{ %c = tensor.extract %t[%i] : tensor<10xi32> return %c : i32 @@ -226,18 +226,18 @@ func @main(%t: tensor<10xi32>, %i: index) -> i32{ static std::vector t_arg{0xFFFFFFFF, 0, 8978, 2587490, 90, 197864, 698735, 72132, 87474, 42}; - mlir::zamalang::TensorLambdaArgument< - mlir::zamalang::IntLambdaArgument> + mlir::concretelang::TensorLambdaArgument< + mlir::concretelang::IntLambdaArgument> tla(t_arg); for (size_t i = 0; i < ARRAY_SIZE(t_arg); i++) { - mlir::zamalang::IntLambdaArgument idx(i); + mlir::concretelang::IntLambdaArgument idx(i); ASSERT_EXPECTED_VALUE(lambda({&tla, &idx}), t_arg[i]); } } TEST(CompileAndRunTensorStd, extract_16) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10xi16>, %i: index) -> i16{ %c = tensor.extract %t[%i] : tensor<10xi16> return %c : i16 @@ -253,7 +253,7 @@ func @main(%t: tensor<10xi16>, %i: index) -> i16{ } TEST(CompileAndRunTensorStd, extract_8) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10xi8>, %i: index) -> i8{ %c = tensor.extract %t[%i] : tensor<10xi8> return %c : i8 @@ -268,7 +268,7 @@ func @main(%t: tensor<10xi8>, %i: index) -> i8{ } TEST(CompileAndRunTensorStd, extract_5) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10xi5>, %i: index) -> i5{ %c = tensor.extract %t[%i] : tensor<10xi5> return %c : i5 @@ -283,7 +283,7 @@ func @main(%t: tensor<10xi5>, %i: index) -> i5{ } TEST(CompileAndRunTensorStd, extract_1) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10xi1>, %i: index) -> i1{ %c = tensor.extract %t[%i] : tensor<10xi1> return %c : i1 @@ -298,7 +298,7 @@ func @main(%t: tensor<10xi1>, %i: index) -> i1{ } TEST(CompileAndRunTensorEncrypted, extract_5) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10x!HLFHE.eint<5>>, %i: index) -> !HLFHE.eint<5>{ %c = tensor.extract %t[%i] : tensor<10x!HLFHE.eint<5>> return %c : !HLFHE.eint<5> @@ -312,7 +312,7 @@ func @main(%t: tensor<10x!HLFHE.eint<5>>, %i: index) -> !HLFHE.eint<5>{ } TEST(CompileAndRunTensorEncrypted, extract_twice_and_add_5) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10x!HLFHE.eint<5>>, %i: index, %j: index) -> !HLFHE.eint<5>{ %ti = tensor.extract %t[%i] : tensor<10x!HLFHE.eint<5>> @@ -331,7 +331,7 @@ func @main(%t: tensor<10x!HLFHE.eint<5>>, %i: index, %j: index) -> } TEST(CompileAndRunTensorEncrypted, dim_5) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%t: tensor<10x!HLFHE.eint<5>>) -> index{ %c0 = arith.constant 0 : index %c = tensor.dim %t, %c0 : tensor<10x!HLFHE.eint<5>> @@ -344,7 +344,7 @@ func @main(%t: tensor<10x!HLFHE.eint<5>>) -> index{ } TEST(CompileAndRunTensorEncrypted, from_elements_5) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%0: !HLFHE.eint<5>) -> tensor<1x!HLFHE.eint<5>> { %t = tensor.from_elements %0 : tensor<1x!HLFHE.eint<5>> return %t: tensor<1x!HLFHE.eint<5>> @@ -362,28 +362,28 @@ func @main(%0: !HLFHE.eint<5>) -> tensor<1x!HLFHE.eint<5>> { // Same as `CompileAndRunTensorEncrypted::from_elements_5 but with // `LambdaArgument` instances as arguments and as a result type TEST(CompileAndRunTensorEncrypted, from_elements_5_lambda_argument_res) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%0: !HLFHE.eint<5>) -> tensor<1x!HLFHE.eint<5>> { %t = tensor.from_elements %0 : tensor<1x!HLFHE.eint<5>> return %t: tensor<1x!HLFHE.eint<5>> } )XXX"); - mlir::zamalang::IntLambdaArgument<> arg(10); + mlir::concretelang::IntLambdaArgument<> arg(10); - llvm::Expected> res = - lambda.operator()>( + llvm::Expected> res = + lambda.operator()>( {&arg}); ASSERT_EXPECTED_SUCCESS(res); ASSERT_TRUE((*res) - ->isa>>()); + ->isa>>()); - mlir::zamalang::TensorLambdaArgument> + mlir::concretelang::TensorLambdaArgument> &resp = (*res) - ->cast>>(); + ->cast>>(); ASSERT_EQ(resp.getDimensions().size(), (size_t)1); ASSERT_EQ(resp.getDimensions().at(0), 1); @@ -392,7 +392,7 @@ func @main(%0: !HLFHE.eint<5>) -> tensor<1x!HLFHE.eint<5>> { } TEST(CompileAndRunTensorEncrypted, in_out_tensor_with_op_5) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%in: tensor<2x!HLFHE.eint<5>>) -> tensor<3x!HLFHE.eint<5>> { %c_0 = arith.constant 0 : index %c_1 = arith.constant 1 : index @@ -421,7 +421,7 @@ func @main(%in: tensor<2x!HLFHE.eint<5>>) -> tensor<3x!HLFHE.eint<5>> { } TEST(CompileAndRunTensorEncrypted, linalg_generic) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( #map0 = affine_map<(d0) -> (d0)> #map1 = affine_map<(d0) -> (0)> func @main(%arg0: tensor<2x!HLFHE.eint<7>>, %arg1: tensor<2xi8>, %acc: @@ -472,7 +472,7 @@ TEST_P(CompileAndRunWithPrecision, identity_func) { << "return %1: !HLFHE.eint<" << precision << ">\n" << "}\n"; - mlir::zamalang::JitCompilerEngine::Lambda lambda = + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(mlirProgram.str()); if (precision >= 6) { @@ -503,7 +503,7 @@ INSTANTIATE_TEST_SUITE_P(TestHLFHEApplyLookupTable, CompileAndRunWithPrecision, ::testing::Values(1, 2, 3, 4, 5, 6, 7)); TEST(TestHLFHEApplyLookupTable, multiple_precision) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%arg0: !HLFHE.eint<6>, %arg1: !HLFHE.eint<3>) -> !HLFHE.eint<6> { %tlu_7 = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]> : tensor<64xi64> %tlu_3 = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7]> : tensor<8xi64> @@ -518,7 +518,7 @@ func @main(%arg0: !HLFHE.eint<6>, %arg1: !HLFHE.eint<3>) -> !HLFHE.eint<6> { } TEST(CompileAndRunTLU, random_func) { - mlir::zamalang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( + mlir::concretelang::JitCompilerEngine::Lambda lambda = checkedJit(R"XXX( func @main(%arg0: !HLFHE.eint<6>) -> !HLFHE.eint<6> { %tlu = arith.constant dense<[16, 91, 16, 83, 80, 74, 21, 96, 1, 63, 49, 122, 76, 89, 74, 55, 109, 110, 103, 54, 105, 14, 66, 47, 52, 89, 7, 10, 73, 44, 119, 92, 25, 104, 123, 100, 108, 86, 29, 121, 118, 52, 107, 48, 34, 37, 13, 122, 107, 48, 74, 59, 96, 36, 50, 55, 120, 72, 27, 45, 12, 5, 96, 12]> : tensor<64xi64> %1 = "HLFHE.apply_lookup_table"(%arg0, %tlu): (!HLFHE.eint<6>, tensor<64xi64>) -> (!HLFHE.eint<6>) diff --git a/compiler/tests/unittest/end_to_end_jit_test.h b/compiler/tests/unittest/end_to_end_jit_test.h index 57d65bda7..18c774d07 100644 --- a/compiler/tests/unittest/end_to_end_jit_test.h +++ b/compiler/tests/unittest/end_to_end_jit_test.h @@ -3,9 +3,9 @@ #include -#include "zamalang/Support/CompilerEngine.h" -#include "zamalang/Support/JitCompilerEngine.h" -#include "zamalang/Support/KeySetCache.h" +#include "concretelang/Support/CompilerEngine.h" +#include "concretelang/Support/JitCompilerEngine.h" +#include "concretelang/Support/KeySetCache.h" #include "llvm/Support/Path.h" #include "globals.h" @@ -97,7 +97,7 @@ static bool assert_expected_value(llvm::Expected &&val, const V &exp) { // returns the corresponding lambda. Any compilation errors are caught // and reult in abnormal termination. template -mlir::zamalang::JitCompilerEngine::Lambda +mlir::concretelang::JitCompilerEngine::Lambda internalCheckedJit(F checkFunc, llvm::StringRef src, llvm::StringRef func = "main", bool useDefaultFHEConstraints = false, @@ -110,20 +110,20 @@ internalCheckedJit(F checkFunc, llvm::StringRef src, llvm::sys::path::append(cachePath, "KeySetCache"); auto cachePathStr = std::string(cachePath); - auto optCache = llvm::Optional( - mlir::zamalang::KeySetCache(cachePathStr)); + auto optCache = llvm::Optional( + mlir::concretelang::KeySetCache(cachePathStr)); - mlir::zamalang::JitCompilerEngine engine; + mlir::concretelang::JitCompilerEngine engine; if (useDefaultFHEConstraints) engine.setFHEConstraints(defaultV0Constraints); -#ifdef ZAMALANG_PARALLEL_TESTING_ENABLED +#ifdef CONCRETELANG_PARALLEL_TESTING_ENABLED engine.setAutoParallelize(true); #else engine.setAutoParallelize(autoParallelize); #endif - llvm::Expected lambdaOrErr = + llvm::Expected lambdaOrErr = engine.buildLambda(src, func, optCache); if (!lambdaOrErr) { @@ -149,7 +149,7 @@ static inline uint64_t operator"" _u64(unsigned long long int v) { return v; } // caller instead of `internalCheckedJit`. #define checkedJit(...) \ internalCheckedJit( \ - [](llvm::Expected &lambda) { \ + [](llvm::Expected &lambda) { \ ASSERT_EXPECTED_SUCCESS(lambda); \ }, \ __VA_ARGS__) diff --git a/compiler/tests/unittest/globals.cc b/compiler/tests/unittest/globals.cc index d1bc1c5e2..f42feaf59 100644 --- a/compiler/tests/unittest/globals.cc +++ b/compiler/tests/unittest/globals.cc @@ -1,3 +1,3 @@ #include "globals.h" -const mlir::zamalang::V0FHEConstraint defaultV0Constraints{10, 7}; +const mlir::concretelang::V0FHEConstraint defaultV0Constraints{10, 7}; diff --git a/compiler/tests/unittest/globals.h b/compiler/tests/unittest/globals.h index 2d7735951..d30598874 100644 --- a/compiler/tests/unittest/globals.h +++ b/compiler/tests/unittest/globals.h @@ -1,3 +1,3 @@ -#include +#include -extern const mlir::zamalang::V0FHEConstraint defaultV0Constraints; +extern const mlir::concretelang::V0FHEConstraint defaultV0Constraints;