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

chore: Re-open #3258 #3410

Merged
merged 98 commits into from
Nov 3, 2023
Merged
Changes from 1 commit
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
c2f2f62
enabled dynamic indices on nested arrays
vezenovm Sep 14, 2023
45b3787
remove debug
vezenovm Sep 14, 2023
7ccf8e9
working non-homogenous arr accesses for block params
vezenovm Sep 15, 2023
d5d16d7
add array_set, broken, need to maintain structure from SSA for accura…
vezenovm Sep 19, 2023
ec54e01
merge conflcits w/ master
vezenovm Sep 19, 2023
e2eff9b
working non-homogenous arrays using internal type element size array,…
vezenovm Sep 19, 2023
219c8f2
cleanup lots of debug and move const index access into its own method
vezenovm Sep 19, 2023
3195325
updating array_get and array_set to reduce repeated code
vezenovm Sep 19, 2023
8fb3bb1
restrict dynamic indices for non-homogenous slices
vezenovm Sep 19, 2023
469c333
cleanup array_get_value
vezenovm Sep 19, 2023
0648142
add internal_memory_blocks map
vezenovm Sep 19, 2023
b99f0e2
do not make separate bool for handle_constant_index
vezenovm Sep 20, 2023
5784170
fetch dummy value with predicate index
vezenovm Sep 20, 2023
05f35c6
flatten the index once for both array_set and array_get, do not modif…
vezenovm Sep 20, 2023
f2dd702
remove first_elem param
vezenovm Sep 21, 2023
490f5af
initial slice changes with fetch flat size from SSA values, need to g…
vezenovm Sep 25, 2023
0037867
merge master
vezenovm Sep 25, 2023
3636bc6
initial working nested dynamic slices
vezenovm Sep 28, 2023
31e7bc2
cleanup and fmt
vezenovm Sep 28, 2023
4354b76
cargo clippy and fmt
vezenovm Sep 28, 2023
87e8314
merge conflicts w/ master
vezenovm Sep 28, 2023
658d234
remove boolean AcirType
vezenovm Sep 28, 2023
408ac2c
remove deaad code not in master
vezenovm Sep 28, 2023
22ce20c
better solution for fetching nested slice with multiple slice mergesr
vezenovm Sep 28, 2023
686640e
bring back assert in nested_array_dynamic
vezenovm Sep 28, 2023
626616b
add assert to nested_slice_dynamic test
vezenovm Sep 28, 2023
f60183c
cleanup w/ copy_dynamic_array method
vezenovm Sep 28, 2023
be5dc79
starting test for slices in struct fields
vezenovm Sep 29, 2023
a7fde3e
more initial debugging for adding slices to struct fields
vezenovm Oct 2, 2023
d1c9192
basic slice struct fields working, but broken for struct fields of di…
vezenovm Oct 3, 2023
6ab1212
got old nested array and slice working with new acir, basic array get…
vezenovm Oct 4, 2023
d5911b8
merged w/ master, and working old nested arr/slice tests, array_set f…
vezenovm Oct 4, 2023
b9c6a0a
heavy debugging work to get flattening with slice of slices working
vezenovm Oct 5, 2023
11f7dc8
working slice field in a struct
vezenovm Oct 5, 2023
7f4c822
little test func for flattened slice size of res
vezenovm Oct 5, 2023
d97b965
merge conflicts w/ master
vezenovm Oct 9, 2023
20f61a5
Merge branch 'master' into mv/slice-struct-fields
vezenovm Oct 11, 2023
37a0f0f
merge conflicts w/ master
vezenovm Oct 16, 2023
1e0bd3f
update slice struct fields to use map of slice sizes in ACIR gen
vezenovm Oct 17, 2023
3b08844
clean up dbgs and old debug in acvm
vezenovm Oct 17, 2023
9086383
cleanup
vezenovm Oct 17, 2023
f1c707c
comments update
vezenovm Oct 17, 2023
9108769
check if we have side effects enabeld when flattening index
vezenovm Oct 17, 2023
589185c
Merge branch 'master' into mv/slice-struct-fields
vezenovm Oct 17, 2023
4209388
cleanup
vezenovm Oct 17, 2023
2949302
add TODOs to value merger
vezenovm Oct 17, 2023
ce13374
fill internal slices pass
vezenovm Oct 23, 2023
554b8a9
cleanup
vezenovm Oct 23, 2023
c2d7ce7
cleanup
vezenovm Oct 23, 2023
27e0835
fix up acir gen to not use value ids with slice values
vezenovm Oct 23, 2023
1456af9
Merge branch 'master' into mv/slice-struct-fields
vezenovm Oct 23, 2023
77b394e
fix for terminator in fill internal slices path
vezenovm Oct 23, 2023
3850cf1
Update compiler/noirc_evaluator/src/ssa/opt/fill_internal_slices.rs
TomAFrench Oct 23, 2023
db60a52
working nested array get/set w/ no regressions
vezenovm Oct 25, 2023
8cc5993
Merge branch 'mv/fill-slices-pass' into mv/fill-slices-pass-dbg
vezenovm Oct 25, 2023
a8d0431
working basic slice intrinsics on nested slices
vezenovm Oct 26, 2023
f9b8544
debugging changes for no regressions and changes to ACIR gen
vezenovm Oct 26, 2023
00a2f47
remove gate regression to get slice push back working for nested slices
vezenovm Oct 26, 2023
43f11e5
PR comment on removing from slice
vezenovm Oct 26, 2023
0d39a6b
improve fill internal slices pass
vezenovm Oct 27, 2023
6beabc2
cargo fmt
vezenovm Oct 27, 2023
42c0547
included simple unit test to fill internal slices pass
vezenovm Oct 30, 2023
5236691
cleanup
vezenovm Oct 30, 2023
c31906d
missed cargo fmt
vezenovm Oct 30, 2023
72a8a2a
spell check
vezenovm Oct 30, 2023
f231731
remove broken push back
vezenovm Oct 30, 2023
3b664a4
Update compiler/noirc_evaluator/src/ssa/opt/fill_internal_slices.rs
vezenovm Oct 31, 2023
e58dbba
Merge branch 'master' into mv/slice-struct-fields
TomAFrench Oct 31, 2023
0036938
Merge branch 'mv/slice-struct-fields' into mv/fill-slices-pass
TomAFrench Oct 31, 2023
b48fb85
chore: nargo fmt
TomAFrench Oct 31, 2023
f30062e
Update compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs
vezenovm Oct 31, 2023
4612c96
Update compiler/noirc_evaluator/src/ssa/opt/fill_internal_slices.rs
vezenovm Oct 31, 2023
b59f8ce
Update compiler/noirc_evaluator/src/ssa/opt/fill_internal_slices.rs
vezenovm Oct 31, 2023
711a3ff
Update compiler/noirc_evaluator/src/ssa/opt/fill_internal_slices.rs
vezenovm Oct 31, 2023
2a84478
flip order of test data for readability
vezenovm Oct 31, 2023
0bafe8d
format
vezenovm Oct 31, 2023
a4ef11b
reduce nesting in attach_slice_dummies
vezenovm Oct 31, 2023
dd3baec
feat(slices): Fill slice internal dummy data initial pass (#3258)
vezenovm Oct 31, 2023
3b30290
simplify predicate logic when fetching flattened index
vezenovm Nov 1, 2023
4926713
Update compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs
vezenovm Nov 1, 2023
24bfae9
use ok_or_else on store value slice sizes
vezenovm Nov 1, 2023
a8dae7a
reduce nesting from compute_slice_sizes in acir gen
vezenovm Nov 1, 2023
d558647
Merge branch 'master' into mv/slice-struct-fields
vezenovm Nov 1, 2023
ed372cc
Merge branch 'master' into mv/slice-struct-fields
jfecher Nov 1, 2023
ff280cb
Merge branch 'master' into mv/slice-struct-fields
vezenovm Nov 2, 2023
402f421
revert merge of 3258
vezenovm Nov 2, 2023
7ce4b52
merge in mv/slice-struct-fields
vezenovm Nov 2, 2023
5286fd1
use slice not mutable vec for array_get_value
vezenovm Nov 2, 2023
96805de
comment out failing constraints fixed by fill internal slices pass
vezenovm Nov 2, 2023
284e762
Merge branch 'mv/slice-struct-fields' into mv/fill-slices-pass
vezenovm Nov 2, 2023
c7649d3
Update compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs
vezenovm Nov 3, 2023
bf0aa94
wrap parent_array in Some
vezenovm Nov 3, 2023
2528f3d
Update compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs
vezenovm Nov 3, 2023
38669e9
add comments for slize sizes
vezenovm Nov 3, 2023
2b446a1
remove catch all for contains_slice_element
vezenovm Nov 3, 2023
33beadf
Merge branch 'master' into mv/slice-struct-fields
vezenovm Nov 3, 2023
750f2ad
Merge branch 'mv/slice-struct-fields' into mv/fill-slices-pass
vezenovm Nov 3, 2023
1577442
merge conflicts after #3187 merged w/ master
vezenovm Nov 3, 2023
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
Prev Previous commit
Next Next commit
merge master
vezenovm committed Sep 25, 2023
commit 003786719800e7d4e57e7fd1f547c630ad4a928e
25 changes: 22 additions & 3 deletions compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs
Original file line number Diff line number Diff line change
@@ -266,7 +266,7 @@ impl Context {
} else {
dbg!(values.len());
panic!("HAVE SLICE SSA BLOCK PARAM THIS SHOULD NEVER HAPPEN");
values.len()
// values.len()
};
self.initialize_array(block_id, len, Some(value.clone()))?;
}
@@ -1215,7 +1215,6 @@ impl Context {
}
}
_ => {

// dbg!(&dfg[array_id]);
match array_acir_value {
AcirValue::DynamicArray(AcirDynamicArray { block_id, len, type_len, element_type_sizes }) => {
@@ -1552,14 +1551,18 @@ impl Context {
// Casting into a Field as a no-op
Ok(variable)
}
NumericType::Unsigned { bit_size } | NumericType::Signed { bit_size } => {
NumericType::Unsigned { bit_size } => {
if incoming_type.is_signed() {
todo!("Cast from unsigned to signed")
}
let max_bit_size = incoming_type.bit_size();
if max_bit_size <= *bit_size {
// Incoming variable already fits into target bit size - this is a no-op
return Ok(variable);
}
self.acir_context.truncate_var(variable, *bit_size, max_bit_size)
}
NumericType::Signed { .. } => todo!("Cast into signed"),
}
}

@@ -1894,6 +1897,15 @@ impl Context {
acir_vars
}

fn bit_count(&self, lhs: ValueId, dfg: &DataFlowGraph) -> u32 {
match dfg.type_of_value(lhs) {
Type::Numeric(NumericType::Signed { bit_size }) => bit_size,
Type::Numeric(NumericType::Unsigned { bit_size }) => bit_size,
Type::Numeric(NumericType::NativeField) => FieldElement::max_num_bits(),
_ => 0,
}
}

/// Convert a Vec<AcirVar> into a Vec<AcirValue> using the given result ids.
/// If the type of a result id is an array, several acir vars are collected into
/// a single AcirValue::Array of the same length.
@@ -1934,6 +1946,13 @@ impl Context {
}
}
}

