{"record":{"id":"0c8145f65b5ed144","repo":"jax-ml/jax","slug":"only-1d-vectors-are-supported-v-ty","errorCode":null,"errorMessage":"Only 1D vectors are supported {v_ty}","messagePattern":"Only 1D vectors are supported (.+?)","errorType":"validation","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/experimental/mosaic/gpu/utils.py","lineNumber":2110,"sourceCode":"      raise ValueError(f\"Can't bitcast {x.type} to {new_type}\")\n    return vector.bitcast(new_type, x)\n  if isinstance(x.type, ir.IntegerType) and isinstance(new_type, ir.FloatType):\n    return arith.bitcast(new_type, x)\n  if isinstance(x.type, ir.FloatType) and isinstance(new_type, ir.IntegerType):\n    return arith.bitcast(new_type, x)\n  if isinstance(x.type, ir.FloatType) and isinstance(new_type, ir.FloatType):\n    return arith.bitcast(new_type, x)\n  raise ValueError(f\"Can't bitcast {x.type} to {new_type}\")\n\n\ndef ceil_div(x: int, y: int):\n  return (x + y - 1) // y\n\n\ndef vector_slice(v: ir.Value, s: slice):\n  v_ty = ir.VectorType(v.type)\n  if len(v_ty.shape) != 1:\n    raise NotImplementedError(f\"Only 1D vectors are supported {v_ty}\")\n  [v_len] = v_ty.shape\n  slice_length = len(range(v_len)[s])\n  return vector.extract_strided_slice(\n      ir.VectorType.get((slice_length,), v_ty.element_type),\n      v,\n      [s.start or 0],\n      [slice_length],\n      [1],\n  )\n\n\ndef vector_concat(\n    vectors: Sequence[ir.Value[ir.VectorType]],\n) -> ir.Value[ir.VectorType]:\n  if not vectors:\n    raise ValueError(\"Cannot concatenate an empty list of vectors\")\n  vty = vectors[0].type\n  if not isinstance(vty, ir.VectorType):","sourceCodeStart":2092,"sourceCodeEnd":2128,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/experimental/mosaic/gpu/utils.py#L2092-L2128","documentation":"vector_slice uses extract_strided_slice which only applies along a single dimension, so only rank-1 vectors are supported. Passing a 2D+ vector raises NotImplementedError with the offending vector type in the message.","triggerScenarios":"Calling vector_slice(v, s) where v is e.g. of type vector<4x8xf32> — any rank >= 2 vector value.","commonSituations":"Slicing a matrix tile produced by a 2D tiling layout; upgrading layouts from 1D to 2D without updating slicing logic.","solutions":["Flatten to 1D before slicing (vector.shape_cast to rank-1, slice, then cast back)","Use extract_strided_slice directly with per-dimension offsets for >=2D vectors","Restructure the kernel to keep vectors rank-1 where slicing is needed"],"exampleFix":"# before\npart = vector_slice(v_2d, slice(0, 2))\n# after\nflat = vector.shape_cast(ir.VectorType.get((32,), f32), v_2d)\npart = vector_slice(flat, slice(0, 16))","handlingStrategy":"validation","validationCode":"assert ir.VectorType(v.type).rank == 1, f'vector_slice needs 1D, got {v.type}'","typeGuard":"def is_1d_vector(v) -> bool:\n    t = v.type\n    return isinstance(t, ir.VectorType) and ir.VectorType(t).rank == 1","tryCatchPattern":null,"preventionTips":["shape_cast to rank-1 before slicing","Keep slicing logic on flat vectors"],"tags":["mosaic-gpu","vector-slice","rank","not-implemented"],"backgroundTag":"unsupported-vector-rank","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}