Skip to content

Deep partial evaluation for CLEF expression #93

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

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from

Conversation

parcollet
Copy link
Member

  • Add deep partial evaluation to CLEF expression.

During a partial evaluation, the operation is explicitly called at each node, instead of simply evaluating the children and waiting for all the arguments to be known (non lazy) to do the operation (previous behavior).

  • This is disabled by default for the tags::function and tags::subscript node, i.e. () and [] call operators.

  • However, if the traits supports_partial_eval_of_calls/supports_partial_eval_of_subscript are set to true for an object the ()/[] is called during the partial evaluation.

  • It is not set by default since writing a partial evaluation for an object requires a bit of care, i.e. to properly move the arguments into the make_expr_call object. At this stage, it is only intended for advanced users, and for some specific cases where a partial evaluation of the function can compress it significantly for performance.

  • To illustrate the previous point, a simple lambda add(auto x, auto y) { return x + y;} used in a node {function, add, x_, y_} would compile with the new behavior, but after a partial eval on y= y0, its value y0 would be dangling. As it is unlikely that default user will write add with a move, the new behavior is not by default for ()/[]

  • NB : put the partial eval for call by default compiles but breaks 2 tests in TRIQS lib.

- Add deep partial evaluation

  During a partial evaluation, the operation is explictly
  called at each node, instead of simply evaluating the children
  and waiting for all the arguments to be known (non lazy) to
  do the operation (previous behaviour).

- This is disabled by default for the tags::function and
  tags::subscript node, i.e. () and [] call operators.

- However, if the traits
  supports_partial_eval_of_calls/supports_partial_eval_of_subscript
  are set to true for an object
  the ()/[] is called during the partial evaluation.

- It is not set by default since writing a partial evaluation for an object
  requires a bit of care, i.e. to properly move the arguments
  into the make_expr_call object.
  At this stage, it is only intended for advanced users, and for some
  specific cases where a partial evaluation of the function can compress
  it significanly for performance.

- To illustrate the previous point, a simple lambda
     add(auto x, auto y) { return x + y;}
     used in a node  {function, add, x_, y_}
  would compile with the new behaviour, but after a partial eval on y= y0, its value y0 would be
  dangling. As it is unlikely that default user will write add with a
  move, the new behaviour is not by default for ()/[]

- NB : put the partial eval for call by default compiles but breaks 2
  tests in TRIQS lib.
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.

1 participant