/// Creates a default, meaningless value meant only to be a valid value of the given type.
fn create_default_value(&mut self, param_type: &Type) -> Result<AcirValue, RuntimeError> {
self.create_value_from_type(param_type, &mut |this, _| {
Ok(this.acir_context.add_constant(FieldElement::zero()))
})
}
}

#[cfg(test)]
Original file line number Diff line number Diff line change
@@ -9,39 +9,34 @@ struct Foo {
}

fn main(mut x : [Foo; 4], y : pub Field) {
let foo_one = Foo { a: 1, b: [2, 3, 20], bar: Bar { inner: [100, 101, 102] }};
let foo_two = Foo { a: 4, b: [5, 6, 21], bar: Bar { inner: [103, 104, 105] }};
let mut q = [foo_one, foo_two];
// assert(x[y - 3].a == 1);
// assert(x[y - 3].b == [2, 3, 20]);
assert(q[y - 2].a == 4);
assert(q[y - 2].b == [5, 6, 21]);
// assert(x[y - 1].a == 7);
// assert(x[y - 1].b == [8, 9, 22]);

// assert(x[y].a == 10);
// assert(x[y].b == [11, 12, 23]);
// assert(x[y].bar.inner == [109, 110, 111]);
assert(x[y - 3].a == 1);
assert(x[y - 3].b == [2, 3, 20]);
assert(x[y - 2].a == 4);
assert(x[y - 2].b == [5, 6, 21]);
assert(x[y - 1].a == 7);
assert(x[y - 1].b == [8, 9, 22]);
assert(x[y].a == 10);
assert(x[y].b == [11, 12, 23]);
assert(x[y].bar.inner == [109, 110, 111]);

// Check dynamic array set
if y != 2 {
q[y - 2].a = 50;
x[y].a = 50;
} else {
q[y].a = 100;
x[y].a = 100;
}
// q[y - 2].a = 50;
assert(q[y - 2].a == 50);
assert(x[y].a == 50);

// if y == 2 {
// x[y - 1].b = [50, 51, 52];
// } else {
// x[y - 1].b = [100, 101, 102];
// }
// assert(x[2].b == [100, 101, 102]);
if y == 2 {
x[y - 1].b = [50, 51, 52];
} else {
x[y - 1].b = [100, 101, 102];
}
assert(x[2].b == [100, 101, 102]);

// assert(x[y - 3].bar.inner == [100, 101, 102]);
// assert(x[y - 2].bar.inner == [103, 104, 105]);
// assert(x[y - 1].bar.inner == [106, 107, 108]);
// assert(x[y].bar.inner == [109, 110, 111]);
assert(x[y - 3].bar.inner == [100, 101, 102]);
assert(x[y - 2].bar.inner == [103, 104, 105]);
assert(x[y - 1].bar.inner == [106, 107, 108]);
assert(x[y].bar.inner == [109, 110, 111]);
}

You are viewing a condensed version of this merge commit. You can view the full changes here.