jax-ml/jax · error · ValueError
All arrays must have the same signedness, got {arr.is_signed
Error message
All arrays must have the same signedness, got {arr.is_signed} at index {i} (expected {arr0.is_signed}) What it means
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.
Source
Thrown at jax/experimental/mosaic/gpu/fragmented_array.py:5364
axis += rank
if len(arrays) == 1:
return arr0
new_shape = list(arr0.shape)
for i, arr in enumerate(arrays[1:], start=1):
if len(arr.shape) != rank:
raise ValueError(
f"All arrays must have the same rank, got {len(arr.shape)} at index"
f" {i} (expected {rank})"
)
if arr.mlir_dtype != arr0.mlir_dtype:
raise ValueError(
f"All arrays must have the same dtype, got {arr.mlir_dtype} at"
f" index {i} (expected {arr0.mlir_dtype})"
)
if arr.is_signed != arr0.is_signed:
raise ValueError(
f"All arrays must have the same signedness, got {arr.is_signed} at"
f" index {i} (expected {arr0.is_signed})"
)
for d in range(rank):
if d != axis and arr.shape[d] != arr0.shape[d]:
raise ValueError(
"All arrays must have matching shapes along non-concatenated"
f" dimensions, got shape {arr.shape} at index {i} (expected dim"
f" {d} to be {arr0.shape[d]})"
)
new_shape[axis] += arr.shape[axis]
new_shape = tuple(new_shape)
match arr0.layout:
case TiledLayout():
for i, arr in enumerate(arrays[1:], start=1):
if arr.layout != arr0.layout:
raise ValueError(View on GitHub (pinned to 1e1c6a8fc0)
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).
Example fix
# before regs_a = FragmentedArray.load_untiled(src_a, is_signed=True) regs_b = FragmentedArray.load_untiled(src_b, is_signed=False) out = FragmentedArray.concatenate([regs_a, regs_b]) # error # after regs_b = FragmentedArray.load_untiled(src_b, is_signed=True) out = FragmentedArray.concatenate([regs_a, regs_b])
Defensive patterns
Strategy: validation
Validate before calling
s = arrays[0].is_signed
assert all(a.is_signed == s for a in arrays), [
(i, a.is_signed) for i, a in enumerate(arrays)
]
out = FragmentedArray.concatenate(arrays, axis=axis) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- dims and idxs must have the same length
- Swizzle {self.swizzle} is not supported. Only 32, 64 and 128
- cluster= must be at most 3D, got {self}.
- grid_names must have the same length as grid, got {self}.
- cluster_names must have the same length as cluster, got {sel
AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27).
Data as JSON: /api/errors/7d5bf0fe2c57d6ee.
Report an issue: GitHub.