jax-ml/jax · error · ValueError

should have a different axis name from the TensorCoreMesh .

Error message

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

What it means

Mesh compatibility check for ScalarSubcoreMesh: two meshes used in the same kernel must not claim the same axis names inconsistently; a ScalarSubcoreMesh whose axis name collides with another mesh's naming raises ValueError. The input at fault is the mesh axis_name configuration.

Solutions

  1. Rename the ScalarSubcoreMesh axis (e.g. 'sc') so it differs from the TensorCoreMesh axis
  2. Use distinct, prefixed axis names per core type by convention

Example fix

# before
scalar_mesh = pl_mosaic.ScalarSubcoreMesh(axis_name='cores', ...)
scalar_mesh.check_is_compatible_with(tensorcore_mesh)  # tensorcore_mesh.axis_name == 'cores'
# after
scalar_mesh = pl_mosaic.ScalarSubcoreMesh(axis_name='sc', ...)
Defensive patterns

Strategy: validation

Validate before calling

assert scalar_mesh.axis_name != tc_mesh.axis_name, 'axis names must differ'

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: check_is_compatible_with(other_mesh) where other_mesh is a tpu_core.TensorCoreMesh with the same axis_name as the ScalarSubcoreMesh.

Common situations: Reusing a generic axis name like 'cores' or 'x' for both the TensorCore mesh and SparseCore mesh in a multi-core kernel.

Related errors


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

Appendix: source

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

  def dimension_semantics(self) -> Sequence[tpu_core.DimensionSemantics]:
    return [tpu_core.GridDimensionSemantics.CORE_PARALLEL]

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

  def check_is_compatible_with(self, other_mesh):
    if isinstance(other_mesh, ScalarSubcoreMesh):
      raise ValueError("You can't use two different ScalarSubcoreMeshes.")
    elif isinstance(other_mesh, VectorSubcoreMesh):
      if (self.axis_name == other_mesh.core_axis_name
          and self.num_cores == other_mesh.num_cores):
        return True
      raise ValueError(f"{self} should have the same core axis name and number"
                       f" of cores as the VectorSubcoreMesh {other_mesh}.")
    elif isinstance(other_mesh, tpu_core.TensorCoreMesh):
      if self.axis_name == other_mesh.axis_name:
        raise ValueError(
            f"{self} should have a different axis name from the TensorCoreMesh"
            f" {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_SHARED,
        tpu_core.MemorySpace.SMEM,
        tpu_core.MemorySpace.SEMAPHORE,
    ]

  @contextlib.contextmanager
  def tracing_context(self):
    yield

View on GitHub (pinned to 1e1c6a8fc0)