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

Make ArrayLiteralExpression sugar for PIL implementation #1623

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

Schaeff
Copy link
Collaborator

@Schaeff Schaeff commented Jul 26, 2024

No description provided.

@@ -167,14 +167,14 @@ FunctionDefinition: FunctionDefinition = {
body,
outer_var_references: Default::default()
})),
<start:@L> "=" <array:ArrayLiteralExpression> <end:@R> => FunctionDefinition::Array(array),
<start:@L> "=" <array:ArrayLiteralExpression> <end:@R> => desugar_array_literal_expression_with_sourceref(ctx.source_ref(start, end), array).into(),
Copy link
Member

Choose a reason for hiding this comment

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

I really like that this is done at parsing time already!

use std::result::Result;
use std::check::panic;

// A term in an array expression
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// A term in an array expression
/// A term in an array expression

}

// returns the total size of the repeated array in this array expression
let solve: ArrayTerm[], int -> Result<int, string> = |terms, degree| {
Copy link
Member

Choose a reason for hiding this comment

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

solve sounds a bit too generic for me. What about something like compute_length?

Copy link
Member

Choose a reason for hiding this comment

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

ah, compute_length_of_repeated_part

@Schaeff Schaeff force-pushed the use-expand-fixed branch from a718b0a to 8a43f05 Compare July 29, 2024 12:01
@@ -15,7 +15,7 @@ namespace Main(N);

// only make a call every other row, otherwise set `c` to 0
// we do this to prevent running out of blocks in `Add`
col fixed CALL = [1, 0]*;
Copy link
Member

Choose a reason for hiding this comment

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

This change is not necessary, is it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We do not have the stdlib in PIL

@@ -599,7 +599,7 @@ enum Operation<'a, T> {
struct Evaluator<'a, 'b, T: FieldElement, S: SymbolLookup<'a, T>> {
symbols: &'b mut S,
local_vars: Vec<Arc<Value<'a, T>>>,
type_args: HashMap<String, Type>,
type_args: Arc<HashMap<String, Type>>,
Copy link
Member

Choose a reason for hiding this comment

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

I don't see where this Arc is useful - am I missing something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

self.type_args = type_args.clone();

Screenshot 2024-08-05 at 11 08 09

Copy link
Member

Choose a reason for hiding this comment

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

Ok, makes sense! :)

@chriseth chriseth mentioned this pull request Aug 2, 2024
github-merge-queue bot pushed a commit that referenced this pull request Aug 2, 2024
Extracted from @Schaeff `s #1623

---------

Co-authored-by: schaeff <[email protected]>
}
};

enum OffsetSearch {
Copy link
Member

Choose a reason for hiding this comment

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

This should probably get a better name.

github-merge-queue bot pushed a commit that referenced this pull request Aug 8, 2024
Equivalent to #1623  but in Rust

Closes #1570

@georgwiese I wanted to add a test but everything I try either panics
(we sometimes assume the fixed columns to be available in a single size)
or runs forever (when I add fixed columns to a machine, I assume witgen
keeps increasing the degree and never stops? or it picks the largest
size and just takes time?) any thoughts?
github-merge-queue bot pushed a commit that referenced this pull request Oct 22, 2024
Mainly a test file to see what the JIT features are we need to support
#1623

The "Add functionality benchmark" commit is the only important one here,
the rest are merges from the implementing branches.
leonardoalt pushed a commit that referenced this pull request Oct 22, 2024
Mainly a test file to see what the JIT features are we need to support
#1623

The "Add functionality benchmark" commit is the only important one here,
the rest are merges from the implementing branches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants