jax-ml/jax · error · ValueError

{self} should have a different core axis name from the Tenso

Error message

{self} should have a different core axis name from the TensorCoreMesh {other_mesh}.

What it means

A VectorSubcoreMesh's core axis name must differ from a TensorCoreMesh's axis name when the two are combined, otherwise the axis mapping between tensor and sparse cores is ambiguous.

Source

Thrown at jax/_src/pallas/mosaic/sc_core.py:180

        tpu_core.GridDimensionSemantics.SUBCORE_PARALLEL,
    ]

  def discharges_effect(self, effect):
    del effect  # Unused.
    return False

  def check_is_compatible_with(self, other_mesh):
    if isinstance(other_mesh, VectorSubcoreMesh):
      raise ValueError("You can't use two different VectorSubcoreMeshes.")
    elif isinstance(other_mesh, ScalarSubcoreMesh):
      if (other_mesh.axis_name == self.core_axis_name
          and other_mesh.num_cores == self.num_cores):
        return True
      raise ValueError(f"{self} should have the same core axis name and number"
                       f" of cores as the ScalarSubcoreMesh {other_mesh}.")
    elif isinstance(other_mesh, tpu_core.TensorCoreMesh):
      if self.core_axis_name == other_mesh.axis_name:
        raise ValueError(
            f"{self} should have a different core axis name from the"
            f" TensorCoreMesh {other_mesh}."
        )
      if self.subcore_axis_name == other_mesh.axis_name:
        raise ValueError(
            f"{self} should have a different subcore axis name from the"
            f" TensorCoreMesh {other_mesh}."
        )
      return True
    return super().check_is_compatible_with(other_mesh)

  @property
  def supported_memory_spaces(self) -> Sequence[Any]:
    return [
        tpu_core.MemorySpace.VMEM,
        tpu_core.MemorySpace.VMEM_SHARED,
        tpu_core.MemorySpace.SMEM,
        tpu_core.MemorySpace.SEMAPHORE,

View on GitHub (pinned to 1e1c6a8fc0)

Solutions

  1. Rename the VectorSubcoreMesh core_axis_name to something like 'sc'
  2. Adopt per-core-type axis name prefixes

Example fix

# before
vec = pl_mosaic.VectorSubcoreMesh(core_axis_name='cores', ...)
# after
vec = pl_mosaic.VectorSubcoreMesh(core_axis_name='sc', ...)
Defensive patterns

Strategy: validation

Validate before calling

assert vec.core_axis_name != tc_mesh.axis_name

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: check_is_compatible_with(tensor_core_mesh) where vector_mesh.core_axis_name == tensor_mesh.axis_name.

Common situations: Using the same axis name string for TPU tensor-core grid and SparseCore grid.

Related errors


AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27). Data as JSON: /api/errors/308c157ede8d98a9. Report an issue: GitHub.