{"record":{"id":"5bddfbeae15ab0aa","repo":"jax-ml/jax","slug":"cannot-tile-a-transpose-permutation-tiling-di","errorCode":null,"errorMessage":"Cannot tile a transpose ({permutation}). Tiling dims ({permutation[-tiling_len:]}) cannot contain non-tiled dims. All of them must be >= {tiling_offset}.","messagePattern":"Cannot tile a transpose \\((.+?)\\)\\. Tiling dims \\((.+?)\\) cannot contain non-tiled dims\\. All of them must be >= (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/experimental/mosaic/gpu/dialect_lowering.py","lineNumber":2171,"sourceCode":"    # For example, for 3D input:\n    #   permutation: (0, 2, 1)\n    #   in_transforms: TilingTransform((32, 8))\n    # We expect:\n    #   out_transforms: TilingTransform((8, 32))\n    # TODO(olechwierowicz): Support multiple transforms.\n    [transform] = out_transforms\n    [in_transform] = in_transforms\n    if not isinstance(transform, lc.TileTransform) or not isinstance(\n        in_transform, lc.TileTransform\n    ):\n      raise NotImplementedError(\n          f\"Unsupported in/out transforms. In transform: {in_transform}, out\"\n          f\" transform: {transform}\"\n      )\n    tiling_len = len(in_transform.tiling)\n    tiling_offset = len(permutation) - tiling_len\n    if any(dim < tiling_offset for dim in permutation[-tiling_len :]):\n      raise ValueError(\n          f\"Cannot tile a transpose ({permutation}). Tiling dims\"\n          f\" ({permutation[-tiling_len:]}) cannot contain non-tiled dims.\"\n          f\" All of them must be >= {tiling_offset}.\"\n      )\n    dims = [-1] * len(permutation)\n    dims = dims[:-tiling_len] + list(in_transform.tiling)\n    permuted_dims = tuple(dims[permutation[i]] for i in range(len(dims)))\n    if permuted_dims[-tiling_len:] != transform.tiling:\n      raise ValueError(\n          f\"Invalid in/out transforms. In transform: {in_transform}, out\"\n          f\" transform: {transform}\"\n      )\n    new_permutation = permutation + [\n        x + tiling_len for x in permutation[-tiling_len:]\n    ]\n    new_permutation = _permutation_to_affine_map_attr(new_permutation)\n\n  new_transpose_op = memref.TransposeOp(","sourceCodeStart":2153,"sourceCodeEnd":2189,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/experimental/mosaic/gpu/dialect_lowering.py#L2153-L2189","documentation":"When transposing a tiled memref, the permuted tiling dimensions must only permute among themselves (i.e. each tiling dim index must be >= tiling_offset). Otherwise tiled and untiled dimensions would interleave, which the lowering cannot express.","triggerScenarios":"A permutation whose last tiling_len entries (the tiled dims) contain any index < len(permutation) - tiling_len, e.g. transposing a 2D tile across the tile/element boundary.","commonSituations":"Transposing a tiled smem buffer with a permutation that mixes tile dims with regular dims, e.g. permutation like [2,0,1] on shape with trailing tiling of 2.","solutions":["Restructure the permutation so the tiled (trailing) dimensions permute only among themselves","Apply the transpose before tiling, then re-tile the result","Choose tile shapes such that the desired permutation stays within the tiled block"],"exampleFix":"// before\n# tiled dims are the trailing 2\nout = t.memref.transpose(tiled, permutation=[2, 0, 1])  # mixes tile/untiled\n// after\nout = t.memref.transpose(tiled, permutation=[0, 2, 1])  # tile dims permuted among themselves","handlingStrategy":"validation","validationCode":"off = len(permutation) - tiling_len\nassert all(d >= off for d in permutation[-tiling_len:]), 'tile dims must permute among themselves'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Permute tile dims only within the tiled block","Transpose before tiling when full permutation is needed"],"tags":["jax","mosaic-gpu","transpose","tiling","permutation"],"backgroundTag":"invalid-tiling-permutation","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}