fix(compiler): Copy attributes when reinstantiating scf.for ops

The switch to reinstantiating conversion patterns for the conversion
from FHE to TFHE in commit 73fd6c5fe7
caused all attributes of `scf.for` operations to be dropped during the
conversion. This included the custom attribute `parallel`, which is
exploited further down the compilation pipeline to generate parallel
code. As a result, the performance of end-to-end benchmarks dropped
significantly.

This patch copies all attributes of `scf.for` operations upon
reinstantiation, which solves the performance regression.
This commit is contained in:
Andi Drebes
2023-02-08 13:28:22 +01:00
committed by Quentin Bourgerie
parent 3ab10c8d3f
commit fc02bb5cd8

View File

@@ -20,6 +20,8 @@ TypeConvertingReinstantiationPattern<scf::ForOp, false>::matchAndRewrite(
adaptor.getStep(), adaptor.getInitArgs(),
[&](OpBuilder &builder, Location loc, Value iv, ValueRange args) {});
newForOp->setAttrs(adaptor.getAttributes());
// Move operations from old for op to new one
auto &newOperations = newForOp.getBody()->getOperations();
mlir::Block *oldBody = oldOp.getBody();