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

Give explicit degree ranges for every submachine in tests #2092

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions test_data/asm/block_machine_cache_miss.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
machine Arith with
degree: 8,
latch: latch,
operation_id: operation_id
{
Expand Down Expand Up @@ -27,8 +26,10 @@ machine Arith with
operation_id $ [x, y] in [X, SQUARE];
}

machine Main with degree: 8 {
Arith arith;
let MIN: int = 2**8;
let MAX: int = 2**9;
machine Main with min_degree: MIN, max_degree: MAX {
Arith arith(MIN, MAX);

reg pc[@pc];
reg X[<=];
Expand Down
9 changes: 5 additions & 4 deletions test_data/asm/block_to_block.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
let N: int = 8;

// calls a constrained machine from a constrained machine
machine Arith with
latch: latch,
Expand All @@ -15,12 +13,15 @@ machine Arith with
z = x + y;
}

let MIN: int = 2**8;
let MAX: int = 2**9;
machine Main with
degree: N,
min_degree: MIN,
max_degree: MAX,
latch: latch,
operation_id: operation_id
{
Arith arith(N, N);
Arith arith(MIN, MAX);

// return `3*x + 3*y`, adding twice locally and twice externally
operation main<0>;
Expand Down
10 changes: 6 additions & 4 deletions test_data/asm/block_to_block_with_bus.asm
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ let ARITH_INTERACTION_ID = 1234;

// calls a constrained machine from a constrained machine
machine Arith with
degree: 8,
latch: latch,
operation_id: operation_id,
call_selectors: sel,
call_selectors: sel
{
operation add<0> x, y -> z;

Expand All @@ -36,12 +35,15 @@ machine Arith with
z = x + y;
}

let MIN: int = 2**8;
let MAX: int = 2**9;
machine Main with
degree: 8,
min_degree: MIN,
max_degree: MAX,
latch: latch,
operation_id: operation_id
{
Arith arith;
Arith arith(MIN, MAX);

// return `3*x + 3*y`, adding twice locally and twice externally
operation main<0>;
Expand Down
6 changes: 4 additions & 2 deletions test_data/asm/different_signatures.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
machine Main with degree: 16 {
DifferentSignatures sub;
let MIN: int = 2**8;
let MAX: int = 2**9;
machine Main with min_degree: MIN, max_degree: MAX {
DifferentSignatures sub(MIN, MAX);

reg pc[@pc];
reg X[<=];
Expand Down
8 changes: 5 additions & 3 deletions test_data/asm/dynamic_vadcop.asm
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ machine Byte2 with
col fixed operation_id = [0]*;
}

machine Main {
Arith arith;
let MIN: int = 2**10;
let MAX: int = 2**11;
machine Main with min_degree: MIN, max_degree: MAX {
Arith arith(MIN, MAX);

col fixed STEP(i) { i };
Byte2 byte2;
Memory memory(byte2);
Memory memory(byte2, MIN, MAX);

reg pc[@pc];
reg X[<=];
Expand Down
6 changes: 4 additions & 2 deletions test_data/asm/mem_write_once.asm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ machine WriteOnceMemory with
let v2;
}

machine Main with degree: 256 {
let MIN: int = 2**8;
let MAX: int = 2**8;
machine Main with min_degree: MIN, max_degree: MAX {
reg pc[@pc];
reg X1[<=];
reg X2[<=];
Expand All @@ -24,7 +26,7 @@ machine Main with degree: 256 {
reg A;
reg B;

WriteOnceMemory memory;
WriteOnceMemory memory(MIN, MAX);
instr mstore X1, X2, Y1, Y2 -> link => memory.access(X1, X2, Y1, Y2);
instr mload X1, X2 -> Y1, Y2 link => memory.access(X1, X2, Y1, Y2);

Expand Down
7 changes: 5 additions & 2 deletions test_data/asm/mem_write_once_external_write.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ use std::machines::write_once_memory::WriteOnceMemory;
// Uses a simple write-once memory, but without an mstore operation.
// As a result, this only works if the content of the `value` column has
// been provided externally.
machine Main with degree: 256 {
WriteOnceMemory memory;

let MIN: int = 2**8;
let MAX: int = 2**9;
machine Main with min_degree: MIN, max_degree: MAX {
WriteOnceMemory memory(2**20, 2**20);

reg pc[@pc];
reg X[<=];
Expand Down
6 changes: 4 additions & 2 deletions test_data/asm/multiple_signatures.asm
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ machine Add with
operation sub<0> C, A -> B;
}

machine Main with degree: 32 {
let MIN: int = 2**5;
let MAX: int = 2**6;
machine Main with min_degree: MIN, max_degree: MAX {
reg pc[@pc];
reg X[<=];
reg Y[<=];
reg Z[<=];
reg A;
reg B;

Add add;
Add add(MIN, MAX);

instr add X, Y -> Z link ~> Z = add.add(X, Y);
instr sub X, Y -> Z link ~> Z = add.sub(X, Y);
Expand Down
7 changes: 5 additions & 2 deletions test_data/asm/pass_range_constraints.asm
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ machine Mul with
z = x * y;
}

let MIN: int = 2**4;
let MAX: int = 2**5;
machine Main with
degree: 16,
min_degree: MIN,
max_degree: MAX,
latch: latch,
operation_id: operation_id
{
Mul mul;
Mul mul(2**20, 2**20);

operation main<0>;

Expand Down
8 changes: 4 additions & 4 deletions test_data/asm/secondary_machine_plonk.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
machine Main with
degree: 256
{
Pythagoras pythagoras;
let MIN: int = 2**8;
let MAX: int = 2**9;
machine Main with min_degree: MIN, max_degree: MAX {
Pythagoras pythagoras(MIN, MAX);

reg pc[@pc];
reg X[<=];
Expand Down
9 changes: 4 additions & 5 deletions test_data/asm/side_effects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@ use std::machines::large_field::memory::Memory;
mod test_util;
use test_util::FakeByte2 as Byte2;

let N: int = 256;

machine MemoryProxy with
latch: latch,
operation_id: operation_id,
call_selectors: sel,
degree: N
{
operation mstore<0> addr, step, value ->;

Expand All @@ -33,14 +30,16 @@ machine MemoryProxy with
link if used ~> mem.mstore(addr, step, value);
}

machine Main with degree: N {
let MIN: int = 2**8;
let MAX: int = 2**9;
machine Main with min_degree: MIN, max_degree: MAX {
reg pc[@pc];
reg X[<=];
reg Y[<=];
reg Z[<=];

col fixed STEP(i) { i };
MemoryProxy mem;
MemoryProxy mem(MIN, MAX);
instr mstore X, Y -> link ~> mem.mstore(X, STEP, Y);

function main {
Expand Down
6 changes: 4 additions & 2 deletions test_data/asm/single_operation.asm
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ machine SingleOperation with
w = w * w;
}

machine Main with degree: 8 {
SingleOperation m;
let MIN: int = 2**3;
let MAX: int = 2**4;
machine Main with min_degree: MIN, max_degree: MAX {
SingleOperation m(MIN, MAX);

link => m.nothing();
}
7 changes: 4 additions & 3 deletions test_data/asm/sqrt.asm
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ machine Sqrt with
[ y ] in [ range ];
}


machine Main with degree: 8 {
Sqrt sqrt;
let MIN: int = 2**3;
let MAX: int = 2**4;
machine Main with min_degree: MIN, max_degree: MAX {
Sqrt sqrt(MIN, MAX);

reg pc[@pc];
reg X[<=];
Expand Down
12 changes: 6 additions & 6 deletions test_data/asm/vm_args.asm
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
use std::machines::large_field::shift::Shift;
use std::machines::large_field::shift::ByteShift;

let N: int = 65536;

machine Main with degree: N {
let MIN: int = 2**10;
let MAX: int = 2**11;
machine Main with min_degree: MIN, max_degree: MAX {
reg pc[@pc];
reg X[<=];
reg Y[<=];
reg Z[<=];
reg A;

ByteShift byte_shift;
Shift shift(byte_shift);
WithArg sub(shift);
Shift shift(byte_shift, MIN, MAX);
WithArg sub(shift, MIN, MAX);

instr shl X, Y -> Z link ~> Z = shift.shl(X, Y);
instr shr X, Y -> Z link ~> Z = shift.shr(X, Y);
Expand All @@ -37,7 +37,7 @@ machine Main with degree: N {
}
}

machine WithArg(shift: Shift) with degree: N {
machine WithArg(shift: Shift) {
reg pc[@pc];
reg X[<=];
reg Y[<=];
Expand Down
12 changes: 6 additions & 6 deletions test_data/asm/vm_args_memory.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ use std::machines::large_field::memory::Memory;
mod test_util;
use test_util::FakeByte2 as Byte2;

let N: int = 256;

machine Main with degree: N {
let MIN: int = 2**10;
let MAX: int = 2**11;
machine Main with min_degree: MIN, max_degree: MAX {
reg pc[@pc];
reg X[<=];
reg Y[<=];
reg A;

col fixed STEP(i) { i };
Byte2 byte2;
Memory memory(byte2);
WithArg sub(memory);
Memory memory(byte2, MIN, MAX);
WithArg sub(memory, MIN, MAX);

instr mload X -> Y link ~> Y = memory.mload(X, STEP);
instr mstore X, Y -> link ~> memory.mstore(X, STEP, Y);
Expand Down Expand Up @@ -57,7 +57,7 @@ machine Main with degree: N {
}
}

machine WithArg(mem: Memory) with degree: N {
machine WithArg(mem: Memory) {
reg pc[@pc];
reg X[<=];
reg Y[<=];
Expand Down
15 changes: 7 additions & 8 deletions test_data/asm/vm_args_relative_path.asm
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@

let N: int = 16;

machine Main with degree: N {
let MIN: int = 2**4;
let MAX: int = 2**5;
machine Main with min_degree: MIN, max_degree: MAX {
reg pc[@pc];
reg X[<=];
reg Y[<=];
reg Z[<=];
reg A;

b::Arith arith;
a::WithArg subm(arith);
b::Arith arith(MIN, MAX);
a::WithArg subm(arith, MIN, MAX);

instr add X, Y -> Z link => Z = subm.add(X, Y);
instr sub X, Y -> Z link => Z = subm.sub(X, Y);
Expand All @@ -33,7 +32,7 @@ machine Main with degree: N {

// check that relative paths work in machine parameters
mod a {
machine WithArg(arith: super::b::Arith) with degree: super::N {
machine WithArg(arith: super::b::Arith) {
reg pc[@pc];
reg X[<=];
reg Y[<=];
Expand All @@ -56,7 +55,7 @@ mod a {
}

mod b {
machine Arith with degree: super::N {
machine Arith {
reg pc[@pc];
reg X[<=];
reg A;
Expand Down
14 changes: 7 additions & 7 deletions test_data/asm/vm_args_two_levels.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use std::machines::large_field::memory::Memory;
mod test_util;
use test_util::FakeByte2 as Byte2;

let N: int = 256;

machine Main with degree: N {
let MIN: int = 2**8;
let MAX: int = 2**9;
machine Main with min_degree: MIN, max_degree: MAX {
reg pc[@pc];
reg X[<=];
reg Y[<=];
Expand All @@ -14,8 +14,8 @@ machine Main with degree: N {
col fixed STEP(i) { i };

Byte2 byte2;
Memory memory(byte2, 2 * N, 2 * N);
Child sub(memory, N, N);
Memory memory(byte2, MAX, 2 * MAX);
Child sub(memory, MIN, MAX);

instr mload X -> Y link ~> Y = memory.mload(X, STEP);
instr mstore X, Y -> link ~> memory.mstore(X, STEP, Y);
Expand Down Expand Up @@ -73,15 +73,15 @@ machine Main with degree: N {
}
}

machine Child(mem: Memory) {
machine Child(mem: Memory) with min_degree: MIN, max_degree: MAX {
reg pc[@pc];
reg X[<=];
reg Y[<=];
reg Z[<=];
reg A;
reg B;

GrandChild sub(mem, N, N);
GrandChild sub(mem, MIN, MAX);

instr mload X, Y -> Z link ~> Z = mem.mload(X, Y);
instr mstore X, Y, Z -> link ~> mem.mstore(X, Y, Z);
Expand Down
Loading
Loading