add support of neura.PhiOp in interpreter#37
Conversation
| auto incoming = valueMap[operand]; | ||
| if (incoming.predicate) { | ||
| result = incoming; | ||
| break; // Found the active value. |
There was a problem hiding this comment.
Move the comment above the if.
| @@ -0,0 +1,20 @@ | |||
| // RUN: neura-interpreter %s | FileCheck %s | |||
|
|
|||
There was a problem hiding this comment.
Can we run mlir-neura-opt with --assign-accelerator --leverage-predicated-value so the IR would contain PredicatedValue as https://github.com/coredac/dataflow/blob/64e7b3537cc5de007ec81b706c67cb20f0ce2860/test/neura/ctrl/branch_no_arg.mlir#L62
and then run neura-interpreter again to double check?
| } else if (auto phiOp = dyn_cast<neura::PhiOp>(op)) { | ||
| PredicatedData result{0.0f, false}; // Default to a false predicate. | ||
| // Find the one operand with a true predicate. | ||
| for (Value operand : phiOp.getOperands()) { |
There was a problem hiding this comment.
Shouldn't we assert there must be at most one operand with predicate as true?
There was a problem hiding this comment.
Plz hold on, let me re-think the design. Its current form cannot support the diagram shown in README: https://github.com/tancheng/CGRA-Mapper
There was a problem hiding this comment.
I introduced grant_predicate and grant_once in #39, so we don't need to complicate phi's definition for now, so you are good to go: "assert there must be at most one operand with predicate as true".
Later on, we can introduce new op to fuse the (phi and grant_once and const) if needed.
There was a problem hiding this comment.
Rename the test as phi_interpret.mlir.
Add neura.PhiOp interpreter support
to verify this patch
./build/tools/neura-interpreter/neura-interpreter /home/yuan/neura_dataflow/dataflow/test/neura/interpreter/phiOp_interpret.mlir