Open qedawkins opened 1 year ago
@llvm/issue-subscribers-bug
Author: Quinn Dawkins (qedawkins)
Using a SmallVector<Value>
and let the result processing do the conversion for me works fine
static SmallVector<Value> getI32TensorSizes(PatternRewriter &rewriter,
ValueRange vals) {
SmallVector<Value> flatI32TensorSizes;
for (auto val : vals) {
if (isa<IndexType>(val.getType())) {
flatI32TensorSizes.push_back(rewriter.create<arith::IndexCastOp>(
val.getLoc(), rewriter.getIntegerType(32), val).getResult());
}
}
return flatI32TensorSizes;
}
Problem Description
I have a native rewrite function registered with PDL that does an element-by-element rewrite of Values in a ValueRange that is seemingly failing to populate the PDL ByteCode result list with the new value. My rewrite function looks like
and I have pdl IR like
If I run my interpreter pass with
--debug-only=pdl-bytecode
, it successfully prints the arguments of to the native rewrite, but fails to print the results.(the full stack backtrace can be found here: https://gist.github.com/qedawkins/2f01e231caa8933c8c75c0b1a83b4d65, crashing here on this debug line: https://github.com/llvm/llvm-project/blob/a9136f0ad94bf7738c585c6d12ad5bbe1815f95b/mlir/lib/Rewrite/ByteCode.cpp#L1450)
If I print the surrounding IR immediately before returning from the native rewrite function, I see that the index_cast I wanted to insert is there
cc @MaheshRavishankar