{"record":{"id":"7d5bf0fe2c57d6ee","repo":"jax-ml/jax","slug":"all-arrays-must-have-the-same-signedness-got-arr","errorCode":null,"errorMessage":"All arrays must have the same signedness, got {arr.is_signed} at index {i} (expected {arr0.is_signed})","messagePattern":"All arrays must have the same signedness, got (.+?) at index (.+?) \\(expected (.+?)\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/experimental/mosaic/gpu/fragmented_array.py","lineNumber":5364,"sourceCode":"    axis += rank\n\n  if len(arrays) == 1:\n    return arr0\n\n  new_shape = list(arr0.shape)\n  for i, arr in enumerate(arrays[1:], start=1):\n    if len(arr.shape) != rank:\n      raise ValueError(\n          f\"All arrays must have the same rank, got {len(arr.shape)} at index\"\n          f\" {i} (expected {rank})\"\n      )\n    if arr.mlir_dtype != arr0.mlir_dtype:\n      raise ValueError(\n          f\"All arrays must have the same dtype, got {arr.mlir_dtype} at\"\n          f\" index {i} (expected {arr0.mlir_dtype})\"\n      )\n    if arr.is_signed != arr0.is_signed:\n      raise ValueError(\n          f\"All arrays must have the same signedness, got {arr.is_signed} at\"\n          f\" index {i} (expected {arr0.is_signed})\"\n      )\n    for d in range(rank):\n      if d != axis and arr.shape[d] != arr0.shape[d]:\n        raise ValueError(\n            \"All arrays must have matching shapes along non-concatenated\"\n            f\" dimensions, got shape {arr.shape} at index {i} (expected dim\"\n            f\" {d} to be {arr0.shape[d]})\"\n        )\n    new_shape[axis] += arr.shape[axis]\n  new_shape = tuple(new_shape)\n\n  match arr0.layout:\n    case TiledLayout():\n      for i, arr in enumerate(arrays[1:], start=1):\n        if arr.layout != arr0.layout:\n          raise ValueError(","sourceCodeStart":5346,"sourceCodeEnd":5382,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/experimental/mosaic/gpu/fragmented_array.py#L5346-L5382","documentation":"For integer fragment types, Mosaic tracks signedness separately from bit width, and register concatenation cannot mix signed and unsigned interpretations of the same type. concatenate therefore verifies arr.is_signed matches arrays[0] and raises ValueError otherwise.","triggerScenarios":"Concatenating an i8-as-signed fragment with an i8-as-unsigned fragment (same mlir dtype, different is_signed flag), typically after loads that specified different is_signed values.","commonSituations":"Loading some tiles with is_signed=True and others with is_signed=False (e.g., signed activations vs unsigned indices/quantized weights); refactoring loads and dropping the is_signed argument so it defaults differently across call sites.","solutions":["Re-load the mismatched fragments with a consistent is_signed value matching arrays[0].is_signed.","Centralize load configuration (is_signed, dtype) in one helper so all fragments in a concat group agree.","Pre-check: assert all(a.is_signed == arrays[0].is_signed for a in arrays)."],"exampleFix":"# before\nregs_a = FragmentedArray.load_untiled(src_a, is_signed=True)\nregs_b = FragmentedArray.load_untiled(src_b, is_signed=False)\nout = FragmentedArray.concatenate([regs_a, regs_b])  # error\n# after\nregs_b = FragmentedArray.load_untiled(src_b, is_signed=True)\nout = FragmentedArray.concatenate([regs_a, regs_b])","handlingStrategy":"validation","validationCode":"s = arrays[0].is_signed\nassert all(a.is_signed == s for a in arrays), [\n    (i, a.is_signed) for i, a in enumerate(arrays)\n]\nout = FragmentedArray.concatenate(arrays, axis=axis)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass is_signed explicitly at every load site; never rely on defaults.","Centralize load configuration in one helper.","Remember signedness is tracked independently of mlir dtype."],"tags":["jax","mosaic-gpu","validation","signedness"],"backgroundTag":"signedness-mismatch","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}