)]}'
{
  "commit": "e7fad8193e982cea4cf2658725522f4bfe53d06d",
  "tree": "e96afe2754db7e81ba17f4795bafc85388694465",
  "parents": [
    "7361340b62ecc37a685a8c6bc4b0fec58ddbf3ba"
  ],
  "author": {
    "name": "Max191",
    "email": "44243577+Max191@users.noreply.github.com",
    "time": "Tue Jul 30 10:26:46 2024 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Tue Jul 30 13:26:46 2024 -0400"
  },
  "message": "[Encoding] Add an optional bcast_map attribute to EncodingAttr. (#18032)\n\nThis adds a new optional field to encodings called `bcast_map`. When we\r\nset encodings, we want to set encodings on the inputs to broadcasting\r\noperations, since it is less data to pack. This `bcast_map` is a step\r\ntowards being able to do this, since it is needed in order to know which\r\ndimensions of the tensor correspond to which dimensions of the packed\r\nlayout.\r\n\r\nThe new field is an affine map that encodes which dimensions of the\r\nencoded tensor map to which dimensions in the corresponding operand of\r\nthe data tiled op. For example, if the LHS of a matmul is broadcasted\r\nalong the batch dimension, and we set encoding on the input to the\r\nbroadcast:\r\n```mlir\r\n#map \u003d affine_map\u003c(d0, d1, d2) -\u003e (d1, d2)\u003e\r\n#map1 \u003d affine_map\u003c(d0, d1, d2) -\u003e (d0, d1, d2)\u003e\r\n%se \u003d iree_encoding.set_encoding %lhs : tensor\u003c4x16xf32\u003e -\u003e tensor\u003c4x16xf32, ... bcast_map \u003d #map\r\n%bcast \u003d linalg.broadcast ins(%lhs ... outs(%e : tensor\u003c2x4x16xf32, ... bcast_map \u003d #map1 ... dimensions \u003d [0]\r\n```\r\nThe result of the broadcast, which will be consumed by the matmul, has\r\nan identity broadcast map, and the input to the broadcast has a\r\nbroadcasted affine map. The `#map` says that the dimensions of `%se`\r\ncorrespond to `d1` and `d2` in the LHS of the matmul that consumes\r\n`%bcast`.\r\n\r\nIn cases where we transpose narrow N matmuls, the `bcast_map` remains\r\nthe same. Handling this properly is left as a TODO, to be fixed when\r\nmore pieces land, and we can more properly test transposed narrow N\r\nmatmuls. This is okay for now, since the `bcast_map` is not actually\r\nused anywhere yet.\r\n\r\nSigned-off-by: hanhanW \u003chanhan0912@gmail.com\u003e\r\nCo-authored-by: hanhanW \u003chanhan0912@gmail.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2f1b3b995129509742ac4f93b5606a663f3896ae",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Codegen/Common/EncodingUtils.cpp",
      "new_id": "339fe6ac1fd5ed37f76cd2f7f1808b2f2af2d9ee",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Codegen/Common/EncodingUtils.cpp"
    },
    {
      "type": "modify",
      "old_id": "f829fc843c055dec223d15737d8e65143fc2b82d",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Dialect/Encoding/IR/EncodingBase.td",
      "new_id": "3f1a8671c16a2910c590a6bfb8830b3c86bada9c",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Dialect/Encoding/IR/EncodingBase.td"
    },
    {
      "type": "modify",
      "old_id": "d3384160e79b0d47e88ffa910d4051ade18c21e0",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Dialect/Encoding/IR/EncodingOps.cpp",
      "new_id": "0b3f4f209d23c91c88faa93a9da0a393822cddca",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Dialect/Encoding/IR/EncodingOps.cpp"
    },
    {
      "type": "modify",
      "old_id": "6049b8b26d86022786fbe68942ce88b21c415301",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Dialect/Encoding/IR/test/roundtrip.mlir",
      "new_id": "49588c9f29ba088d333282e62caf6c24fad5abc7",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Dialect/Encoding/IR/test/roundtrip.mlir"
    },
    {
      "type": "modify",
      "old_id": "ce9e5de37f52a40fcd6a199c91e208b08c25c9f9",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/GlobalOptimization/SetEncoding.cpp",
      "new_id": "517798cc5d874ff8c0b45613363b21fd9b5d0387",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/GlobalOptimization/SetEncoding.cpp"
    }
  ]
}
