Skip to content

While, DoWhile, and linear states #4

@aborgna-q

Description

@aborgna-q

The While and DoWhile definitions contain to regions internally;

  • A loop body with types *state -> *state
  • A condition statement with types *state -> bool that decides when to stop the evaluation.

This is problematic when the state is linear; calling the condition forces us to discard the values.

The straightforward solution to this is to change the condition type to *state -> bool, *state.


For an alternative definition consider MLIR's scf.while. There we are able to use different types for the inputs and outputs of the loops.
That corresponds roughly to a jeff While where the regions have type:

  • while: *in_state -> *out_state
  • condition: *in_state -> bool, *out_state
  • body: *out_state -> *in_state

Are we happy with the single-state?

Metadata

Metadata

Assignees

Labels

A-formatArea: Format schemaC-questionCategory: User questions that are neither a feature nor a bug

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions