-
Notifications
You must be signed in to change notification settings - Fork 11
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
Cannot enumerate terms for larger depths #226
Comments
Hi! Thanks for your question, I'm excited that you're trying to use Enumo :) I think your issue is in how you're using
So in your code, you're doing
And then you plug in
And finally you plug in
Correct me if I'm wrong, but I think you're trying to enumerate these terms:
In that case, I think you'll want to make a workload that's something like this:
Please let me know if that helps, and don't hesitate to reach out with any other questions! |
Hello @ajpal , Replacing the enumeration with with:
produces the following enumerated terms:
instead of something like
Could you suggest how to rectify this? |
Also another question: Consider that the enumerated terms are of different types. For example, consider that we have a DSL of 32 bit integers and 64 bit integers and operations operating on 32-bit and 64 bit operations respectively. Once can convert to 64 bit integers using a sign-extension and the reverse using a truncation. Could you specify how we can enumerate expressions in these case? We want to enumerate all expressions up to depth 3 where the output type may be either a 64-bit value or a 32-bit value. Your help will be greatly appreciated! |
Sorry, I missed this reply!! I don't understand or repro the issue with
I get
Which is, I think, as expected. Can you clarify and/or send me a branch I can play around with? For the second question (about enumerating different types), Workload terms aren't typed (they're just s-expressions). The semantics of what the term means is up to your implementation of |
Hello Anjali, <32-bit-expr>: <16-bit-expr>: <8-bit-expr>: As you can see the expressions are mutually recursive, and so I'm unsure of how to express a workload such as this. Say we wanted to enumerate all expressions upto depth 3 where the final return type is |
I'm trying to enumerate a small workload up to depth 4 or 16 atoms, but both seem to give out of memory errors. I am using empty vectors in the interpreter since I am making calls to an external validator anyway. Is there something wrong with the invokation? Surprised to see OOM for a small workload like this. I've also tried to the fast-fotrwarding algorithm but to no avail at those depths. I am able to get rules for depths 2 and 3. As you can infer from the workload, trying to generate rules from the vector ops to the target vector min op. I am constraining the // interpreter
fn eval<'a, F>(&'a self, cvec_len: usize, mut get_cvec: F) -> CVec<Self>
where
F: FnMut(&'a Id) -> &'a CVec<Self>,
{
match self {
Lang::Lit(c) => vec![],
Lang::TargetVecMin([a, b]) => vec![],
Lang::Src_unsigned_vec_sat_sub([a, b]) => vec![],
Lang::Src_unsigned_vec_min([a, b]) => vec![],
Lang::Src_signed_vec_min([a, b]) => vec![],
Lang::Var(_) => vec![],
}
} // defining and running workload
let lang_34 = Lang::new(
&["0", "1", "2", "3", "4", "5", "6", "7"],
&["a", "b", "c", "d", "e", "f", "g", "h"],
&[
&[],
&[
"src-unsigned-vec-min",
"src-signed-vec-min",
"src-unsigned-vec-sat-sub",
"target-vec-min",
],
],
);
let wkld_34_d4 = iter_metric(base_lang(2), "EXPR", Metric::Depth, 4)
.plug("VAR", &Workload::new(&lang_34.vars))
.plug("VAL", &Workload::empty())
.plug("OP1", &Workload::new(&lang_34.ops[0].clone()))
.plug("OP2", &Workload::new(&lang_34.ops[1].clone()))
.filter(Filter::Canon(vec![
"a".to_string(),
"b".to_string(),
"c".to_string(),
"d".to_string(),
]));
rules_34.extend(run_workload(
wkld_34_d4,
rules_34.clone(),
Limits::synthesis(),
Limits::minimize(),
true,
)); Let me know if you want me to provide any more information/code. |
I think depth 4 with this many variables and constants is going to be quite large, no?
Exhaustively enumerating up to depth 4 or size 16 is probably not feasible-- and even if you could make the workload, it would be too big to do anything useful in an e-graph. Could you try constructing smaller workloads that compose together to explore the search space? |
Hello, I am trying to enumerate these terms using Enumo.
The validation function is returning
Invalid
for now since I need to call an external program containing the semantics to validate it instead of encoding it in Z3. However, on running the test, the terms don't enumerate to the specified depth.We are trying to generate the rule
(vec_d_dsl (vec_s_dsl a)) = a
. Can you point to any reasons as to why that pattern is not being enumerated?The text was updated successfully, but these errors were encountered: