)]}'
{
  "commit": "cdf4e1fbb35cd5e7853e4449e2271fa81f14232b",
  "tree": "9cfd36ea3fd903f7f382327788db8a7e74eccb7e",
  "parents": [
    "0a03b4e8cb93c0a2e59896b5ab9b4d6be228f20a"
  ],
  "author": {
    "name": "Zmicier Prybysh",
    "email": "zprybysh@baylibre.com",
    "time": "Fri Sep 04 11:54:00 2026 +0200"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Fri Sep 04 09:54:00 2026 +0000"
  },
  "message": "[Codegen] Use overflow-checked math in the CPU and GPU alloc size checks (#24745)\n\n`checkStackAllocationSize` accumulates the allocation size in a plain\nint64_t. Allocas sized by the upper bound of an unbounded dynamic\ndimension (the util.assume.int default, 2^53-1) overflow it, the wrapped\nvalue passes the limit check and the alloca reaches ConvertToLLVM, where\nits element count folds to llvm.mlir.poison and the program loads and\nstores through a garbage pointer at runtime.\n\nThe reproduction was reduced from the quantized ResNet downsample\nconstruct: an ONNX model with a dynamic batch doing DequantizeLinear -\u003e\n1x1 stride-2 Conv compiles without diagnostics and returns completely\nwrong results.\n\nMove `getStaticShapeSizeInBits` to Codegen/Utils (taken from\nhttps://github.com/iree-org/iree/pull/24684) and use it from both\nLLVMCPUCheckIRBeforeLLVMConversion and GPUCheckResourceUsage. Callers\nsupply the leaf element bit width,\nwhich lets the GPU check keep its index-bitwidth handling and the\nrecursion into shaped element types. On the CPU side the remaining\nscalar steps are overflow-checked in place with `llvm::MulOverflow` /\n`llvm::AddOverflow`. The pre-existing\n`checkedAdd`/`checkedMul`/`checkedAlignTo` wrappers in\nLLVMCPUAssignWorkgroupLocalMemory.cpp are replaced with\n`llvm::MulOverflow` / `llvm::AddOverflow`.\n\n---------\n\nSigned-off-by: Zmicier Prybysh \u003czprybysh@baylibre.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "10836994c951670de6c3bb350767bcbd2919bfd6",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Codegen/Common/GPU/GPUCheckResourceUsage.cpp",
      "new_id": "153c09318c330e3b772900ddd40b6ef8300fe7d0",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Codegen/Common/GPU/GPUCheckResourceUsage.cpp"
    },
    {
      "type": "modify",
      "old_id": "f2d7804d7655481ba03168455502f77c36679c25",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Codegen/Common/GPU/test/gpu_check_resource_usage.mlir",
      "new_id": "ffb8b15ce483e142c0cf8fef4558027ccd54333c",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Codegen/Common/GPU/test/gpu_check_resource_usage.mlir"
    },
    {
      "type": "modify",
      "old_id": "d75b100a9372b42dd34c620284c2da7074b71fd0",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPUAssignWorkgroupLocalMemory.cpp",
      "new_id": "70929efc78bdd8ee728b6bfde35372e9f5be06aa",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPUAssignWorkgroupLocalMemory.cpp"
    },
    {
      "type": "modify",
      "old_id": "a06f5077ea948fbfd07bb53fc7e6a3fc2ff4a005",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPUCheckIRBeforeLLVMConversion.cpp",
      "new_id": "024ac596f61084f724b2591be8d8ae2fdbb60c75",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPUCheckIRBeforeLLVMConversion.cpp"
    },
    {
      "type": "modify",
      "old_id": "5d52002fd49b9b3b05227c912d694f10b51bd075",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Codegen/LLVMCPU/test/check_ir_before_llvm_conversion.mlir",
      "new_id": "fb9e014c730f88a24922c45ec71381472005add7",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Codegen/LLVMCPU/test/check_ir_before_llvm_conversion.mlir"
    },
    {
      "type": "modify",
      "old_id": "34d30e455ac40b5c62bc20728845f2e1be36881a",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Codegen/Utils/Utils.cpp",
      "new_id": "152eaa71fb7d680446fd3acb5ce91fb4634ce85f",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Codegen/Utils/Utils.cpp"
    },
    {
      "type": "modify",
      "old_id": "a6a32f17aa7423141b9ba2efbf43479c07aa6d95",
      "old_mode": 33188,
      "old_path": "compiler/src/iree/compiler/Codegen/Utils/Utils.h",
      "new_id": "782cee2331f6b08f6b4d0e2e1fb475f826bd94fd",
      "new_mode": 33188,
      "new_path": "compiler/src/iree/compiler/Codegen/Utils/Utils.h"
    }
  ]
}
