From f5dc1b3ffdcf9d4a3a0ecf231912a1a9510b5ab6 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Tue, 20 Aug 2024 11:14:52 +0200 Subject: [PATCH 01/10] Use rustflags for witness_generator compilation --- .github/workflows/build-prover-template.yml | 12 +++++++++++- docker/witness-generator/Dockerfile | 2 ++ infrastructure/zk/src/docker.ts | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-prover-template.yml b/.github/workflows/build-prover-template.yml index 25bf14728dd6..232969e947cb 100644 --- a/.github/workflows/build-prover-template.yml +++ b/.github/workflows/build-prover-template.yml @@ -32,6 +32,11 @@ on: type: string default: "89" required: false + WITNESS_GENERATOR_RUST_FLAGS: + description: "Rust flags for witness_generator compilation" + type: string + default: "" + required: false outputs: protocol_version: description: "Protocol version of the binary" @@ -69,6 +74,11 @@ jobs: echo CI=1 >> .env echo IN_DOCKER=1 >> .env + - name: setup-rust-flags-env + if: matrix.component == 'witness-generator' + run: | + echo RUST_FLAGS=$WITNESS_GENERATOR_RUST_FLAGS >> $GITHUB_ENV + - name: start-services run: | echo "IMAGE_TAG_SUFFIX=${{ env.IMAGE_TAG_SUFFIX }}" >> .env @@ -155,7 +165,7 @@ jobs: DOCKER_ACTION: ${{ inputs.action }} COMPONENT: ${{ matrix.component }} run: | - PASSED_ENV_VARS="ERA_BELLMAN_CUDA_RELEASE,CUDA_ARCH,PROTOCOL_VERSION" \ + PASSED_ENV_VARS="ERA_BELLMAN_CUDA_RELEASE,CUDA_ARCH,PROTOCOL_VERSION,RUST_FLAGS" \ ci_run zk docker $DOCKER_ACTION $COMPONENT - name: Show sccache stats diff --git a/docker/witness-generator/Dockerfile b/docker/witness-generator/Dockerfile index 3f8affbd2a9b..4f7c00aa2ef9 100644 --- a/docker/witness-generator/Dockerfile +++ b/docker/witness-generator/Dockerfile @@ -1,6 +1,8 @@ FROM matterlabs/zksync-build-base:latest AS builder ARG DEBIAN_FRONTEND=noninteractive +ARG RUST_FLAGS="" +ENV RUSTFLAGS=${RUST_FLAGS} WORKDIR /usr/src/zksync COPY . . diff --git a/infrastructure/zk/src/docker.ts b/infrastructure/zk/src/docker.ts index 6cf3e3563938..74dd249a0b81 100644 --- a/infrastructure/zk/src/docker.ts +++ b/infrastructure/zk/src/docker.ts @@ -116,6 +116,10 @@ async function _build(image: string, tagList: string[], dockerOrg: string, platf const cudaArch = process.env.CUDA_ARCH; buildArgs += `--build-arg CUDA_ARCH='${cudaArch}' `; } + if (image === 'witness-generator') { + const rustFlags = process.env.RUST_FLAGS; + buildArgs += `--build-arg RUST_FLAGS='${rustFlags}' `; + } buildArgs += extraArgs; const buildCommand = From 6aae2770f89027128f841e55a5022623695c6215 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Tue, 20 Aug 2024 11:15:48 +0200 Subject: [PATCH 02/10] Test in CI --- .github/workflows/build-prover-template.yml | 11 ++++++----- .github/workflows/ci.yml | 1 + infrastructure/zk/src/docker.ts | 4 +++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-prover-template.yml b/.github/workflows/build-prover-template.yml index 232969e947cb..0905ffd515a3 100644 --- a/.github/workflows/build-prover-template.yml +++ b/.github/workflows/build-prover-template.yml @@ -50,6 +50,7 @@ jobs: RUNNER_COMPOSE_FILE: "docker-compose-runner-nightly.yml" ERA_BELLMAN_CUDA_RELEASE: ${{ inputs.ERA_BELLMAN_CUDA_RELEASE }} CUDA_ARCH: ${{ inputs.CUDA_ARCH }} + WITNESS_GENERATOR_RUST_FLAGS: ${{ inputs.WITNESS_GENERATOR_RUST_FLAGS }} runs-on: [ matterlabs-ci-runner ] strategy: matrix: @@ -74,11 +75,6 @@ jobs: echo CI=1 >> .env echo IN_DOCKER=1 >> .env - - name: setup-rust-flags-env - if: matrix.component == 'witness-generator' - run: | - echo RUST_FLAGS=$WITNESS_GENERATOR_RUST_FLAGS >> $GITHUB_ENV - - name: start-services run: | echo "IMAGE_TAG_SUFFIX=${{ env.IMAGE_TAG_SUFFIX }}" >> .env @@ -160,6 +156,11 @@ jobs: echo "protocol_version=${PPV}" >> $GITHUB_OUTPUT echo "PROTOCOL_VERSION=${PPV}" >> $GITHUB_ENV + - name: setup-rust-flags-env + if: matrix.component == 'witness-generator' + run: | + echo RUST_FLAGS="${{ env.WITNESS_GENERATOR_RUST_FLAGS }}" >> $GITHUB_ENV + - name: update-images env: DOCKER_ACTION: ${{ inputs.action }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd5bbd7ed617..b40b3103625b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -162,6 +162,7 @@ jobs: action: "build" ERA_BELLMAN_CUDA_RELEASE: ${{ vars.ERA_BELLMAN_CUDA_RELEASE }} is_pr_from_fork: ${{ github.event.pull_request.head.repo.fork == true }} + WITNESS_GENERATOR_RUST_FLAGS: "-Ctarget-cpu=znver4" secrets: DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/infrastructure/zk/src/docker.ts b/infrastructure/zk/src/docker.ts index 74dd249a0b81..76576fd243cb 100644 --- a/infrastructure/zk/src/docker.ts +++ b/infrastructure/zk/src/docker.ts @@ -118,7 +118,9 @@ async function _build(image: string, tagList: string[], dockerOrg: string, platf } if (image === 'witness-generator') { const rustFlags = process.env.RUST_FLAGS; - buildArgs += `--build-arg RUST_FLAGS='${rustFlags}' `; + if (rustFlags) { + buildArgs += `--build-arg RUST_FLAGS='${rustFlags}' `; + } } buildArgs += extraArgs; From 74a50fca79ea845ac508b4dcf1efa0cca18ac842 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Tue, 20 Aug 2024 14:33:36 +0200 Subject: [PATCH 03/10] Update avx512 config --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b40b3103625b..945f9765fb24 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -162,7 +162,7 @@ jobs: action: "build" ERA_BELLMAN_CUDA_RELEASE: ${{ vars.ERA_BELLMAN_CUDA_RELEASE }} is_pr_from_fork: ${{ github.event.pull_request.head.repo.fork == true }} - WITNESS_GENERATOR_RUST_FLAGS: "-Ctarget-cpu=znver4" + WITNESS_GENERATOR_RUST_FLAGS: "-Ctarget_feature=+avx512bw,+avx512cd,avx512dq,avx512f,avx512vl" secrets: DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} From d44e41c35740420f15dffc68198d399b69e64289 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Tue, 20 Aug 2024 14:50:32 +0200 Subject: [PATCH 04/10] Add separate workflow for avx512 version --- .github/workflows/build-docker-from-tag.yml | 14 ++ .../build-prover-avx512-template.yml | 207 ++++++++++++++++++ .github/workflows/ci.yml | 13 ++ 3 files changed, 234 insertions(+) create mode 100644 .github/workflows/build-prover-avx512-template.yml diff --git a/.github/workflows/build-docker-from-tag.yml b/.github/workflows/build-docker-from-tag.yml index e216a113693b..c40058ab610c 100644 --- a/.github/workflows/build-docker-from-tag.yml +++ b/.github/workflows/build-docker-from-tag.yml @@ -94,6 +94,20 @@ jobs: DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + build-push-prover-images-avx512: + name: Build and push image + needs: [setup] + uses: ./.github/workflows/build-prover-template.yml + if: contains(github.ref_name, 'prover') + with: + image_tag_suffix: ${{ needs.setup.outputs.image_tag_suffix }}-avx512 + ERA_BELLMAN_CUDA_RELEASE: ${{ vars.ERA_BELLMAN_CUDA_RELEASE }} + CUDA_ARCH: "60;70;75;89" + WITNESS_GENERATOR_RUST_FLAGS: "-Ctarget_feature=+avx512bw,+avx512cd,avx512dq,avx512f,avx512vl" + secrets: + DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + build-gar-prover-fri-gpu: name: Build GAR prover FRI GPU needs: [setup, build-push-prover-images] diff --git a/.github/workflows/build-prover-avx512-template.yml b/.github/workflows/build-prover-avx512-template.yml new file mode 100644 index 000000000000..1910df594e34 --- /dev/null +++ b/.github/workflows/build-prover-avx512-template.yml @@ -0,0 +1,207 @@ +name: Build Prover images with avx512 +on: + workflow_call: + secrets: + DOCKERHUB_USER: + description: "DOCKERHUB_USER" + required: true + DOCKERHUB_TOKEN: + description: "DOCKERHUB_TOKEN" + required: true + inputs: + ERA_BELLMAN_CUDA_RELEASE: + description: "ERA_BELLMAN_CUDA_RELEASE" + type: string + required: true + image_tag_suffix: + description: "Optional suffix to override tag name generation" + type: string + required: false + action: + description: "Action with docker image" + type: string + default: "push" + required: false + is_pr_from_fork: + description: "Indicates whether the workflow is invoked from a PR created from fork" + type: boolean + default: false + required: false + CUDA_ARCH: + description: "CUDA Arch to build" + type: string + default: "89" + required: false + WITNESS_GENERATOR_RUST_FLAGS: + description: "Rust flags for witness_generator compilation" + type: string + default: "" + required: false + outputs: + protocol_version: + description: "Protocol version of the binary" + value: ${{ jobs.build-images.outputs.protocol_version }} + +jobs: + build-images: + name: Build and Push Docker Images + env: + IMAGE_TAG_SUFFIX: ${{ inputs.image_tag_suffix }} + RUNNER_COMPOSE_FILE: "docker-compose-runner-nightly.yml" + ERA_BELLMAN_CUDA_RELEASE: ${{ inputs.ERA_BELLMAN_CUDA_RELEASE }} + CUDA_ARCH: ${{ inputs.CUDA_ARCH }} + WITNESS_GENERATOR_RUST_FLAGS: ${{ inputs.WITNESS_GENERATOR_RUST_FLAGS }} + runs-on: [ matterlabs-ci-runner ] + strategy: + matrix: + component: + - witness-generator + outputs: + protocol_version: ${{ steps.protocolversion.outputs.protocol_version }} + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 + with: + submodules: "recursive" + + - name: setup-env + run: | + echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV + echo CI=1 >> $GITHUB_ENV + echo $(pwd)/bin >> $GITHUB_PATH + echo CI=1 >> .env + echo IN_DOCKER=1 >> .env + + - name: start-services + run: | + echo "IMAGE_TAG_SUFFIX=${{ env.IMAGE_TAG_SUFFIX }}" >> .env + mkdir -p ./volumes/postgres + run_retried docker compose pull zk postgres + docker compose up -d zk postgres + ci_run sccache --start-server + + - name: init + run: | + ci_run git config --global --add safe.directory /usr/src/zksync + ci_run git config --global --add safe.directory /usr/src/zksync/contracts/system-contracts + ci_run git config --global --add safe.directory /usr/src/zksync/contracts + ci_run zk + + - name: download CRS for GPU compressor + if: matrix.component == 'proof-fri-gpu-compressor' + run: | + ci_run run_retried curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^24.key + + + - name: login to Docker registries + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) + run: | + ci_run docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} + ci_run gcloud auth configure-docker us-docker.pkg.dev -q + + # We need to run this only when ERA_BELLMAN_CUDA_RELEASE is not available + # In our case it happens only when PR is created from fork + - name: Wait for runner IP to be not rate-limited against GH API + if: inputs.is_pr_from_fork == true + run: | + api_endpoint="https://api.github.com/users/zksync-era-bot" + wait_time=60 + max_retries=60 + retry_count=0 + + while [[ $retry_count -lt $max_retries ]]; do + response=$(run_retried curl -s -w "%{http_code}" -o temp.json "$api_endpoint") + http_code=$(echo "$response" | tail -n1) + + if [[ "$http_code" == "200" ]]; then + echo "Request successful. Not rate-limited." + cat temp.json + rm temp.json + exit 0 + elif [[ "$http_code" == "403" ]]; then + rate_limit_exceeded=$(jq -r '.message' temp.json | grep -i "API rate limit exceeded") + if [[ -n "$rate_limit_exceeded" ]]; then + retry_count=$((retry_count+1)) + echo "API rate limit exceeded. Retry $retry_count of $max_retries. Retrying in $wait_time seconds..." + sleep $wait_time + else + echo "Request failed with HTTP status $http_code." + cat temp.json + rm temp.json + exit 1 + fi + else + echo "Request failed with HTTP status $http_code." + cat temp.json + rm temp.json + exit 1 + fi + done + + echo "Reached the maximum number of retries ($max_retries). Exiting." + rm temp.json + exit 1 + + - name: protocol-version + id: protocolversion + # TODO: use -C flag, when it will become stable. + shell: bash + run: | + ci_run bash -c "cd prover && cargo build --release --bin prover_version" + PPV=$(ci_run prover/target/release/prover_version) + echo Protocol version is ${PPV} + echo "protocol_version=${PPV}" >> $GITHUB_OUTPUT + echo "PROTOCOL_VERSION=${PPV}" >> $GITHUB_ENV + + - name: setup-rust-flags-env + if: matrix.component == 'witness-generator' + run: | + echo RUST_FLAGS="${{ env.WITNESS_GENERATOR_RUST_FLAGS }}" >> $GITHUB_ENV + + - name: update-images + env: + DOCKER_ACTION: ${{ inputs.action }} + COMPONENT: ${{ matrix.component }} + run: | + PASSED_ENV_VARS="ERA_BELLMAN_CUDA_RELEASE,CUDA_ARCH,PROTOCOL_VERSION,RUST_FLAGS" \ + ci_run zk docker $DOCKER_ACTION $COMPONENT + + - name: Show sccache stats + if: always() + run: | + ci_run sccache --show-stats || true + ci_run cat /tmp/sccache_log.txt || true + + copy-images: + name: Copy images between docker registries + needs: build-images + env: + IMAGE_TAG_SUFFIX: ${{ inputs.image_tag_suffix }} + PROTOCOL_VERSION: ${{ needs.build-images.outputs.protocol_version }} + runs-on: matterlabs-ci-runner + if: ${{ inputs.action == 'push' }} + strategy: + matrix: + component: + - witness-vector-generator + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to us-central1 GAR + run: | + gcloud auth print-access-token --lifetime=7200 --impersonate-service-account=gha-ci-runners@matterlabs-infra.iam.gserviceaccount.com | docker login -u oauth2accesstoken --password-stdin https://us-docker.pkg.dev + + - name: Login and push to Asia GAR + run: | + gcloud auth print-access-token --lifetime=7200 --impersonate-service-account=gha-ci-runners@matterlabs-infra.iam.gserviceaccount.com | docker login -u oauth2accesstoken --password-stdin https://asia-docker.pkg.dev + docker buildx imagetools create \ + --tag asia-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ needs.build-images.outputs.protocol_version }}-${{ inputs.image_tag_suffix }} \ + us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ needs.build-images.outputs.protocol_version }}-${{ inputs.image_tag_suffix }} + + - name: Login and push to Europe GAR + run: | + gcloud auth print-access-token --lifetime=7200 --impersonate-service-account=gha-ci-runners@matterlabs-infra.iam.gserviceaccount.com | docker login -u oauth2accesstoken --password-stdin https://europe-docker.pkg.dev + docker buildx imagetools create \ + --tag europe-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ needs.build-images.outputs.protocol_version }}-${{ inputs.image_tag_suffix }} \ + us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ needs.build-images.outputs.protocol_version }}-${{ inputs.image_tag_suffix }} + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 945f9765fb24..2189082d5c89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -162,6 +162,19 @@ jobs: action: "build" ERA_BELLMAN_CUDA_RELEASE: ${{ vars.ERA_BELLMAN_CUDA_RELEASE }} is_pr_from_fork: ${{ github.event.pull_request.head.repo.fork == true }} + secrets: + DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + + build-push-prover-images-avx512: + name: Build prover images with avx512 instructions + needs: [setup] + uses: ./.github/workflows/build-prover-template.yml + if: contains(github.ref_name, 'prover') + with: + image_tag_suffix: ${{ needs.setup.outputs.image_tag_suffix }}-avx512 + ERA_BELLMAN_CUDA_RELEASE: ${{ vars.ERA_BELLMAN_CUDA_RELEASE }} + CUDA_ARCH: "60;70;75;89" WITNESS_GENERATOR_RUST_FLAGS: "-Ctarget_feature=+avx512bw,+avx512cd,avx512dq,avx512f,avx512vl" secrets: DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} From 6d8f173a5f2cee32188b2af2018a8d7e0000d4ba Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Tue, 20 Aug 2024 14:52:09 +0200 Subject: [PATCH 05/10] Remove unused input from build-prover-template --- .github/workflows/build-prover-template.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-prover-template.yml b/.github/workflows/build-prover-template.yml index 0905ffd515a3..2f14d105a34f 100644 --- a/.github/workflows/build-prover-template.yml +++ b/.github/workflows/build-prover-template.yml @@ -31,12 +31,7 @@ on: description: "CUDA Arch to build" type: string default: "89" - required: false - WITNESS_GENERATOR_RUST_FLAGS: - description: "Rust flags for witness_generator compilation" - type: string - default: "" - required: false + required: false outputs: protocol_version: description: "Protocol version of the binary" @@ -50,7 +45,6 @@ jobs: RUNNER_COMPOSE_FILE: "docker-compose-runner-nightly.yml" ERA_BELLMAN_CUDA_RELEASE: ${{ inputs.ERA_BELLMAN_CUDA_RELEASE }} CUDA_ARCH: ${{ inputs.CUDA_ARCH }} - WITNESS_GENERATOR_RUST_FLAGS: ${{ inputs.WITNESS_GENERATOR_RUST_FLAGS }} runs-on: [ matterlabs-ci-runner ] strategy: matrix: @@ -156,17 +150,12 @@ jobs: echo "protocol_version=${PPV}" >> $GITHUB_OUTPUT echo "PROTOCOL_VERSION=${PPV}" >> $GITHUB_ENV - - name: setup-rust-flags-env - if: matrix.component == 'witness-generator' - run: | - echo RUST_FLAGS="${{ env.WITNESS_GENERATOR_RUST_FLAGS }}" >> $GITHUB_ENV - - name: update-images env: DOCKER_ACTION: ${{ inputs.action }} COMPONENT: ${{ matrix.component }} run: | - PASSED_ENV_VARS="ERA_BELLMAN_CUDA_RELEASE,CUDA_ARCH,PROTOCOL_VERSION,RUST_FLAGS" \ + PASSED_ENV_VARS="ERA_BELLMAN_CUDA_RELEASE,CUDA_ARCH,PROTOCOL_VERSION" \ ci_run zk docker $DOCKER_ACTION $COMPONENT - name: Show sccache stats From a88fff897d4ccaa56083b0ceedf46647b4d039d4 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Tue, 20 Aug 2024 14:53:07 +0200 Subject: [PATCH 06/10] Fmt --- .github/workflows/build-prover-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-prover-template.yml b/.github/workflows/build-prover-template.yml index 2f14d105a34f..25bf14728dd6 100644 --- a/.github/workflows/build-prover-template.yml +++ b/.github/workflows/build-prover-template.yml @@ -31,7 +31,7 @@ on: description: "CUDA Arch to build" type: string default: "89" - required: false + required: false outputs: protocol_version: description: "Protocol version of the binary" From d686e52104709f3d5563e40f9b2cf2d2635b59a9 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Tue, 20 Aug 2024 16:00:12 +0200 Subject: [PATCH 07/10] Update workflows --- .github/workflows/build-docker-from-tag.yml | 4 ++-- ...x512-template.yml => build-witness-generator-template.yml} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename .github/workflows/{build-prover-avx512-template.yml => build-witness-generator-template.yml} (99%) diff --git a/.github/workflows/build-docker-from-tag.yml b/.github/workflows/build-docker-from-tag.yml index c40058ab610c..7c9c96ce2172 100644 --- a/.github/workflows/build-docker-from-tag.yml +++ b/.github/workflows/build-docker-from-tag.yml @@ -94,10 +94,10 @@ jobs: DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} - build-push-prover-images-avx512: + build-push-witness-generator-image-avx512: name: Build and push image needs: [setup] - uses: ./.github/workflows/build-prover-template.yml + uses: ./.github/workflows/build-witness-generator-template.yml if: contains(github.ref_name, 'prover') with: image_tag_suffix: ${{ needs.setup.outputs.image_tag_suffix }}-avx512 diff --git a/.github/workflows/build-prover-avx512-template.yml b/.github/workflows/build-witness-generator-template.yml similarity index 99% rename from .github/workflows/build-prover-avx512-template.yml rename to .github/workflows/build-witness-generator-template.yml index 1910df594e34..9b3c063fe20c 100644 --- a/.github/workflows/build-prover-avx512-template.yml +++ b/.github/workflows/build-witness-generator-template.yml @@ -1,4 +1,4 @@ -name: Build Prover images with avx512 +name: Build witness generator image with custom compiler flags on: workflow_call: secrets: From f621883c1dd086bd926259814e01f7a9f54baa28 Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Tue, 20 Aug 2024 16:01:20 +0200 Subject: [PATCH 08/10] Fix CI workflow --- .github/workflows/ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2189082d5c89..151e59242d5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,15 +166,16 @@ jobs: DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} - build-push-prover-images-avx512: + build-witness-generator-image-avx512: name: Build prover images with avx512 instructions - needs: [setup] - uses: ./.github/workflows/build-prover-template.yml - if: contains(github.ref_name, 'prover') + needs: changed_files + if: ${{ (needs.changed_files.outputs.prover == 'true' || needs.changed_files.outputs.all == 'true') && !contains(github.ref_name, 'release-please--branches') }} + uses: ./.github/workflows/build-witness-generator-template.yml with: image_tag_suffix: ${{ needs.setup.outputs.image_tag_suffix }}-avx512 + action: "build" ERA_BELLMAN_CUDA_RELEASE: ${{ vars.ERA_BELLMAN_CUDA_RELEASE }} - CUDA_ARCH: "60;70;75;89" + is_pr_from_fork: ${{ github.event.pull_request.head.repo.fork == true }} WITNESS_GENERATOR_RUST_FLAGS: "-Ctarget_feature=+avx512bw,+avx512cd,avx512dq,avx512f,avx512vl" secrets: DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} From b1ec6c683a4b3a1decb0a92dfbcd17add5294223 Mon Sep 17 00:00:00 2001 From: Yury Akudovich Date: Wed, 21 Aug 2024 14:11:27 +0200 Subject: [PATCH 09/10] Use matterlabs-ci-runner-c3d --- .github/workflows/build-witness-generator-template.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-witness-generator-template.yml b/.github/workflows/build-witness-generator-template.yml index 9b3c063fe20c..a7139e5e0a8c 100644 --- a/.github/workflows/build-witness-generator-template.yml +++ b/.github/workflows/build-witness-generator-template.yml @@ -36,7 +36,7 @@ on: description: "Rust flags for witness_generator compilation" type: string default: "" - required: false + required: false outputs: protocol_version: description: "Protocol version of the binary" @@ -51,7 +51,7 @@ jobs: ERA_BELLMAN_CUDA_RELEASE: ${{ inputs.ERA_BELLMAN_CUDA_RELEASE }} CUDA_ARCH: ${{ inputs.CUDA_ARCH }} WITNESS_GENERATOR_RUST_FLAGS: ${{ inputs.WITNESS_GENERATOR_RUST_FLAGS }} - runs-on: [ matterlabs-ci-runner ] + runs-on: [ matterlabs-ci-runner-c3d ] strategy: matrix: component: @@ -170,7 +170,7 @@ jobs: run: | ci_run sccache --show-stats || true ci_run cat /tmp/sccache_log.txt || true - + copy-images: name: Copy images between docker registries needs: build-images @@ -204,4 +204,3 @@ jobs: docker buildx imagetools create \ --tag europe-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ needs.build-images.outputs.protocol_version }}-${{ inputs.image_tag_suffix }} \ us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ needs.build-images.outputs.protocol_version }}-${{ inputs.image_tag_suffix }} - From 863d1ded47fbc6fe7de4373810df7aedf891e79b Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Wed, 21 Aug 2024 14:26:52 +0200 Subject: [PATCH 10/10] Fix target features --- .github/workflows/build-docker-from-tag.yml | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docker-from-tag.yml b/.github/workflows/build-docker-from-tag.yml index 7c9c96ce2172..cd222a6e43bb 100644 --- a/.github/workflows/build-docker-from-tag.yml +++ b/.github/workflows/build-docker-from-tag.yml @@ -103,7 +103,7 @@ jobs: image_tag_suffix: ${{ needs.setup.outputs.image_tag_suffix }}-avx512 ERA_BELLMAN_CUDA_RELEASE: ${{ vars.ERA_BELLMAN_CUDA_RELEASE }} CUDA_ARCH: "60;70;75;89" - WITNESS_GENERATOR_RUST_FLAGS: "-Ctarget_feature=+avx512bw,+avx512cd,avx512dq,avx512f,avx512vl" + WITNESS_GENERATOR_RUST_FLAGS: "-Ctarget_feature=+avx512bw,+avx512cd,+avx512dq,+avx512f,+avx512vl" secrets: DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 151e59242d5f..f8264d4466c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -176,7 +176,7 @@ jobs: action: "build" ERA_BELLMAN_CUDA_RELEASE: ${{ vars.ERA_BELLMAN_CUDA_RELEASE }} is_pr_from_fork: ${{ github.event.pull_request.head.repo.fork == true }} - WITNESS_GENERATOR_RUST_FLAGS: "-Ctarget_feature=+avx512bw,+avx512cd,avx512dq,avx512f,avx512vl" + WITNESS_GENERATOR_RUST_FLAGS: "-Ctarget_feature=+avx512bw,+avx512cd,+avx512dq,+avx512f,+avx512vl" secrets: DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}