message: Fix: Perform tpp combine of residual connections only when add and relu shapes match
diff: @@ -420,12 +420,27 @@ struct TppCombinePass : public TppCombineBase<TppCombinePass> {
  } else {
  addBuffer = addOp.getOperand(0);
  }
  + auto shape1 = addBuffer.getType().cast<MemRefType>().getShape();
  + auto shape2 =
  + reluOp.getResult(0).getType().cast<MemRefType>().getShape();
  + bool shapeMatch = false;
  + if (shape1.size() == shape2.size()) {
  + shapeMatch = true;
  + for (int i = 0; i < shape1.size(); i++) {
  + if (shape1[i] != shape2[i]) {
  + shapeMatch = false;
  + break;
  + }
  + }
  + }
  + if (shapeMatch) {
  Value reluBuffer = addBuffer;
  while (true) {
  Value *prevReluOp = new Value();
  auto opPattern = m_Op<AffineYieldOp>(
  m_Capture(prevReluOp, m_Op<pxa::PxaGenericOp>()));
  - auto prevOp = cast<AffineParallelOp>(reluBuffer.getDefiningOp());
  + auto prevOp =
  + cast<AffineParallelOp>(reluBuffer.getDefiningOp());
  auto affineYield = prevOp.getBody()->getTerminator();
  assert(matchPattern(affineYield, opPattern));
  pxa::PxaGenericOp prevPxaReluOp =
  @@ -459,7 +474,8 @@ struct TppCombinePass : public TppCombineBase<TppCombinePass> {
  SmallVector<AffineValueMap> inputValueMaps0;
  inputValueMaps0.reserve(gemmOp0.getNumInputs());
  gemmOp0.getAffineValueMaps(gemmOp0.inputAccessMaps(),
  - gemmOp0.inputIndices(), inputValueMaps0);
  + gemmOp0.inputIndices(),
  + inputValueMaps0);
  for (AffineValueMap &valueMap : inputValueMaps0) {
  inputAccessMaps0.push_back(valueMap.getAffineMap());
  @@ -495,7 +511,8 @@ struct TppCombinePass : public TppCombineBase<TppCombinePass> {
  /*outputIndices=*/reluOp.outputIndices(),
  /*inputAccessMaps=*/
  builder.getAffineMapArrayAttr(inputAccessMaps0),
  - /*inputTileMaps=*/builder.getAffineMapArrayAttr(inputTileMaps0),
  + /*inputTileMaps=*/
  + builder.getAffineMapArrayAttr(inputTileMaps0),
  /*outputAccessMaps=*/reluOp.outputAccessMaps(),
  /*outputTileMaps=*/reluOp.outputTileMaps(),
  /*kernel=*/builder.getStringAttr("tpp_gemm_relu_beta1"),
  @@ -531,6 +548,7 @@ struct TppCombinePass : public TppCombineBase<TppCombinePass> {
  }
  }
  }
  + }
  });
  }
  };
  