)]}'
{
  "commit": "247de366d03d7a4dc0eb7a960e089abaa48a496d",
  "tree": "8405e79fcdc0d5cf8f0693d25b2f21ab52b0bc21",
  "parents": [
    "1f69b857fffb2367682b436684cd9868329cd109"
  ],
  "author": {
    "name": "maxbartel",
    "email": "bartel@roofline.ai",
    "time": "Tue Jun 25 17:25:30 2024 +0200"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Tue Jun 25 17:25:30 2024 +0200"
  },
  "message": "[Python API] Fix python api for bytecode (#17343)\n\nThis fixes an issue seen in https://github.com/iree-org/iree/pull/17278.\r\nMLIR bytecode can have a zero as the last byte depending on the IR. If\r\nthis happens by accident parsing will fail. This PR checks if a buffer\r\nbegins with the _magic number_ from\r\nhttps://mlir.llvm.org/docs/BytecodeFormat/#magic-number and sets\r\nzero-termination to false if it does.\r\n\r\nHowever I could not generate MLIR bytecode that ends with a zero other\r\nthan the one in the PR. Even if I save the IR used in textual format and\r\nparse it again, some additional bytes are appended and it is not zero\r\nterminated anymore. I think this is because of some behavior in TF.\r\n\r\nStill after reading a bit through\r\nhttps://mlir.llvm.org/docs/BytecodeFormat I think the check implemented\r\nin this PR is the correct behavior for bytecode.\r\n\r\n---------\r\n\r\nSigned-off-by: Maximilian Bartel \u003cbartel@roofline.ai\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "75578848339077fad0e020f654752d53081c9c5a",
      "old_mode": 33188,
      "old_path": "compiler/bindings/python/iree/compiler/api/ctypes_dl.py",
      "new_id": "784fc6160f7eefa8786bb1a1ab83a18260302138",
      "new_mode": 33188,
      "new_path": "compiler/bindings/python/iree/compiler/api/ctypes_dl.py"
    },
    {
      "type": "modify",
      "old_id": "ab70fcd0858e9f67350e0e3d351e9fcf22d1c6e3",
      "old_mode": 33188,
      "old_path": "compiler/bindings/python/test/api/api_test.py",
      "new_id": "0d52bd3ba0040df58ec4786ecf7d9e94ec47f7d9",
      "new_mode": 33188,
      "new_path": "compiler/bindings/python/test/api/api_test.py"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "0ee6e0115747d0393fb6f8fed1e6388d8b5cabc7",
      "new_mode": 33188,
      "new_path": "compiler/bindings/python/test/api/testdata/bytecode_testfile.bc"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "500820fe9cca00d6a6a2d2fa31dd4a134fa2f84f",
      "new_mode": 33188,
      "new_path": "compiler/bindings/python/test/api/testdata/bytecode_zero_terminated_testfile.bc"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "5e26d00426c3026ff065f7326b7eab14f17ef8d9",
      "new_mode": 33188,
      "new_path": "compiler/bindings/python/test/api/testdata/generate_mlir_bytecode.py"
    },
    {
      "type": "modify",
      "old_id": "2dec1b36052c8d0b61ee6bddff75c8c1d8f0e848",
      "old_mode": 33188,
      "old_path": "compiler/bindings/python/test/tools/compiler_tflite_test.py",
      "new_id": "867b4ae88b37d4c3ce538a1be230ce5a8380da18",
      "new_mode": 33188,
      "new_path": "compiler/bindings/python/test/tools/compiler_tflite_test.py"
    }
  ]
}
