{"record":{"id":"6324efaed79a950e","repo":"jax-ml/jax","slug":"self-should-have-the-same-core-axis-name-and-num","errorCode":null,"errorMessage":"{self} should have the same core axis name and number of cores as the VectorSubcoreMesh {other_mesh}.","messagePattern":"(.+?) should have the same core axis name and number of cores as the VectorSubcoreMesh (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/mosaic/sc_core.py","lineNumber":91,"sourceCode":"  def size(self) -> int:\n    return self.num_cores\n\n  @property\n  def dimension_semantics(self) -> Sequence[tpu_core.DimensionSemantics]:\n    return [tpu_core.GridDimensionSemantics.CORE_PARALLEL]\n\n  def discharges_effect(self, effect):\n    del effect  # Unused.\n    return False\n\n  def check_is_compatible_with(self, other_mesh):\n    if isinstance(other_mesh, ScalarSubcoreMesh):\n      raise ValueError(\"You can't use two different ScalarSubcoreMeshes.\")\n    elif isinstance(other_mesh, VectorSubcoreMesh):\n      if (self.axis_name == other_mesh.core_axis_name\n          and self.num_cores == other_mesh.num_cores):\n        return True\n      raise ValueError(f\"{self} should have the same core axis name and number\"\n                       f\" of cores as the VectorSubcoreMesh {other_mesh}.\")\n    elif isinstance(other_mesh, tpu_core.TensorCoreMesh):\n      if self.axis_name == other_mesh.axis_name:\n        raise ValueError(\n            f\"{self} should have a different axis name from the TensorCoreMesh\"\n            f\" {other_mesh}.\"\n        )\n      return True\n    return super().check_is_compatible_with(other_mesh)\n\n  @property\n  def supported_memory_spaces(self) -> Sequence[Any]:\n    return [\n        tpu_core.MemorySpace.VMEM_SHARED,\n        tpu_core.MemorySpace.SMEM,\n        tpu_core.MemorySpace.SEMAPHORE,\n    ]\n","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/mosaic/sc_core.py#L73-L109","documentation":"ScalarSubcoreMesh.check_is_compatible_with raises this when paired with a VectorSubcoreMesh whose core_axis_name or num_cores do not match the scalar mesh's axis_name/num_cores. Both meshes must describe the same set of SparseCores for the kernel to be well-formed.","triggerScenarios":"Passing a VectorSubcoreMesh to ScalarSubcoreMesh.check_is_compatible_with where axis names differ or core counts differ.","commonSituations":"Typos or renamed axis names between mesh definitions; hardcoding num_cores for one mesh while the other is derived from hardware.","solutions":["Align the ScalarSubcoreMesh.axis_name with VectorSubcoreMesh.core_axis_name","Set the same num_cores on both meshes (derive both from get_sparse_core_info())","Prefer reusing one mesh definition/config object for both"],"exampleFix":"# before\nscalar_mesh.check_is_compatible_with(pl_mosaic.VectorSubcoreMesh(core_axis_name='sc', subcore_axis_name='lane', num_cores=4))\n# after (match axis name and core count)\nscalar_mesh.check_is_compatible_with(pl_mosaic.VectorSubcoreMesh(core_axis_name=scalar_mesh.axis_name, subcore_axis_name='lane', num_cores=scalar_mesh.num_cores))","handlingStrategy":"validation","validationCode":"def meshes_compatible(s, v):\n    return s.axis_name == v.core_axis_name and s.num_cores == v.num_cores","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Derive both meshes' core count from get_sparse_core_info()","Define axis names once in a shared config"],"tags":["jax","pallas","tpu","sparsecore","mesh-compat"],"backgroundTag":"mesh-incompatibility","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}