Silly for me. Though I’m newer to MLIR, I thought I have ask many question these days. Bur I really need to ask a more question.
I want to make a new whileOp like:
%res = scf.while (%arg1 = %init1) : (f32) -> f32 {
// "Before" region.
// In a "while" loop, this region computes the condition.
%condition = call @evaluate_condition(%arg1) : (f32) -> i1
// Forward the argument (as result or "after" region argument).
scf.condition(%condition) %arg1 : f32
} do {
^bb0(%arg2: f32):
// "After" region.
// In a "while" loop, this region is the loop body.
%next = call @payload(%arg2) : (f32) -> f32
// Forward the new value to the "before" region.
// The operand types must match the types of the `scf.while` operands.
scf.yield %next : f32
}
How should I use them? ( MLIR has too few example for important API and I did feel silly at all. Thank for all patient answers. MLIR discourse really help me a lot.
Hello? I have a remained question… I found this method was implemented in 1 month ago. But for oldder version of MLIR or some waiting update Op like IndexSwitchOp, what should I do if I have build a Op like:
This assertions means you’re accessing an empty block, what does your code look like?
If you build with Debug mode, you should have a backtrace that should point at the issue.
(I suspect you may be looking for a block in the region without adding a block there yourself first).
In general, I open the generated header tools/mlir//include/mlir/Dialect/SCF/IR/SCFOps.h.inc, find the class, and look at the build methods, for IndexSwitchOp it is:
When you use builder.create<IndexSwitchOp>(...) the first two arguments of the build() methods are implicit and handled by the builder, so you just need to provide the ones after.