Enable the safe return in neura dataflow ir #223
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this pr:
Introduce two kinds of return ops in neura dataflow ir:
neura.return_void: its operand means the trigger valuesneura.return_value: its operand means the returned valuesThese two kinds of return ops are only enabled in dataflow ir. In conventional neural CDFG ir, we still use the
neura.return.We create a
canonicalize-returnpass to mark the type (return_type = void/value) ofneura.return. AndWe introduce some logic in the
transform-ctrl-to-data-flowpass to transform theneura.returntoneura.return_value/return_voidA
neura.yieldis added at each flattened block's end to act like a terminator for the block. This is just to obey the rules in MLIR block https://mlir.llvm.org/docs/LangRef/#blocks.TODO: Enable the interpreter for these two introduced ops. Since this pr is too large, I will make a separate pr for that.