)]}'
{
  "commit": "ef6e7affbb7b0eb4976c1019c788bcadfc34ecd6",
  "tree": "a5032abc5ce63e60d32e93ca47c8c3f499d2e95e",
  "parents": [
    "99696b35bc8a0054e0b0c1a26e8dd5049fa8c41b"
  ],
  "author": {
    "name": "Rafael Ubal",
    "email": "rubal@mathworks.com",
    "time": "Fri Aug 16 11:10:48 2024 -0400"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Fri Aug 16 11:10:48 2024 -0400"
  },
  "message": "[mlir] [tosa] Bug fixes in shape inference pass (#104146)\n\nThis change addresses 2 bugs in the TOSA shape inference pass\r\n(`--tosa-infer-shapes`). The included unit test contains a detailed\r\ndescription of the issues.\r\n\r\n- Input IR\r\n\r\n```\r\nfunc.func @main(%arg0: tensor\u003c1x2x8xf32\u003e) {\r\n  %0 \u003d tosa.cast %arg0 : (tensor\u003c1x2x8xf32\u003e) -\u003e tensor\u003c?x2x8xf32\u003e\r\n\r\n  %c0 \u003d arith.constant 0 : index\r\n  %dim \u003d tensor.dim %0, %c0 : tensor\u003c?x2x8xf32\u003e\r\n\r\n  %expanded_0 \u003d tensor.expand_shape %0 [[0], [1, 2], [3]] output_shape [%dim, 1, 4, 8] : tensor\u003c?x2x8xf32\u003e into tensor\u003c?x1x2x8xf32\u003e\r\n  %expanded_1 \u003d tensor.expand_shape %0 [[0], [1, 2], [3]] output_shape [%dim, 1, 4, 8] : tensor\u003c?x2x8xf32\u003e into tensor\u003c?x1x2x8xf32\u003e\r\n  return\r\n}\r\n```\r\n\r\n- Output IR\r\n\r\n```\r\nmodule {\r\n  func.func @main(%arg0: tensor\u003c1x2x8xf32\u003e) {\r\n  %0 \u003d tosa.cast %arg0 : (tensor\u003c1x2x8xf32\u003e) -\u003e tensor\u003c1x2x8xf32\u003e\r\n\r\n  // This cast was previously inserted between both \u0027tensor.expand_shape\u0027 ops.\r\n  %cast \u003d tensor.cast %0 : tensor\u003c1x2x8xf32\u003e to tensor\u003c?x2x8xf32\u003e\r\n\r\n  %c0 \u003d arith.constant 0 : index\r\n  %dim \u003d tensor.dim %0, %c0 : tensor\u003c1x2x8xf32\u003e\r\n\r\n  // The operand of the first \u0027tensor.expand_shape\u0027 op was not previously updated\r\n  // from \u0027%0\u0027 to \u0027%cast\u0027 due to an invalidation of the iterator traversing the\r\n  // use list of the \u0027tosa.cast\u0027 op.\r\n  %expanded_0 \u003d tensor.expand_shape %cast [[0], [1, 2], [3]] output_shape [%dim, 1, 4, 8] : tensor\u003c?x2x8xf32\u003e into tensor\u003c?x1x2x8xf32\u003e\r\n  %expanded_1 \u003d tensor.expand_shape %cast [[0], [1, 2], [3]] output_shape [%dim, 1, 4, 8] : tensor\u003c?x2x8xf32\u003e into tensor\u003c?x1x2x8xf32\u003e\r\n  return\r\n}\r\n```",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "b1d5720541846f3648f329ef0fc8481d0f083840",
      "old_mode": 33188,
      "old_path": "mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp",
      "new_id": "358353eb955c16c26d0aca07fb8de9e47dd6a1f3",
      "new_mode": 33188,
      "new_path": "mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp"
    },
    {
      "type": "modify",
      "old_id": "3224f88968f3d2705119c53f8937e39071ab73c1",
      "old_mode": 33188,
      "old_path": "mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir",
      "new_id": "d46de740800e937fcf54fe0468d21c0acc21d2ef",
      "new_mode": 33188,
      "new_path": "mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir"
    }
  ]
}
