)]}'
{
  "commit": "774d7bfdfc07a85e6582201b4d72fd0bd10e8b21",
  "tree": "3d04d12094cb0ad90f35bfc625decb3b6c9f1fe9",
  "parents": [
    "6caa91743beb38c369d45f5ccf10f6bd5fc2fd57"
  ],
  "author": {
    "name": "Roberto Laudani",
    "email": "laudani@roofline.ai",
    "time": "Thu Jul 09 15:02:43 2026 +0200"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Thu Jul 09 15:02:43 2026 +0200"
  },
  "message": "[GlobalOpt] Add pass to convert broadcast batch_matmul to matmul (#24670)\n\nWhen a `linalg.batch_matmul` multiplies a batched input by a weight that\nis the same for every batch, every batch slice runs the same matmul\nagainst the same weight. This pass rewrites that case into a single\n`linalg.matmul`.\n\nFor an input of shape `[B, M, K]` and a weight `[K, N]` broadcast to\n`[B, K, N]`, the pass:\n\n  1. collapses the input to `[B*M, K]` using tensor.collapse_shape\n  2. multiplies it by the `[K, N]` weight using linalg.matmul\n  3. expands the result back to `[B, M, N]` using tensor.expand_shape\n\nThis removes the broadcast and turns the batched contraction into a\nplain\nmatmul, which downstream passes can handle better.\n\n---------\n\nSigned-off-by: Roberto Laudani \u003claudani@roofline.ai\u003e\nCo-authored-by: ziereis \u003cziereis@roofline.ai\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "03dd920131e8ffc8b67dfa4977038310985d5fc1",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/GlobalOptimization/BUILD.bazel",
      "new_id": "5b5ac1751193df614dce9037eea11b42fece6ca0",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/GlobalOptimization/BUILD.bazel"
    },
    {
      "type": "modify",
      "old_id": "050b3c950fa793ffde7dfb8450f49732f6674844",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/GlobalOptimization/CMakeLists.txt",
      "new_id": "c3b994d3fa6384693ddfe32980776730a591579f",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/GlobalOptimization/CMakeLists.txt"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "648edf1aa5907eff468626b6d1cb6ac60cf94447",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/GlobalOptimization/ConvertBatchMatmulToMatmul.cpp"
    },
    {
      "type": "modify",
      "old_id": "2db2ee1cf14bfdd7b9c62b7e5c07de1ea5c04b1c",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/GlobalOptimization/Passes.cpp",
      "new_id": "049053d9830b28e69633521555980e424c7a3b1b",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/GlobalOptimization/Passes.cpp"
    },
    {
      "type": "modify",
      "old_id": "8b9260ee3656da34f1c5a6aa843c47ee2535c686",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/GlobalOptimization/Passes.td",
      "new_id": "b05e76dc6f2b3aec62cbe78a8d546acba61e008c",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/GlobalOptimization/Passes.td"
    },
    {
      "type": "modify",
      "old_id": "8d3342632466c676d20cd5be7deae8327bcc1fee",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/GlobalOptimization/test/BUILD.bazel",
      "new_id": "a8481d7a92f8693e0f2738dfdfe4649b789a37a1",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/GlobalOptimization/test/BUILD.bazel"
    },
    {
      "type": "modify",
      "old_id": "e36a746b2db604f356dba8485f0efba3ea7b26b8",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/GlobalOptimization/test/CMakeLists.txt",
      "new_id": "95ae4f98dbc26a29e3d3e59e1db05d9bc7f1a499",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/GlobalOptimization/test/CMakeLists.txt"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "1d36e5e6a40fdfbcca7c492e9a3c266ecc774396",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/GlobalOptimization/test/convert_batch_matmul_to_matmul.mlir"
    },
    {
      "type": "modify",
      "old_id": "e4bb04b6aeeb17b0b99c484e76998535145288cb",
      "old_mode": 33188,
      "old_path": "tests/e2e/regression/BUILD.bazel",
      "new_id": "0991c05f1a4a6c341a582185a587680406c50b5c",
      "new_mode": 33188,
      "new_path": "tests/e2e/regression/BUILD.bazel"
    },
    {
      "type": "modify",
      "old_id": "8ce9ed73e043bcf2ea004f7f3d5068de0ef23b8f",
      "old_mode": 33188,
      "old_path": "tests/e2e/regression/CMakeLists.txt",
      "new_id": "b8a5fc2d56df8b486bed0c23ea9a371dc3860771",
      "new_mode": 33188,
      "new_path": "tests/e2e/regression/CMakeLists.txt"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "316d6f3d4cb74e98bba84284a9df3165680e0635",
      "new_mode": 33188,
      "new_path": "tests/e2e/regression/broadcast_batch_matmul_to_matmul.mlir"
    }
  ]
}
