Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Create workflow for full AVM tests #7051

Merged
merged 15 commits into from
Jun 19, 2024
60 changes: 60 additions & 0 deletions .github/workflows/vm_full_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: AVM Full Tests

on:
schedule:
- cron: "15 4 * * 1-5" # Monday to Friday at 4:15 AM UTC
workflow_dispatch:
inputs:
username:
description: "Username (optional)"
required: false
action:
description: "Default to 'start'"
required: false
default: "start"

concurrency:
# force parallelism in master
group: avm-full-tests-${{ github.ref }}
cancel-in-progress: true

env:
DOCKERHUB_PASSWORD: "${{ secrets.DOCKERHUB_PASSWORD }}"
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
USERNAME: ${{ github.event.pull_request.user.login || github.actor }}
GITHUB_TOKEN: ${{ github.token }}
GH_SELF_HOSTED_RUNNER_TOKEN: ${{ secrets.GH_SELF_HOSTED_RUNNER_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BUILD_INSTANCE_SSH_KEY: ${{ secrets.BUILD_INSTANCE_SSH_KEY }}
GIT_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
# kludge until we move away from runners
WAIT_FOR_RUNNERS: false

jobs:
setup:
uses: ./.github/workflows/setup-runner.yml
with:
username: ${{ github.event.pull_request.user.login || github.actor }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whose runner do we want this to run on? I guess right now it'd be github bot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ludamad Ok good point. How should I change this exactly?

Should I also change the argument in "runs-on" at line 47?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everywhere we consider the GitHub actor. You can see our e2e CI file as an example. We want to start the runner with the same flags as our runs on

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, the arm Ci as an example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for the pointer. I followed the arm CI template.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ludamad I had to revert the changes made after your feedback. Somehow the workflow did not leverage cache for build and I had 2 hours build for wasm and MacOSX. I tried to remove wasm dependencies in Earthfile without success. Therefore, I am going to merge this version.

runner_type: builder-x86
secrets: inherit

# barretenberg (prover) native and AVM (public VM) tests
# only ran on x86 for resource reasons (memory intensive)
avm-full-tests:
needs: [setup]
runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86
steps:
- uses: actions/checkout@v4
with: { ref: "${{ env.GIT_COMMIT }}" }
# Only allow one memory-hunger prover test to use this runner
- uses: ./.github/ci-setup-action
with:
# must be globally unique for build x runner
concurrency_key: avm-full-tests-x86
- name: "AVM Full Tests"
working-directory: ./barretenberg/cpp/
timeout-minutes: 90
# limit our parallelism to half our cores
run: earthly-ci --no-output +vm-full-test --hardware_concurrency=64
16 changes: 16 additions & 0 deletions barretenberg/cpp/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,22 @@ test:
END
RUN cd build && GTEST_COLOR=1 ctest -j$(nproc) --output-on-failure

vm-full-test:
ARG hardware_concurrency=""
# prefetch
BUILD +test-binaries
BUILD +preset-release-assert-test
BUILD ./srs_db/+build # prefetch
FROM +source
COPY --dir +test-binaries/build build
FROM +preset-release-assert-test
COPY --dir ./srs_db/+build/. srs_db
# limit hardware concurrency, if provided
IF [ "$HARDWARE_CONCURRENCY" != "" ]
ENV HARDWARE_CONCURRENCY=$hardware_concurrency
END
RUN cd build && GTEST_COLOR=1 AVM_ENABLE_FULL_PROVING=1 ctest -j4 --test-dir src/barretenberg/vm --output-on-failure

build:
BUILD +preset-wasm
BUILD +preset-wasm-threads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ namespace bb::avm_trace {
using Flavor = bb::AvmFlavor;
using FF = Flavor::FF;

} // namespace bb::avm_trace

namespace bb::avm_trace {
// To toggle all relevant unit tests with proving, set the env variable "AVM_ENABLE_FULL_PROVING".
static const bool ENABLE_PROVING = std::getenv("AVM_ENABLE_FULL_PROVING") != nullptr;

// There are 4 public input columns, 1 for context inputs, and 3 for emitting side effects
using VmPublicInputs = std::tuple<std::array<FF, KERNEL_INPUTS_LENGTH>, // Input: Kernel context inputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AvmTraceBuilder {
ExecutionHints execution_hints = {},
uint32_t side_effect_counter = 0);

std::vector<Row> finalize(uint32_t min_trace_size = 0, bool range_check_required = false);
std::vector<Row> finalize(uint32_t min_trace_size = 0, bool range_check_required = ENABLE_PROVING);
void reset();

uint32_t getPc() const { return pc; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@ using ThreeOpParam = std::array<FF, 3>;
using ThreeOpParamRow = std::tuple<ThreeOpParam, bb::avm_trace::AvmMemoryTag>;
using VmPublicInputs = bb::avm_trace::VmPublicInputs;

// To toggle all relevant unit tests with proving, set the env variable "AVM_TESTS_ENABLE_PROVING".
static const bool ENABLE_PROVING = std::getenv("AVM_TESTS_ENABLE_PROVING") != nullptr;

// If the test is expecting a relation to fail, then use validate_trace_check_circuit.
// Otherwise, use validate_trace with a single argument. If the proving needs to be
// enabled all the time in a given test, use validate_trace with setting with_proof = true.
void validate_trace_check_circuit(std::vector<Row>&& trace, VmPublicInputs public_inputs = {});
void validate_trace(std::vector<Row>&& trace,
VmPublicInputs const& public_inputs = {},
bool with_proof = ENABLE_PROVING);
bool with_proof = bb::avm_trace::ENABLE_PROVING);
void mutate_ic_in_trace(std::vector<Row>& trace,
std::function<bool(Row)>&& selectRow,
FF const& newValue,
Expand Down
2 changes: 2 additions & 0 deletions yarn-project/end-to-end/src/e2e_prover/full.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const TIMEOUT = 1_800_000;

// This makes AVM proving throw if there's a failure.
process.env.AVM_PROVING_STRICT = '1';
// Enable proving the full lookup tables (no truncation).
process.env.AVM_ENABLE_FULL_PROVING = '1';

describe('full_prover', () => {
const t = new FullProverTest('full_prover', 2);
Expand Down
Loading