{"record":{"id":"4f1427d8f78ddcc1","repo":"jax-ml/jax","slug":"reassociation-reassociation-is-not-compatible-wi","errorCode":null,"errorMessage":"Reassociation {reassociation} is not compatible with tiling {t_in.tiling}, as it causes tiled and untiled dimensions to be collapsed together","messagePattern":"Reassociation (.+?) is not compatible with tiling (.+?), as it causes tiled and untiled dimensions to be collapsed together","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/experimental/mosaic/gpu/dialect_lowering.py","lineNumber":2332,"sourceCode":"        f\"Swizzle mismatch. In transforms swizzle: {in_swizzle}, out transforms\"\n        f\" swizzle {out_swizzle}.\"\n    )\n  _check_collapse_shape(op, in_transforms, out_transforms)\n  reassociation = [\n      [ir.IntegerAttr(i).value for i in ir.ArrayAttr(dims)]\n      for dims in op.reassociation\n  ]\n  new_reassociation = reassociation.copy()\n  if in_transforms:\n    [t_in] = in_transforms\n    assert isinstance(t_in, lc.TileTransform)\n    tiling_rank = to_process =  len(t_in.tiling)\n    for index_from_end, dims in enumerate(reassociation[::-1]):\n      to_process -= len(dims)\n      if to_process < 0:\n        # This should be caught by `_check_collapse_shape` today, but we check\n        # it here as well in case `cs.CollapseShape` ever changes to allow this.\n        raise ValueError(\n            f\"Reassociation {reassociation} is not compatible with tiling \"\n            f\"{t_in.tiling}, as it causes tiled and untiled dimensions to \"\n            \"be collapsed together\"\n        )\n      if to_process == 0:\n        for t_dims in reassociation[-index_from_end - 1:]:\n          new_reassociation.append([dim + tiling_rank for dim in t_dims])\n        break\n    assert to_process == 0\n\n  result = memref.collapse_shape(\n      transform_type(op.result.type, out_transforms),\n      unwrap_transformed_memref(op.src, in_transforms_attr),\n      new_reassociation,\n  )\n  return [wrap_transformed_memref(result, op.result.type, out_transforms_attr)]\n\n","sourceCodeStart":2314,"sourceCodeEnd":2350,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/experimental/mosaic/gpu/dialect_lowering.py#L2314-L2350","documentation":"Defensive check in collapse_shape lowering: the reassociation must not cause tiled and untiled dimensions to be collapsed into the same output dimension. Walking reassociation groups from the end, the tile budget must never go negative.","triggerScenarios":"A reassociation group that mixes trailing tiled dimensions with non-tiled dimensions, e.g. group [1,2] where only dim 2 is tiled.","commonSituations":"Normally pre-empted by _check_collapse_shape, but reachable if the symbolic-collapse semantics change; user-visible when hand-crafting reassociations on tiled buffers.","solutions":["Regroup the reassociation so each output dim comes entirely from tiled or entirely from untiled source dims","Align tile shape to group boundaries","Untile before collapsing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"to_process = tiling_rank\nfor dims in reassociation[::-1]:\n    to_process -= len(dims)\n    assert to_process >= 0, 'tiled and untiled dims collapsed together'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never mix tiled and untiled dims in one reassociation group"],"tags":["jax","mosaic-gpu","collapse-shape","reassociation","tiling"],"backgroundTag":"invalid-tiling-permutation","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}